mirror of https://github.com/apache/activemq.git
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@453124 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
17946e5325
commit
6e80442519
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.activemq.kaha;
|
||||
|
||||
/**
|
||||
* Types of Indexes used by the Store
|
||||
*
|
||||
* @version $Revision: 1.2 $
|
||||
*/
|
||||
public interface IndexTypes{
|
||||
|
||||
/**
|
||||
* use in memory indexes
|
||||
*/
|
||||
public final static String IN_MEMORY_INDEX= "InMemoryIndex";
|
||||
/**
|
||||
* use disk-based indexes
|
||||
*/
|
||||
public final static String DISK_INDEX = "DiskIndex";
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
/**
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.activemq.kaha;
|
||||
|
||||
/**
|
||||
* Entry for Store data
|
||||
*
|
||||
* @version $Revision: 1.2 $
|
||||
*/
|
||||
public interface StoreEntry{
|
||||
|
||||
public abstract StoreLocation getKeyDataItem();
|
||||
|
||||
public abstract StoreLocation getValueDataItem();
|
||||
|
||||
/**
|
||||
* @return next item
|
||||
*/
|
||||
public abstract long getNextItem();
|
||||
|
||||
/**
|
||||
* @return Returns the keyFile.
|
||||
*/
|
||||
public abstract int getKeyFile();
|
||||
|
||||
/**
|
||||
* @return Returns the valueFile.
|
||||
*/
|
||||
public abstract int getValueFile();
|
||||
|
||||
/**
|
||||
* @return Returns the valueOffset.
|
||||
*/
|
||||
public abstract long getValueOffset();
|
||||
|
||||
/**
|
||||
* @return Returns the offset.
|
||||
*/
|
||||
public abstract long getOffset();
|
||||
|
||||
public abstract int getKeySize();
|
||||
|
||||
public abstract int getValueSize();
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
/**
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with this
|
||||
* work for additional information regarding copyright ownership. The ASF
|
||||
* licenses this file to You under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package org.apache.activemq.kaha;
|
||||
|
||||
/**
|
||||
* Location of a data in the Store
|
||||
*
|
||||
* @version $Revision: 1.2 $
|
||||
*/
|
||||
public interface StoreLocation{
|
||||
|
||||
/**
|
||||
* @return Returns the size.
|
||||
*/
|
||||
public int getSize();
|
||||
|
||||
/**
|
||||
* @return Returns the offset.
|
||||
*/
|
||||
public long getOffset();
|
||||
|
||||
/**
|
||||
* @return Returns the file.
|
||||
*/
|
||||
public int getFile();
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
/**
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.activemq.kaha.impl;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Exception thrown if the store is in use by another application
|
||||
*
|
||||
* @version $Revision: 1.1.1.1 $
|
||||
*/
|
||||
public class StoreLockedExcpetion extends IOException{
|
||||
|
||||
private static final long serialVersionUID=3857646689671366926L;
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
public StoreLockedExcpetion(){
|
||||
}
|
||||
|
||||
/**
|
||||
* @param s
|
||||
*/
|
||||
public StoreLockedExcpetion(String s){
|
||||
super(s);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/**
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.activemq.store.kahadaptor;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
import org.apache.activemq.kaha.Marshaller;
|
||||
import org.apache.activemq.kaha.impl.index.IndexItem;
|
||||
|
||||
|
||||
/**
|
||||
* Marshall a TopicSubAck
|
||||
* @version $Revision: 1.10 $
|
||||
*/
|
||||
public class StoreEntryMarshaller implements Marshaller{
|
||||
|
||||
|
||||
public void writePayload(Object object,DataOutput dataOut) throws IOException{
|
||||
IndexItem item = (IndexItem)object;
|
||||
dataOut.writeLong(item.getOffset());
|
||||
item.write(dataOut);
|
||||
|
||||
}
|
||||
|
||||
public Object readPayload(DataInput dataIn) throws IOException{
|
||||
IndexItem item = new IndexItem();
|
||||
item.setOffset(dataIn.readLong());
|
||||
item.read(dataIn);
|
||||
return item;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
/**
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE
|
||||
* file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
|
||||
* to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
|
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.activemq.store.kahadaptor;
|
||||
|
||||
import org.apache.activemq.kaha.StoreEntry;
|
||||
|
||||
/**
|
||||
* Holds information for location of message
|
||||
*
|
||||
* @version $Revision: 1.10 $
|
||||
*/
|
||||
public class TopicSubAck{
|
||||
|
||||
private int count =0;
|
||||
private StoreEntry storeEntry;
|
||||
|
||||
/**
|
||||
* @return the count
|
||||
*/
|
||||
public int getCount(){
|
||||
return this.count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param count the count to set
|
||||
*/
|
||||
public void setCount(int count){
|
||||
this.count=count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the value of the count after it's decremented
|
||||
*/
|
||||
public int decrementCount() {
|
||||
return --count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the value of the count after it's incremented
|
||||
*/
|
||||
public int incrementCount() {
|
||||
return ++count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the storeEntry
|
||||
*/
|
||||
public StoreEntry getStoreEntry(){
|
||||
return this.storeEntry;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param storeEntry the storeEntry to set
|
||||
*/
|
||||
public void setStoreEntry(StoreEntry storeEntry){
|
||||
this.storeEntry=storeEntry;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
/**
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.activemq.store.kahadaptor;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
import org.apache.activemq.kaha.Marshaller;
|
||||
import org.apache.activemq.kaha.impl.index.IndexItem;
|
||||
|
||||
|
||||
/**
|
||||
* Marshall a TopicSubAck
|
||||
* @version $Revision: 1.10 $
|
||||
*/
|
||||
public class TopicSubAckMarshaller implements Marshaller{
|
||||
|
||||
|
||||
public void writePayload(Object object,DataOutput dataOut) throws IOException{
|
||||
TopicSubAck tsa = (TopicSubAck) object;
|
||||
dataOut.writeInt(tsa.getCount());
|
||||
IndexItem item = (IndexItem)tsa.getStoreEntry();
|
||||
dataOut.writeLong(item.getOffset());
|
||||
item.write(dataOut);
|
||||
|
||||
}
|
||||
|
||||
public Object readPayload(DataInput dataIn) throws IOException{
|
||||
TopicSubAck tsa = new TopicSubAck();
|
||||
int count = dataIn.readInt();
|
||||
tsa.setCount(count);
|
||||
IndexItem item = new IndexItem();
|
||||
item.setOffset(dataIn.readLong());
|
||||
item.read(dataIn);
|
||||
tsa.setStoreEntry(item);
|
||||
return tsa;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue