View Javadoc

1   /*
2    * $Id: AbstractPartitionedObjectStore.java 22486 2011-07-21 09:11:49Z stephen.fenech $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.util.store;
12  
13  import org.mule.api.store.ObjectStoreException;
14  import org.mule.api.store.PartitionableObjectStore;
15  
16  import java.io.Serializable;
17  import java.util.List;
18  
19  import org.apache.commons.logging.Log;
20  import org.apache.commons.logging.LogFactory;
21  
22  public abstract class AbstractPartitionedObjectStore<T extends Serializable>
23      implements PartitionableObjectStore<T>
24  {
25      protected final static String DEFAULT_PARTITION = "DEFAULT_PARTITION";
26      protected final Log logger = LogFactory.getLog(this.getClass());
27  
28      @Override
29      public void open() throws ObjectStoreException
30      {
31          open(DEFAULT_PARTITION);
32      }
33  
34      @Override
35      public void close() throws ObjectStoreException
36      {
37          close(DEFAULT_PARTITION);
38      }
39  
40      @Override
41      public List<Serializable> allKeys() throws ObjectStoreException
42      {
43          return allKeys(DEFAULT_PARTITION);
44      }
45  
46      @Override
47      public boolean contains(Serializable key) throws ObjectStoreException
48      {
49          return contains(key, DEFAULT_PARTITION);
50      }
51  
52      @Override
53      public void store(Serializable key, T value) throws ObjectStoreException
54      {
55          store(key, value, DEFAULT_PARTITION);
56      }
57  
58      @Override
59      public T retrieve(Serializable key) throws ObjectStoreException
60      {
61          return retrieve(key, DEFAULT_PARTITION);
62      }
63  
64      @Override
65      public T remove(Serializable key) throws ObjectStoreException
66      {
67          return remove(key, DEFAULT_PARTITION);
68      }
69  
70  }