Version: 1.1.1

org.biomoby.client
Class CentralCachedCallsImpl

java.lang.Object
  extended by org.biomoby.client.CentralImpl
      extended by org.biomoby.client.CentralDigestImpl
          extended by org.biomoby.client.CentralDigestCachedSimpleImpl
              extended by org.biomoby.client.CentralDigestCachedImpl
                  extended by org.biomoby.client.CentralCachedCallsImpl
All Implemented Interfaces:
SimpleCache, Central, CentralAll, CentralCached, CentralDigest, Notifier

public class CentralCachedCallsImpl
extends CentralDigestCachedImpl

Implements the functionality of caching by reusing identical calls to MOBY central (e.g. asking multiple times what services take a DNA sequence in the gi namespace). This is an in-memory cache in CentralImpl, but a filesystem cache backs it up here, so calls can be cached between JVM instances. This class is also thread-safe, and avoids redundant concurrent calls to the central registry.


Field Summary
 
Fields inherited from class org.biomoby.client.CentralImpl
CENTRAL_IMPL_RESOURCE_NAME, DEFAULT_CENTRAL_IMPL_CLASSNAME, DEFAULT_ENDPOINT, DEFAULT_NAMESPACE, DOCUMENT_BUILDER_FACTORIES
 
Fields inherited from interface org.biomoby.shared.CentralCached
CACHE_PART_DATATYPES, CACHE_PART_NAMESPACES, CACHE_PART_SERVICES, CACHE_PART_SERVICETYPES, CACHE_PROP_COUNT, CACHE_PROP_LOCATION, CACHE_PROP_NAME, CACHE_PROP_OLDEST, CACHE_PROP_REGISTRY_URL, CACHE_PROP_SIZE, CACHE_PROP_YOUNGEST, LIST_FILE, RDF_FILE
 
Fields inherited from interface org.biomoby.shared.Central
DATA_TYPES_RESOURCE_NAME, FULL_RESOURCE_NAME, HAS, HASA, iHAS, iHASA, iISA, ISA, NAMESPACES_RESOURCE_NAME, SERVICE_INSTANCES_RESOURCE_NAME, SERVICE_TYPES_RESOURCE_NAME
 
Fields inherited from interface org.biomoby.shared.event.Notifier
AUTHORITIES_CANCELLED, AUTHORITIES_COUNT, AUTHORITIES_END, AUTHORITIES_RESET, AUTHORITIES_START, AUTHORITIES_UPDATED, AUTHORITY_LOADED, AUTHORITY_LOADING, DATA_TYPE_LOADED, DATA_TYPE_LOADING, DATA_TYPES_CANCELLED, DATA_TYPES_COUNT, DATA_TYPES_END, DATA_TYPES_RESET, DATA_TYPES_START, DATA_TYPES_UPDATED, NAMESPACE_LOADED, NAMESPACE_LOADING, NAMESPACES_CANCELLED, NAMESPACES_COUNT, NAMESPACES_END, NAMESPACES_RESET, NAMESPACES_START, NAMESPACES_UPDATED, SERVICE_TYPE_LOADED, SERVICE_TYPE_LOADING, SERVICE_TYPES_CANCELLED, SERVICE_TYPES_COUNT, SERVICE_TYPES_END, SERVICE_TYPES_RESET, SERVICE_TYPES_START, SERVICE_TYPES_UPDATED, SIGNAL_CANCEL_DATA_TYPES, SIGNAL_CANCEL_NAMESPACES, SIGNAL_CANCEL_SERVICE_TYPES, SIGNAL_CANCEL_SERVICES
 
Constructor Summary
CentralCachedCallsImpl()
          Default constructor.
CentralCachedCallsImpl(String endpoint)
          Constructor allowing to specify which Moby Registry to use.
CentralCachedCallsImpl(String endpoint, String namespace)
          Constructor allowing to specify which Moby Registry and what namespace to use.
 
Method Summary
 String createId(String rootName, String semanticType, String syntaxType, long lastModified, Properties props)
          Creates an ID of the parameters simply by concatenating them.
 boolean existsInCache(String id)
          Is the object identified by its 'id' already cached?
 void setContents(String id, Object data)
          Store/cache 'data' identified by 'id'.
 
Methods inherited from class org.biomoby.client.CentralDigestCachedImpl
getDataTypeNames, getDataTypes, getFullNamespaces, getServiceNamesByAuthority, getServices
 
