Save This Page
Home » activemq-parent-5.3.1-source-release » org.apache » activemq » kaha » [javadoc | source]
    1   /**
    2    * Licensed to the Apache Software Foundation (ASF) under one or more
    3    * contributor license agreements.  See the NOTICE file distributed with
    4    * this work for additional information regarding copyright ownership.
    5    * The ASF licenses this file to You under the Apache License, Version 2.0
    6    * (the "License"); you may not use this file except in compliance with
    7    * the License.  You may obtain a copy of the License at
    8    *
    9    *      http://www.apache.org/licenses/LICENSE-2.0
   10    *
   11    * Unless required by applicable law or agreed to in writing, software
   12    * distributed under the License is distributed on an "AS IS" BASIS,
   13    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   14    * See the License for the specific language governing permissions and
   15    * limitations under the License.
   16    */
   17   package org.apache.activemq.kaha;
   18   
   19   import java.io.IOException;
   20   import java.util.Set;
   21   
   22   /**
   23    * A Store is holds persistent containers
   24    * 
   25    * @version $Revision: 1.2 $
   26    */
   27   public interface Store {
   28       /**
   29        * Defauly container name
   30        */
   31       String DEFAULT_CONTAINER_NAME = "kaha";
   32   
   33       /**
   34        * Byte Marshaller
   35        */
   36       Marshaller BYTES_MARSHALLER = new BytesMarshaller();
   37   
   38       /**
   39        * Object Marshaller
   40        */
   41       Marshaller OBJECT_MARSHALLER = new ObjectMarshaller();
   42   
   43       /**
   44        * String Marshaller
   45        */
   46       Marshaller STRING_MARSHALLER = new StringMarshaller();
   47   
   48       /**
   49        * Command Marshaller
   50        */
   51       Marshaller COMMAND_MARSHALLER = new CommandMarshaller();
   52       
   53       /**
   54        * MessageId marshaller
   55        */
   56       Marshaller MESSAGEID_MARSHALLER = new MessageIdMarshaller();
   57   
   58       /**
   59        * close the store
   60        * 
   61        * @throws IOException
   62        */
   63       void close() throws IOException;
   64   
   65       /**
   66        * Force all writes to disk
   67        * 
   68        * @throws IOException
   69        */
   70       void force() throws IOException;
   71   
   72       /**
   73        * empty all the contents of the store
   74        * 
   75        * @throws IOException
   76        */
   77       void clear() throws IOException;
   78   
   79       /**
   80        * delete the store
   81        * 
   82        * @return true if the delete was successful
   83        * @throws IOException
   84        */
   85       boolean delete() throws IOException;
   86   
   87       /**
   88        * Checks if a MapContainer exists in the default container
   89        * 
   90        * @param id
   91        * @return new MapContainer
   92        * @throws IOException
   93        */
   94       boolean doesMapContainerExist(Object id) throws IOException;
   95   
   96       /**
   97        * Checks if a MapContainer exists in the named container
   98        * 
   99        * @param id
  100        * @param containerName
  101        * @return new MapContainer
  102        * @throws IOException
  103        */
  104       boolean doesMapContainerExist(Object id, String containerName) throws IOException;
  105   
  106       /**
  107        * Get a MapContainer with the given id - the MapContainer is created if
  108        * needed
  109        * 
  110        * @param id
  111        * @return container for the associated id or null if it doesn't exist
  112        * @throws IOException
  113        */
  114       MapContainer getMapContainer(Object id) throws IOException;
  115   
  116       /**
  117        * Get a MapContainer with the given id - the MapContainer is created if
  118        * needed
  119        * 
  120        * @param id
  121        * @param containerName
  122        * @return container for the associated id or null if it doesn't exist
  123        * @throws IOException
  124        */
  125       MapContainer getMapContainer(Object id, String containerName) throws IOException;
  126   
  127       /**
  128        * Get a MapContainer with the given id - the MapContainer is created if
  129        * needed
  130        * 
  131        * @param id
  132        * @param containerName
  133        * @param persistentIndex
  134        * @return container for the associated id or null if it doesn't exist
  135        * @throws IOException
  136        */
  137       MapContainer getMapContainer(Object id, String containerName, boolean persistentIndex) throws IOException;
  138   
  139       /**
  140        * delete a container from the default container
  141        * 
  142        * @param id
  143        * @throws IOException
  144        */
  145       void deleteMapContainer(Object id) throws IOException;
  146   
  147       /**
  148        * delete a MapContainer from the name container
  149        * 
  150        * @param id
  151        * @param containerName
  152        * @throws IOException
  153        */
  154       void deleteMapContainer(Object id, String containerName) throws IOException;
  155   
  156       /**
  157        * Delete Map container
  158        * 
  159        * @param id
  160        * @throws IOException
  161        */
  162       void deleteMapContainer(ContainerId id) throws IOException;
  163   
  164       /**
  165        * Get a Set of call MapContainer Ids
  166        * 
  167        * @return the set of ids
  168        * @throws IOException
  169        */
  170       Set<ContainerId> getMapContainerIds() throws IOException;
  171   
  172       /**
  173        * Checks if a ListContainer exists in the default container
  174        * 
  175        * @param id
  176        * @return new MapContainer
  177        * @throws IOException
  178        */
  179       boolean doesListContainerExist(Object id) throws IOException;
  180   
  181       /**
  182        * Checks if a ListContainer exists in the named container
  183        * 
  184        * @param id
  185        * @param containerName
  186        * @return new MapContainer
  187        * @throws IOException
  188        */
  189       boolean doesListContainerExist(Object id, String containerName) throws IOException;
  190   
  191       /**
  192        * Get a ListContainer with the given id and creates it if it doesn't exist
  193        * 
  194        * @param id
  195        * @return container for the associated id or null if it doesn't exist
  196        * @throws IOException
  197        */
  198       ListContainer getListContainer(Object id) throws IOException;
  199   
  200       /**
  201        * Get a ListContainer with the given id and creates it if it doesn't exist
  202        * 
  203        * @param id
  204        * @param containerName
  205        * @return container for the associated id or null if it doesn't exist
  206        * @throws IOException
  207        */
  208       ListContainer getListContainer(Object id, String containerName) throws IOException;
  209   
  210       /**
  211        * Get a ListContainer with the given id and creates it if it doesn't exist
  212        * 
  213        * @param id
  214        * @param containerName
  215        * @param persistentIndex
  216        * @return container for the associated id or null if it doesn't exist
  217        * @throws IOException
  218        */
  219       ListContainer getListContainer(Object id, String containerName, boolean persistentIndex) throws IOException;
  220   
  221       /**
  222        * delete a ListContainer from the default container
  223        * 
  224        * @param id
  225        * @throws IOException
  226        */
  227       void deleteListContainer(Object id) throws IOException;
  228   
  229       /**
  230        * delete a ListContainer from the named container
  231        * 
  232        * @param id
  233        * @param containerName
  234        * @throws IOException
  235        */
  236       void deleteListContainer(Object id, String containerName) throws IOException;
  237   
  238       /**
  239        * delete a list container
  240        * 
  241        * @param id
  242        * @throws IOException
  243        */
  244       void deleteListContainer(ContainerId id) throws IOException;
  245   
  246       /**
  247        * Get a Set of call ListContainer Ids
  248        * 
  249        * @return the set of ids
  250        * @throws IOException
  251        */
  252       Set<ContainerId> getListContainerIds() throws IOException;
  253   
  254       /**
  255        * @return the maxDataFileLength
  256        */
  257       long getMaxDataFileLength();
  258   
  259       /**
  260        * @param maxDataFileLength the maxDataFileLength to set
  261        */
  262       void setMaxDataFileLength(long maxDataFileLength);
  263   
  264   
  265       /**
  266        * @return true if the store has been initialized
  267        */
  268       boolean isInitialized();
  269       
  270       /**
  271        * @return the amount of disk space the store is occupying
  272        */
  273       long size();
  274       
  275       /**
  276        * @return true if persistent indexes are used by default
  277        */
  278       public boolean isPersistentIndex();
  279       
  280   	/**
  281   	 * Set a persistent index as the default if the parameter is true
  282   	 * @param persistentIndex
  283   	 */
  284   	public void setPersistentIndex(boolean persistentIndex);
  285   	
  286   	/**
  287   	 * @return the default container name
  288   	 */
  289   	public String getDefaultContainerName();
  290   
  291   	/**
  292   	 * set the default container name
  293   	 * @param defaultContainerName
  294   	 */
  295       public void setDefaultContainerName(String defaultContainerName);
  296   
  297   	
  298   	/**
  299   	 * An explict call to initialize - this will also be called
  300   	 * implicitly for any other operation on the store.
  301   	 * @throws IOException
  302   	 */
  303   	public void initialize() throws IOException;
  304   	
  305   }

Save This Page
Home » activemq-parent-5.3.1-source-release » org.apache » activemq » kaha » [javadoc | source]