com.flexive.shared
Class CacheAdmin

java.lang.Object
  extended by com.flexive.shared.CacheAdmin

public class CacheAdmin
extends java.lang.Object

FxCache access

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

Field Summary
static java.lang.String ATTR_ENVIRONMENT
           
static java.lang.String CACHE_SERVICE_NAME
           
static java.lang.String CONTENTCACHE_BASE
           
static java.lang.String ENVIRONMENT_BASE
           
static java.lang.String ENVIRONMENT_RUNTIME
           
static java.lang.String LANGUAGES_ALL
           
static java.lang.String LANGUAGES_ID
           
static java.lang.String LANGUAGES_ISO
           
static java.lang.String ROOT_USERTICKETSTORE
           
static java.lang.String ROOT_WEBDAV_USERTICKETSTORE
           
static java.lang.String STREAMSERVER_BASE
           
static java.lang.String STREAMSERVER_EJB_KEY
           
static java.lang.String TREE_BASE
           
static java.lang.String TREE_MODIFIED_TIMESTAMP
           
 
Constructor Summary
CacheAdmin()
           
 
Method Summary
static void cacheContent(FxCachedContent content)
          Put a content and its security info in the cache
static void environmentChanged()
          Called from external methods when the environment changed.
static void expireCachedContent(long id)
          Expire all cached versions of a content with the requested id
static void expireCachedContents()
          Expire all cached contents
static FxCachedContent getCachedContent(FxPK pk)
          Try to obtain a cached copy of a content identified by its primary key, will return null if not cached
static FxEnvironment getEnvironment()
          Get the FxEnvironment runtime from the cache
static FxEnvironment getFilteredEnvironment()
          Return a FxFilteredEnvironment for the calling user.
static FxCacheMBean getInstance()
          Returns the FxCache instance.
static java.util.List<com.flexive.stream.ServerLocation> getStreamServers()
          Get a list of all available StreamServers
static long getTreeModificationTimestamp()
          Get the timestamp of the last tree modification
static boolean isCacheAllVersions()
          Should all content versions be cached, or only the maximum/live versions?
static boolean isCacheMBeanInstalled()
          Check if the cache MBean is installed in the application server
static boolean isEnvironmentLoaded()
          Has the environment been loaded (yet) - internal helper
static boolean isNewInstallation()
          Is this a new and uninitialized flexive installation? Useful to display splash screens etc.
static boolean isSharedCache()
          Is the cache shared between different deployments in the same VM (-Dflexive.cache.shared=(true|false))?
static boolean isWebProfileDeployment()
          Is this a JavaEE 6 Web Profile deployment? Automatically set when flexive-ejb-interfaces-local is packaged.
static void reloadEnvironment()
          Force reloading of the environment for the current division.
static void setTreeWasModified()
          Flag the tree as modified by setting the current timestamp as modification date
static void uninstallLocalInstance()
          Uninstall the local cache instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROOT_USERTICKETSTORE

public static final java.lang.String ROOT_USERTICKETSTORE
See Also:
Constant Field Values

ROOT_WEBDAV_USERTICKETSTORE

public static final java.lang.String ROOT_WEBDAV_USERTICKETSTORE
See Also:
Constant Field Values

CACHE_SERVICE_NAME

public static final java.lang.String CACHE_SERVICE_NAME
See Also:
Constant Field Values

LANGUAGES_ID

public static final java.lang.String LANGUAGES_ID
See Also:
Constant Field Values

LANGUAGES_ISO

public static final java.lang.String LANGUAGES_ISO
See Also:
Constant Field Values

LANGUAGES_ALL

public static final java.lang.String LANGUAGES_ALL
See Also:
Constant Field Values

ENVIRONMENT_BASE

public static final java.lang.String ENVIRONMENT_BASE
See Also:
Constant Field Values

ENVIRONMENT_RUNTIME

public static final java.lang.String ENVIRONMENT_RUNTIME
See Also:
Constant Field Values

STREAMSERVER_BASE

public static final java.lang.String STREAMSERVER_BASE
See Also:
Constant Field Values

STREAMSERVER_EJB_KEY

public static final java.lang.String STREAMSERVER_EJB_KEY
See Also:
Constant Field Values