Methods inherited from class org.biomoby.client.CentralDigestCachedSimpleImpl
getCacheAge, getCacheDir, getCacheInfo, getCacheInfoFormatted, getCacheMode, isUsingCache, removeFromCache, setCacheMode, updateCache
 
Methods inherited from class org.biomoby.client.CentralDigestImpl
addNotificationListener, addNotificationListeners, callback, fireEvent, fireEvent, getFullServiceTypes, getNotificationListeners, removeNotificationListener, removeNotificationListeners
 
Methods inherited from class org.biomoby.client.CentralImpl
call, escapeXML, extractServices, findService, findService, findService, findService, findService, formatFault, formatFault, getContents, getDataType, getDataTypeRelationships, getDataTypeRelationships, getDefaultCentral, getDefaultCentral, getDefaultURI, getDefaultURL, getNamespaces, getProviders, getRegisterDataTypeXML, getRegisterNamespaceXML, getRegisterServiceTypeXML, getRegisterServiceXML, getRegistryEndpoint, getRegistryNamespace, getResource, getResourceRefs, getServiceNames, getServicesByAuthority, getServiceTypeRelationships, getServiceTypes, getServiceWSDL, getServiceWSDL, loadDocument, registerDataType, registerNamespace, registerService, registerServiceType, setDebug, unregisterDataType, unregisterNamespace, unregisterService, unregisterServiceType
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.biomoby.shared.Central
call, findService, findService, findService, findService, findService, getDataType, getDataTypeRelationships, getDataTypeRelationships, getNamespaces, getProviders, getRegistryEndpoint, getRegistryNamespace, getResource, getResourceRefs, getServiceNames, getServiceTypeRelationships, getServiceTypes, getServiceWSDL, getServiceWSDL, registerDataType, registerNamespace, registerService, registerServiceType, setDebug, unregisterDataType, unregisterNamespace, unregisterService, unregisterServiceType
 
Methods inherited from interface org.biomoby.shared.CentralDigest
getFullServiceTypes
 
Methods inherited from interface org.biomoby.shared.event.Notifier
addNotificationListener, addNotificationListeners, callback, fireEvent, fireEvent, getNotificationListeners, removeNotificationListener, removeNotificationListeners
 

Constructor Detail

CentralCachedCallsImpl

public CentralCachedCallsImpl()
                       throws MobyException
Default constructor. It connects to a default Moby registry (as defined in CentralImpl.DEFAULT_ENDPOINT) using a default namespace (as defined int CentralImpl.DEFAULT_NAMESPACE).

Throws:
MobyException

CentralCachedCallsImpl

public CentralCachedCallsImpl(String endpoint)
                       throws MobyException
Constructor allowing to specify which Moby Registry to use.

Throws:
MobyException - if 'endpoint' is not a valid URL, or if no DOM parser is available

CentralCachedCallsImpl

public CentralCachedCallsImpl(String endpoint,
                              String namespace)
                       throws MobyException
Constructor allowing to specify which Moby Registry and what namespace to use. If any of the parameters is null, its default value is used instead.

Throws:
MobyException - if 'endpoint' is not a valid URL, or if no DOM parser was found
Method Detail

existsInCache

public boolean existsInCache(String id)
Description copied from interface: SimpleCache
Is the object identified by its 'id' already cached?

Specified by:
existsInCache in interface SimpleCache
Overrides:
existsInCache in class CentralImpl
Parameters:
id - a unique ID of the cached (or possibly cached) object
Returns:
true if the object identified by 'id' already exists in this cache

setContents

public void setContents(String id,
                        Object data)
Description copied from interface: SimpleCache
Store/cache 'data' identified by 'id'.

Specified by:
setContents in interface SimpleCache
Overrides:
setContents in class CentralImpl
Parameters:
id - a unique ID of the object being stored
data - are being stored

createId

public String createId(String rootName,
                       String semanticType,
                       String syntaxType,
                       long lastModified,
                       Properties props)
Creates an ID of the parameters simply by concatenating them.

Specified by:
createId in interface SimpleCache
Overrides:
createId in class CentralImpl
Parameters:
rootName - is some high level name of the cached object
semanticType - is yet another feature of the cached object
syntaxType - is another property of the cached object (e.i. it may be used as the file name suffix if the cache is implemented as a filesystem)
lastModified - is time in millis indicating when the cached object was created or modified
props - are all remaining properties identifying the cached object
Returns:
a unique ID that can be used in other methods defined in this interface in order to identify the same cached object

Version: 1.1.1

Submit a bug or feature
Generated: Sat May 29 04:26:35 EDT 2010