Clover coverage report -
Coverage timestamp: Thu Jul 5 2007 20:02:32 EDT
file stats: LOC: 186   Methods: 0
NCLOC: 41   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
CacheSPI.java - - - -
coverage
 1    /*
 2    * JBoss, Home of Professional Open Source
 3    *
 4    * Distributable under LGPL license.
 5    * See terms of license at gnu.org.
 6    */
 7    package org.jboss.cache;
 8   
 9    import net.jcip.annotations.ThreadSafe;
 10    import org.jboss.cache.buddyreplication.BuddyManager;
 11    import org.jboss.cache.buddyreplication.GravitateResult;
 12    import org.jboss.cache.interceptors.Interceptor;
 13    import org.jboss.cache.loader.CacheLoader;
 14    import org.jboss.cache.loader.CacheLoaderManager;
 15    import org.jboss.cache.lock.NodeLock;
 16    import org.jboss.cache.marshall.Marshaller;
 17    import org.jboss.cache.notifications.Notifier;
 18    import org.jboss.cache.statetransfer.StateTransferManager;
 19    import org.jboss.cache.transaction.GlobalTransaction;
 20    import org.jboss.cache.transaction.TransactionTable;
 21   
 22    import javax.transaction.Transaction;
 23    import javax.transaction.TransactionManager;
 24    import java.util.List;
 25    import java.util.Map;
 26   
 27    /**
 28    * A more detailed interface to {@link Cache}, which is used when writing plugins for or extending JBoss Cache. A reference
 29    * to this interface should only be obtained when it is passed in to your code, for example when you write an
 30    * {@link Interceptor} or {@link CacheLoader}.
 31    * <p/>
 32    * <B><I>You should NEVER attempt to directly cast a {@link Cache} instance to this interface. In future, the implementation may not allow it.</I></B>
 33    * <p/>
 34    * This interface contains overridden method signatures of some methods from {@link Cache}, overridden to ensure return
 35    * types of {@link Node} are replaced with {@link NodeSPI}.
 36    * <p/>
 37    *
 38    * @author <a href="mailto:manik@jboss.org">Manik Surtani (manik@jboss.org)</a>
 39    * @see NodeSPI
 40    * @see Cache
 41    * @see org.jboss.cache.loader.CacheLoader
 42    * @see org.jboss.cache.interceptors.Interceptor
 43    * @since 2.0.0
 44    */
 45    @ThreadSafe
 46    public interface CacheSPI<K, V> extends Cache<K, V>
 47    {
 48    /**
 49    * Overrides {@link org.jboss.cache.Cache#getRoot()} to return a {@link org.jboss.cache.NodeSPI} instead of a {@link org.jboss.cache.Node}.
 50    */
 51    NodeSPI<K, V> getRoot();
 52   
 53    /**
 54    * Retrieves a reference to a running {@link javax.transaction.TransactionManager}, if one is configured.
 55    *
 56    * @return a TransactionManager
 57    */
 58    TransactionManager getTransactionManager();
 59   
 60    /**
 61    * @return an immutable {@link List} of {@link Interceptor}s configured for this cache, or
 62    * <code>null</code> if {@link Cache#create() create()} has not been invoked
 63    * and the interceptors thus do not exist.
 64    */
 65    List<Interceptor> getInterceptorChain();
 66   
 67    /**
 68    * Adds a custom interceptor to the interceptor chain, at specified position, where the first interceptor in the chain
 69    * is at position 0 and the last one at getInterceptorChain().size() - 1.
 70    *
 71    * @param i the interceptor to add
 72    * @param position the position to add the interceptor
 73    */
 74    void addInterceptor(Interceptor i, int position);
 75   
 76    /**
 77    * Removes the interceptor at a specified position, where the first interceptor in the chain
 78    * is at position 0 and the last one at getInterceptorChain().size() - 1.
 79    *
 80    * @param position the position at which to remove an interceptor
 81    */
 82    void removeInterceptor(int position);
 83   
 84    /**
 85    * @return Retrieves a reference to the currently configured {@link org.jboss.cache.loader.CacheLoaderManager} if one or more cache loaders are configured, null otherwise.
 86    */
 87    CacheLoaderManager getCacheLoaderManager();
 88   
 89    /**
 90    * @return an instance of {@link BuddyManager} if buddy replication is enabled, null otherwise.
 91    */
 92    BuddyManager getBuddyManager();
 93   
 94    /**
 95    * @return the current {@link TransactionTable}
 96    */
 97    TransactionTable getTransactionTable();
 98   
 99    /**
 100    * Gets a handle of the RPC manager.
 101    *
 102    * @return the {@link org.jboss.cache.RPCManager} configured.
 103    */
 104    RPCManager getRPCManager();
 105   
 106    /**
 107    * @return the current {@link org.jboss.cache.statetransfer.StateTransferManager}
 108    */
 109    StateTransferManager getStateTransferManager();
 110   
 111    /**
 112    * @return the name of the cluster. Null if running in local mode.
 113    */
 114    String getClusterName();
 115   
 116    /**
 117    * @return the number of attributes in the cache.
 118    */
 119    int getNumberOfAttributes();
 120   
 121    /**
 122    * @return the number of nodes in the cache.
 123    */
 124    int getNumberOfNodes();
 125   
 126    /**
 127    * Retrieves the current table of locks.
 128    *
 129    * @return lock table.
 130    */
 131    Map<Thread, List<NodeLock>> getLockTable();
 132   
 133    /**
 134    * @return the {@link org.jboss.cache.RegionManager}
 135    */
 136    RegionManager getRegionManager();
 137   
 138    /**
 139    * Returns the global transaction for this local transaction.
 140    * Optionally creates a new global transaction if it does not exist.
 141    *
 142    * @param tx the current transaction
 143    * @param createIfNotExists if true creates a new transaction if none exists
 144    * @return a GlobalTransaction
 145    */
 146    GlobalTransaction getCurrentTransaction(Transaction tx, boolean createIfNotExists);
 147   
 148    /**
 149    * @return the notifier attached with this instance of the cache. See {@link Notifier}, a class
 150    * that is responsible for emitting notifications to registered CacheListeners.
 151    */
 152    Notifier getNotifier();
 153   
 154    /**
 155    * Returns a node without accessing the interceptor chain.
 156    *
 157    * @param fqn the Fqn to look up.
 158    * @param includeDeletedNodes if you intend to see nodes marked as deleted within the current tx, set this to true
 159    * @return a node if one exists or null
 160    */
 161    NodeSPI<K, V> peek(Fqn<?> fqn, boolean includeDeletedNodes);
 162   
 163    /**
 164    * Used with buddy replication's data gravitation interceptor. If marshalling is necessary, ensure that the cache is
 165    * configured to use {@link org.jboss.cache.config.Configuration#useRegionBasedMarshalling} and the {@link org.jboss.cache.Region}
 166    * pertaining to the Fqn passed in is activated, and has an appropriate ClassLoader.
 167    *
 168    * @param fqn the fqn to gravitate
 169    * @param searchBuddyBackupSubtrees if true, buddy backup subtrees are searched and if false, they are not.
 170    * @return a GravitateResult which contains the data for the gravitation
 171    */
 172    GravitateResult gravitateData(Fqn<?> fqn, boolean searchBuddyBackupSubtrees);
 173   
 174    /**
 175    * Retrieves an instance of a {@link Marshaller}, which is capable of
 176    * converting Java objects to bytestreams and back in an efficient manner, which is
 177    * also interoperable with bytestreams produced/consumed by other versions of JBoss
 178    * Cache.
 179    * <p/>
 180    * The use of this marshaller is the <b>recommended</b> way of creating efficient,
 181    * compatible, byte streams from objects.
 182    *
 183    * @return an instance of {@link Marshaller}
 184    */
 185    Marshaller getMarshaller();
 186    }