CONTENTCACHE_BASE

public static final java.lang.String CONTENTCACHE_BASE
See Also:
Constant Field Values

TREE_BASE

public static final java.lang.String TREE_BASE
See Also:
Constant Field Values

TREE_MODIFIED_TIMESTAMP

public static final java.lang.String TREE_MODIFIED_TIMESTAMP
See Also:
Constant Field Values

ATTR_ENVIRONMENT

public static final java.lang.String ATTR_ENVIRONMENT
See Also:
Constant Field Values
Constructor Detail

CacheAdmin

public CacheAdmin()
Method Detail

getInstance

public static FxCacheMBean getInstance()
Returns the FxCache instance.

Returns:
the cache instance

uninstallLocalInstance

public static void uninstallLocalInstance()
                                   throws java.lang.Exception
Uninstall the local cache instance. This also stops local streaming servers.

Throws:
java.lang.Exception - on errors
Since:
3.1.4

isCacheMBeanInstalled

public static boolean isCacheMBeanInstalled()
Check if the cache MBean is installed in the application server

Returns:
cache MBean installed

isNewInstallation

public static boolean isNewInstallation()
Is this a new and uninitialized flexive installation? Useful to display splash screens etc.

Returns:
if this is a new flexive installation

isEnvironmentLoaded

public static boolean isEnvironmentLoaded()
Has the environment been loaded (yet) - internal helper

Returns:
if the environment has been loaded yet

getEnvironment

public static FxEnvironment getEnvironment()
Get the FxEnvironment runtime from the cache

Returns:
FxEnvironment

getFilteredEnvironment

public static FxEnvironment getFilteredEnvironment()
Return a FxFilteredEnvironment for the calling user.

Returns:
a FxFilteredEnvironment for the calling user.

reloadEnvironment

public static void reloadEnvironment()
                              throws java.lang.Exception
Force reloading of the environment for the current division. May only be called by the supervisor user.

Throws:
java.lang.Exception - on errors

cacheContent

public static void cacheContent(FxCachedContent content)
Put a content and its security info in the cache

Parameters:
content - the content to cache

getCachedContent

public static FxCachedContent getCachedContent(FxPK pk)
Try to obtain a cached copy of a content identified by its primary key, will return null if not cached

Parameters:
pk - requested primary key
Returns:
the cached content or null if not found

expireCachedContent

public static void expireCachedContent(long id)
Expire all cached versions of a content with the requested id

Parameters:
id - requested id

expireCachedContents

public static void expireCachedContents()
Expire all cached contents


environmentChanged

public static void environmentChanged()
Called from external methods when the environment changed.


getStreamServers

public static java.util.List<com.flexive.stream.ServerLocation> getStreamServers()
Get a list of all available StreamServers

Returns:
list of all available StreamServers

setTreeWasModified

public static void setTreeWasModified()
Flag the tree as modified by setting the current timestamp as modification date


getTreeModificationTimestamp

public static long getTreeModificationTimestamp()
Get the timestamp of the last tree modification

Returns:
timestamp of the last tree modification

isSharedCache

public static boolean isSharedCache()
Is the cache shared between different deployments in the same VM (-Dflexive.cache.shared=(true|false))?

This parameter is set automatically when the only local interfaces are deployed (as in a EJB 3.1 Web profile deployment), since you typically want to deploy more than one flexive application.

In EAR deployments, this is set to false by default. This improves performance since no serialization is involved when writing objects to the cache. In WAR deployments, you can disable the shared cache if you deploy only one flexive application in your container.

Since:
3.1.4

isCacheAllVersions

public static boolean isCacheAllVersions()
Should all content versions be cached, or only the maximum/live versions?

Beginning with flexive 3.2.0, only the maximum and live versions of a content are cached by default. This is to avoid memory load issues when the database contains many instances with lots of versions. When loading all versions of an instance (e.g. due to an export operation), they will all end up in the cache but the entry still count as only one content (since all versions are stored in a single cache node).

Returns:
whether all content versions should be cached
Since:
3.2.0

isWebProfileDeployment

public static boolean isWebProfileDeployment()
Is this a JavaEE 6 Web Profile deployment? Automatically set when flexive-ejb-interfaces-local is packaged.

Since:
3.1.4