com.flexive.shared.mbeans
Class FxCacheProxy

java.lang.Object
  extended by com.flexive.shared.mbeans.FxCacheProxy
All Implemented Interfaces:
FxBackingCache, FxCacheMBean

public class FxCacheProxy
extends java.lang.Object
implements FxCacheMBean

Proxy for the FxCache MBean (only for internal used!) TODO: code error handling

Author:
Markus Plesser (markus.plesser@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)

Field Summary
 
Fields inherited from interface com.flexive.shared.mbeans.FxCacheMBean
STREAMING_PORT
 
Fields inherited from interface com.flexive.shared.cache.FxBackingCache
SYSTEM_UP_KEY
 
Constructor Summary
FxCacheProxy(javax.management.MBeanServer server)
           
 
Method Summary
 void create()
          Creates and starts up the cache
 void destroy()
          Shutdown
 boolean exists(java.lang.String path, java.lang.Object key)
          Checks if the given key exists under the given path.
 java.lang.Object get(java.lang.String path, java.lang.Object key)
          Reads a entry from the division cache that the current request is in.
 org.jboss.cache.Cache<java.lang.Object,java.lang.Object> getCache()
          Get the wrapped cache
 java.util.Set getChildrenNames(java.lang.String path)
          Get all child nodes for a path
 java.lang.String getDeploymentId()
          Return the Id of this deployment of flexive (used to check existance of running mbean server on redeployment)
 java.util.Set getKeys(java.lang.String path)
          Get all keys for a path
 javax.management.ObjectName getName()
           
 long getNodeStartTime()
          Returns the time this node was started up.
 long getSystemStartTime()
          Returns the time the system was started up.
 boolean globalExists(java.lang.String path, java.lang.Object key)
          A global exists
 java.lang.Object globalGet(java.lang.String path, java.lang.Object key)
          A global get
 java.util.Set globalGetKeys(java.lang.String path)
          A global getKeys
 void globalPut(java.lang.String path, java.lang.Object key, java.lang.Object value)
          A global put
 void globalRemove(java.lang.String path)
          A global remove
 void globalRemove(java.lang.String path, java.lang.Object key)
          A global remove
 void put(java.lang.String path, java.lang.Object key, java.lang.Object value)
          Puts a entry into the cache of the division the current request is in.
 void reloadEnvironment(java.lang.Integer divisionId)
          Force a reload for given division
 void remove(java.lang.String path)
          Removes from the cache of the division the current request is in.
 void remove(java.lang.String path, java.lang.Object key)
          Removes a entry from the cache of the division the current request is in.
 void setEvictionStrategy(java.lang.Integer divisionId, java.lang.String path, java.lang.Integer maxContents, java.lang.Integer timeToIdle, java.lang.Integer timeToLive)
          Set the eviction strategy for a path (if the backing cache supports this)
 void setEvictionStrategy(java.lang.Integer divisionId, java.lang.String path, java.lang.Integer maxContents, java.lang.Integer timeToIdle, java.lang.Integer timeToLive, java.lang.Boolean overwrite)
          Set the eviction strategy for a path (if the backing cache supports this)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FxCacheProxy

public FxCacheProxy(javax.management.MBeanServer server)
             throws javax.management.MalformedObjectNameException
Throws:
javax.management.MalformedObjectNameException
Method Detail

getName

public javax.management.ObjectName getName()

create

public void create()
            throws java.lang.Exception
Creates and starts up the cache

Specified by:
create in interface FxCacheMBean
Throws:
java.lang.Exception - on errors

destroy

public void destroy()
             throws java.lang.Exception
Shutdown

Specified by:
destroy in interface FxCacheMBean
Throws:
java.lang.Exception - on errors

getCache

public org.jboss.cache.Cache<java.lang.Object,java.lang.Object> getCache()
                                                                  throws FxCacheException
Get the wrapped cache

Specified by:
getCache in interface FxBackingCache
Returns:
TreeCache
Throws:
FxCacheException - on errors

get

public java.lang.Object get(java.lang.String path,
                            java.lang.Object key)
                     throws FxCacheException
Reads a entry from the division cache that the current request is in.

Specified by:
get in interface FxBackingCache
Parameters:
path - path
key - key
Returns:
entry
Throws:
FxCacheException - on errors

put

public void put(java.lang.String path,
                java.lang.Object key,
                java.lang.Object value)
         throws FxCacheException
Puts a entry into the cache of the division the current request is in.

Specified by:
put in interface FxBackingCache
Parameters:
path - path
key - key
value - value
Throws:
FxCacheException - on errors

remove

public void remove(java.lang.String path)
            throws FxCacheException
Removes from the cache of the division the current request is in.

Specified by:
remove in interface FxBackingCache
Parameters:
path - path
Throws:
FxCacheException - on errors

remove

public void remove(java.lang.String path,
                   java.lang.Object key)
            throws FxCacheException
Removes a entry from the cache of the division the current request is in.

Specified by:
remove in interface FxBackingCache
Parameters:
path - path
key - key
Throws:
FxCacheException - on errors

getKeys

public java.util.Set getKeys(java.lang.String path)
                      throws FxCacheException
Get all keys for a path

Specified by:
getKeys in interface FxBackingCache
Parameters:
path - path
Returns:
set of keys
Throws:
FxCacheException - on errors

globalGetKeys

public java.util.Set globalGetKeys(java.lang.String path)
                            throws FxCacheException
A global getKeys

Specified by:
globalGetKeys in interface FxCacheMBean
Parameters:
path - path
Returns:
key set
Throws:
FxCacheException - on errors
See Also:
FxBackingCache.getKeys(String)

globalGet

public java.lang.Object globalGet(java.lang.String path,
                                  java.lang.Object key)
                           throws FxCacheException
A global get

Specified by:
globalGet in interface FxCacheMBean
Parameters:
path - path
key - key
Returns:
value
Throws:
FxCacheException - on errors
See Also:
FxBackingCache.get(String,Object)

globalExists

public boolean globalExists(java.lang.String path,
                            java.lang.Object key)
                     throws FxCacheException
A global exists

Specified by:
globalExists in interface FxCacheMBean
Parameters:
path - path
key - key
Returns:
exists
Throws:
FxCacheException - on errors
See Also:
FxBackingCache.exists(String,Object)

exists

public boolean exists(java.lang.String path,
                      java.lang.Object key)
               throws FxCacheException
Checks if the given key exists under the given path.

Specified by:
exists in interface FxBackingCache
Parameters:
path - path
key - key
Returns:
entry
Throws:
FxCacheException - on errors

globalPut

public void globalPut(java.lang.String path,
                      java.lang.Object key,
                      java.lang.Object value)
               throws FxCacheException
A global put

Specified by:
globalPut in interface FxCacheMBean
Parameters:
path - path
key - key
value - value
Throws:
FxCacheException - on errors
See Also:
FxBackingCache.put(String,Object,Object)

globalRemove

public void globalRemove(java.lang.String path)
                  throws FxCacheException
A global remove

Specified by:
globalRemove in interface FxCacheMBean
Parameters:
path - path
Throws:
FxCacheException - on errors
See Also:
FxBackingCache.remove(String)

globalRemove

public void globalRemove(java.lang.String path,
                         java.lang.Object key)
                  throws FxCacheException
A global remove

Specified by:
globalRemove in interface FxCacheMBean
Parameters:
path - path
key - key
Throws:
FxCacheException - on errors
See Also:
FxBackingCache.remove(String,Object)

getChildrenNames

public java.util.Set getChildrenNames(java.lang.String path)
                               throws FxCacheException
Get all child nodes for a path

Specified by:
getChildrenNames in interface FxBackingCache
Parameters:
path - path
Returns:
set of child names
Throws:
FxCacheException - on errors

getDeploymentId

public java.lang.String getDeploymentId()
Return the Id of this deployment of flexive (used to check existance of running mbean server on redeployment)

Specified by:
getDeploymentId in interface FxCacheMBean
Returns:
deployment id

getSystemStartTime

public long getSystemStartTime()
Returns the time the system was started up.

Specified by:
getSystemStartTime in interface FxCacheMBean
Returns:
the time the system was started up.

getNodeStartTime

public long getNodeStartTime()
Returns the time this node was started up.

Specified by:
getNodeStartTime in interface FxCacheMBean
Returns:
the time this node was started

reloadEnvironment

public void reloadEnvironment(java.lang.Integer divisionId)
                       throws java.lang.Exception
Force a reload for given division

Specified by:
reloadEnvironment in interface FxCacheMBean
Parameters:
divisionId - division
Throws:
java.lang.Exception - on errors

setEvictionStrategy

public void setEvictionStrategy(java.lang.Integer divisionId,
                                java.lang.String path,
                                java.lang.Integer maxContents,
                                java.lang.Integer timeToIdle,
                                java.lang.Integer timeToLive)
Set the eviction strategy for a path (if the backing cache supports this)

Specified by:
setEvictionStrategy in interface FxCacheMBean
Parameters:
divisionId - division
path - path
maxContents - max. number of entries to allow (0=unlimited)
timeToIdle - time a value has to be idle to be evicted (0=forever)
timeToLive - time to live (0=forever)

setEvictionStrategy

public void setEvictionStrategy(java.lang.Integer divisionId,
                                java.lang.String path,
                                java.lang.Integer maxContents,
                                java.lang.Integer timeToIdle,
                                java.lang.Integer timeToLive,
                                java.lang.Boolean overwrite)
                         throws FxCacheException
Set the eviction strategy for a path (if the backing cache supports this)

Specified by:
setEvictionStrategy in interface FxCacheMBean
Parameters:
divisionId - division
path - path
maxContents - max. number of entries to allow (0=unlimited)
timeToIdle - time a value has to be idle to be evicted (0=forever)
timeToLive - time to live (0=forever)
overwrite - if an existing policy should be overwritten
Throws:
FxCacheException - on cache errors