|
Version: 1.1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.biomoby.client.CentralImpl org.biomoby.client.CentralDigestImpl org.biomoby.client.CentralDigestCachedSimpleImpl
public class CentralDigestCachedSimpleImpl
An implementation of CentralAll
,
allowing to cache locally results of the cumulative methods so it
does not need to access Moby registry all the time. The other
methods of the Central interface do not use the results of the
cached cumulative results (their implementation is just passed to
the parent class).
The caching is done in the file system, not in memory, so the
results are permanent (until someone removes the caching
directory, or calls removeFromCache(java.lang.String)
).
This class can be used also without caching - just instantiate it with 'cacheDir' set to null in the constructor.
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 |
Constructor Summary | |
---|---|
CentralDigestCachedSimpleImpl(String cacheDir)
Create an instance that will access a default Moby registry and will cache results in the 'cacheDir' directory. |
|
CentralDigestCachedSimpleImpl(String endpoint,
String namespace,
String cacheDir)
Create an instance that will access a Moby registry defined by its 'endpoint' and 'namespace', and will cache results in the 'cacheDir' directory. |
Method Summary | |
---|---|
long |
getCacheAge()
Return age of the current (whole) cache in millis from the beginning of the Epoch; or -1 if cache is empty, or the age is unknown. |
String |
getCacheDir()
Return a directory name representing the current cache. |
Properties |
getCacheInfo(String id)
Return as many properties describing the given part of a cache as possible. |
String |
getCacheInfoFormatted(String id)
Similar as CentralCached.getCacheInfo(java.lang.String) but formatted into a single
string. |
boolean |
getCacheMode()
It always (again, if it functions as a cache which is when 'cacheDir' is given) reports that caching is disabled (even though for the cumulative results is actually always enabled - but that is obvious from the name of this class, isn't it?). |
Map |
getDataTypeNames()
Parses and imports the following XML. |
MobyDataType[] |
getDataTypes()
Get definition of all known data types. |
MobyNamespace[] |
getFullNamespaces()
Parses and imports the following XML. |
Map |
getServiceNamesByAuthority()
Parses and imports the following XML. |
MobyService[] |
getServices()
Get definition of all registered service instances. |
boolean |
isUsingCache()
Indicate whether the implementtaion really is using a local cache. |
void |
removeFromCache(String id)
Removes object groups from the cache. |
void |
setCacheMode(boolean shouldCache)
It always (if it functions as a cache which is when 'cacheDir' was given) disables caching in the parent (so no memory caching happens there). |
void |
updateCache(String id)
Update the indicated part of the cache. |
Methods inherited from class org.biomoby.client.CentralDigestImpl |
---|
addNotificationListener, addNotificationListeners, callback, fireEvent, fireEvent, getFullServiceTypes, getNotificationListeners, removeNotificationListener, removeNotificationListeners |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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 |
---|
public CentralDigestCachedSimpleImpl(String cacheDir) throws MobyException
MobyException
public CentralDigestCachedSimpleImpl(String endpoint, String namespace, String cacheDir) throws MobyException
MobyException
Method Detail |
---|
public String getCacheDir()
public boolean isUsingCache()
isUsingCache
in interface CentralCached
public void removeFromCache(String id)
removeFromCache
in interface SimpleCache
removeFromCache
in interface CentralCached
removeFromCache
in class CentralImpl
id
- should be either null, or one of the following:
CentralCached.CACHE_PART_DATATYPES
, CentralCached.CACHE_PART_SERVICES
,
CentralCached.CACHE_PART_SERVICETYPES
, and CentralCached.CACHE_PART_NAMESPACES
.public void updateCache(String id) throws MobyException
Updates means to fetch a new list of entities, compare it with existing entities in the cache, fetch the missing ones and remove the redundant ones.
updateCache
in interface CentralCached
id
- should be either null, or one of the following:
CentralCached.CACHE_PART_DATATYPES
, CentralCached.CACHE_PART_SERVICES
,
CentralCached.CACHE_PART_SERVICETYPES
, and CentralCached.CACHE_PART_NAMESPACES
.
MobyException
public Map getDataTypeNames() throws MobyException
CentralImpl
<objectNames> <Object name="objectName" lsid="..."> <Description><![CDATA[free text description here]]></Description> </Object> ... ... </objectNames>
getDataTypeNames
in interface Central
getDataTypeNames
in class CentralImpl
MobyException
- if communication with the Moby Registry failspublic MobyDataType[] getDataTypes() throws MobyException
CentralDigest
Central.getDataType(java.lang.String)
for all
registered data type names.
getDataTypes
in interface Central
getDataTypes
in interface CentralDigest
getDataTypes
in class CentralDigestImpl
MobyException
- if communication with the Moby Registry failspublic Map getServiceNamesByAuthority() throws MobyException
CentralImpl
<serviceNames> <serviceName name="serviceName" lsid="..." authURI='authority.info.here'/> ... ... </serviceNames>
getServiceNamesByAuthority
in interface Central
getServiceNamesByAuthority
in class CentralImpl
MobyException
- if communication with the Moby Registry failspublic MobyService[] getServices() throws MobyException
CentralDigest
findService by name
for all
known service names.
getServices
in interface CentralDigest
getServices
in class CentralDigestImpl
MobyException
- if communication with the Moby Registry failspublic MobyNamespace[] getFullNamespaces() throws MobyException
CentralImpl
<Namespaces> <Namespace name="namespace" lsid="..."> <Description><![CDATA[free text description here]]></Description> <contactEmail>...</contactEmail> <authURI>...</authURI> </Namespace> ... ... </Namespaces>
getFullNamespaces
in interface Central
getFullNamespaces
in class CentralDigestImpl
MobyException
- if communication with the Moby Registry failspublic void setCacheMode(boolean shouldCache)
setCacheMode
in interface Central
setCacheMode
in class CentralDigestImpl
shouldCache
- whether retrieveXXX call results should be
cached in case they are called again (i.e. don't request
MobyCentral every time)public boolean getCacheMode()
getCacheMode
in interface Central
getCacheMode
in class CentralImpl
public long getCacheAge()
getCacheAge
in interface CentralCached
public Properties getCacheInfo(String id)
getCacheInfo
in interface CentralCached
id
- is a part of cache to be described, or null if the
whole cache should be described (this may return different kind
of properties than for individual cache parts)
public String getCacheInfoFormatted(String id)
CentralCached
CentralCached.getCacheInfo(java.lang.String)
but formatted into a single
string.
getCacheInfoFormatted
in interface CentralCached
id
- is a part of cache to be described, or null if the whole
cache should be described (this may return different kind
of properties than for individual cache parts)
|
Version: 1.1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |