|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.cache.pojo.impl.PojoCacheImpl
public class PojoCacheImpl
Implementation class for PojoCache interface
Field Summary | |
---|---|
protected org.apache.commons.logging.Log |
log_
|
Constructor Summary | |
---|---|
PojoCacheImpl(org.jboss.cache.config.Configuration config,
boolean toStart)
|
|
PojoCacheImpl(String configStr,
boolean toStart)
|
Method Summary | |
---|---|
void |
addListener(Object listener)
Add a PojoCache listener. |
void |
addListener(Object listener,
Pattern pattern)
Add a PojoCache listener that will only monitor a specific ID(FQN) pattern. |
Object |
attach(org.jboss.cache.Fqn<?> id,
Object pojo)
Attach a POJO into PojoCache. |
Object |
attach(org.jboss.cache.Fqn<?> id,
Object pojo,
String field,
Object source)
|
Object |
attach(String id,
Object pojo)
Attach a POJO into PojoCache. |
void |
create()
Lifecycle method to start PojoCache. |
void |
destroy()
Lifecycle method to destroy PojoCache. |
Object |
detach(org.jboss.cache.Fqn<?> id)
Remove POJO object from the cache. |
Object |
detach(org.jboss.cache.Fqn<?> id,
String field,
Object source)
|
Object |
detach(String id)
Remove POJO object from the cache. |
boolean |
exists(org.jboss.cache.Fqn<?> id)
Determines if an object is attached at a particular location. |
Object |
find(org.jboss.cache.Fqn<?> id)
Retrieve POJO from the cache system. |
Object |
find(org.jboss.cache.Fqn<?> id,
String field,
Object source)
|
Object |
find(String id)
Retrieve POJO from the cache system. |
Map<org.jboss.cache.Fqn<?>,Object> |
findAll(org.jboss.cache.Fqn<?> id)
Query all managed POJO objects under the id recursively. |
Map<org.jboss.cache.Fqn<?>,Object> |
findAll(String id)
Query all managed POJO objects under the id recursively. |
org.jboss.cache.Cache<Object,Object> |
getCache()
Obtain the underlying generic cache system. |
CachedType |
getCachedType(Class clazz)
Obtain a cache aop type for user to traverse the defined "primitive" types in aop. |
org.jboss.cache.CacheSPI<Object,Object> |
getCacheSPI()
|
org.jboss.cache.Fqn<?> |
getInternalFqn(Object object)
Return the Fqn of the internal node containing the data of this attached object. |
Collection<Object> |
getListeners()
Retrieve a read-only list of listeners. |
Collection<Reference> |
getReferences(Object object)
Return a list of the references from attached objects to this object. |
PojoCacheThreadContext |
getThreadContext()
Get's the thread context for all POJO Cache operations. |
String |
getVersion()
|
void |
removeListener(Object listener)
Remove the specific listener. |
void |
start()
Lifecycle method to start PojoCache. |
void |
stop()
Lifecycle method to stop PojoCache. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final org.apache.commons.logging.Log log_
Constructor Detail |
---|
public PojoCacheImpl(String configStr, boolean toStart)
public PojoCacheImpl(org.jboss.cache.config.Configuration config, boolean toStart)
Method Detail |
---|
public org.jboss.cache.CacheSPI<Object,Object> getCacheSPI()
public Object attach(String id, Object pojo) throws PojoCacheException
PojoCache
Attach a POJO into PojoCache. It will also recursively put any sub-POJO into the cache system. A POJO can be the following and have the consqeuences when attached:
Replicable
annotation (or via XML),
and has
been "instrumented" either compile- or load-time. The POJO will be mapped
recursively to the system and fine-grained replication will be
performed.
attach
in interface PojoCache
id
- An id String to identify the object in the cache. To promote
concurrency, we recommend the use of hierarchical String separating by a
designated separator. Default is "/" but it can be set differently via a
System property, jbosscache.separator in the future release. E.g., "/ben",
or "/student/joe", etc.pojo
- object to be inerted into the cache. If null, it will nullify
the fqn node.
PojoCacheException
- Throws if there is an error related to the cache operation.public Object attach(org.jboss.cache.Fqn<?> id, Object pojo) throws PojoCacheException
PojoCache
Attach a POJO into PojoCache. It will also recursively put any sub-POJO into the cache system. A POJO can be the following and have the consequences when attached:
Replicable
annotation (or via XML),
and has
been "instrumented" either compile- or load-time. The POJO will be mapped
recursively to the system and fine-grained replication will be
performed.
attach
in interface PojoCache
id
- the Fqn that specifies the location in the cache to attach the objectpojo
- object to be inserted into the cache. If null, it will nullify
the fqn node.
PojoCacheException
- Throws if there is an error related to the cache operation.public Object attach(org.jboss.cache.Fqn<?> id, Object pojo, String field, Object source) throws PojoCacheException
PojoCacheException
public Object detach(org.jboss.cache.Fqn<?> id, String field, Object source) throws PojoCacheException
PojoCacheException
public Object detach(String id) throws PojoCacheException
PojoCache
detach
in interface PojoCache
id
- Is string that associates with this node.
PojoCacheException
- Throws if there is an error related to the cache operation.public Object detach(org.jboss.cache.Fqn<?> id) throws PojoCacheException
PojoCache
detach
in interface PojoCache
id
- location of the object to remove
PojoCacheException
- Throws if there is an error related to the cache operation.public org.jboss.cache.Fqn<?> getInternalFqn(Object object)
PojoCache
Fqn
of the internal node containing the data of this attached object.
Note that if the object is not attached to the cache system, this method will simply return
null. Same for any object of an immediate type (primitive wrapper types, String, or Class) or
of any Serializable
types.
getInternalFqn
in interface PojoCache
object
- Any object.
Fqn
of the internal data node. null
if the object is
immediate, serializable, or not in the cache.public Collection<Reference> getReferences(Object object)
PojoCache
Reference
object containing the Fqn
of the referrer object and
the name of the field that contains the reference.
If the node is not attached to the cache, this method will return an empty list. Same for any
object of an immediate type (primitive wrapper types, String, or Class) or of any
Serializable
types.
For external references (i.e. when the object was directly attached to the cache by user code)
the Reference.fieldName
property is null
. Otherwise it is the name
of the field that contains the reference to this object.
getReferences
in interface PojoCache
object
- Any object.
public boolean exists(org.jboss.cache.Fqn<?> id)
PojoCache
exists
in interface PojoCache
id
- the location in the cache to examine
public Object find(String id) throws PojoCacheException
PojoCache
find
in interface PojoCache
id
- that associates with this node.
PojoCacheException
- Throws if there is an error related to the cache operation.public Object find(org.jboss.cache.Fqn<?> id) throws PojoCacheException
PojoCache
find
in interface PojoCache
id
- that associates with this node.
PojoCacheException
- Throws if there is an error related to the cache operation.public Object find(org.jboss.cache.Fqn<?> id, String field, Object source) throws org.jboss.cache.CacheException
org.jboss.cache.CacheException
public Map<org.jboss.cache.Fqn<?>,Object> findAll(String id) throws PojoCacheException
PojoCache
findAll
in interface PojoCache
id
- The starting place to find all POJOs.
PojoCacheException
- Throws if there is an error related to the cache operation.public Map<org.jboss.cache.Fqn<?>,Object> findAll(org.jboss.cache.Fqn<?> id) throws PojoCacheException
PojoCache
findAll
in interface PojoCache
id
- The starting place to find all POJOs.
PojoCacheException
- Throws if there is an error related to the cache operation.public String getVersion()
public void create() throws PojoCacheException
PojoCache
create
in interface PojoCache
PojoCacheException
public void start() throws PojoCacheException
PojoCache
start
in interface PojoCache
PojoCacheException
public void stop() throws PojoCacheException
PojoCache
stop
in interface PojoCache
PojoCacheException
public void destroy() throws PojoCacheException
PojoCache
destroy
in interface PojoCache
PojoCacheException
public Collection<Object> getListeners()
PojoCache
getListeners
in interface PojoCache
public void addListener(Object listener)
PojoCache
Add a PojoCache listener. A given listener instance can only be added once. To have a duplicate listener simply create a new instance.
The listener must be annotated with the PojoCacheListener
annotation, and
all callback methods need to be annotated with the respective event annotations.
Otherwise, an exception will be thrown.
addListener
in interface PojoCache
listener
- the listener instance to registerfor examples
public void addListener(Object listener, Pattern pattern)
PojoCache
Add a PojoCache listener that will only monitor a specific ID(FQN) pattern. A given listener instance can only be added once, whether or not there is a pattern. To have a duplicate listener simply create a new instance.
The listener must be annotated with the PojoCacheListener
annotation, and
all callback methods need to be annotated with the respective event annotations.
Otherwise, an exception will be thrown.
addListener
in interface PojoCache
listener
- the listener instance to registerpattern
- the ID pattern for notifications of interestfor examples
public void removeListener(Object listener)
PojoCache
removeListener
in interface PojoCache
listener
- the listener to removepublic PojoCacheThreadContext getThreadContext()
PojoCache
getThreadContext
in interface PojoCache
public org.jboss.cache.Cache<Object,Object> getCache()
PojoCache
getCache
in interface PojoCache
public CachedType getCachedType(Class clazz)
clazz
- The original pojo class
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |