Platform SDK Java 8.5 API Reference

com.genesyslab.platform.applicationblocks.com.cache
Interface IConfCache

All Superinterfaces:
Action<ConfEvent>, Subscriber<ConfEvent>
All Known Implementing Classes:
DefaultConfCache

public interface IConfCache
extends Subscriber<ConfEvent>

Interface for the configuration object cache.


Method Summary
 void add(ICfgObject obj)
          Adds a new configuration object to the cache.
 java.util.concurrent.Future<IConfCache> beginRefresh(AsyncInvoker asyncInvoker, Action<java.util.concurrent.Future<IConfCache>> finishCallback)
          Asynchronously updates all configuration objects in the cache.
 void clear()
          Removes all cache contents.
 boolean contains(ICfgObject obj)
          Determines whether the cache contains the specified object.
 void deserialize(javax.xml.transform.Source source)
          Deserializes the cache from the specified source.
 void endRefresh(java.util.concurrent.Future<IConfCache> asyncResult)
          To be called when the asynchronous refresh operation is complete.
 IConfCachePolicy getPolicy()
          Returns the current policy associated with this cache.
 void refresh()
          Synchronously updates all configuration objects which are currently in the cache.
 void remove(CfgObjectType type, int dbid)
          Removes the configuration object with the specified type and dbid from the cache.
 void remove(ICfgObject obj)
          Removes the specified configuration object from the cache.
<T extends ICfgObject>
T
retrieve(java.lang.Class<T> cls, CfgObjectType type, int dbid)
          Retrieves a configuration object from the cache.
<T extends ICfgObject>
T
retrieve(java.lang.Class<T> cls, ICfgQuery query)
          Retrieves a configuration object from the cache.
<T extends ICfgObject>
java.lang.Iterable<T>
retrieveMultiple(java.lang.Class<T> cls)
          Retrieves an enumerable list of objects from the cache.
<T extends ICfgObject>
java.lang.Iterable<T>
retrieveMultiple(java.lang.Class<T> cls, ICfgQuery query)
          Retrieves an enumerable list of objects from the cache.
 void serialize(javax.xml.transform.Result result)
          Serializes the cache to the specified result.
 void update(ICfgObject obj)
          Overwrites a configuration object which already exists in the cache with a new copy.
 
Methods inherited from interface com.genesyslab.platform.applicationblocks.commons.broker.Subscriber
getFilter
 
Methods inherited from interface com.genesyslab.platform.applicationblocks.commons.Action
handle
 

Method Detail

add

void add(ICfgObject obj)
Adds a new configuration object to the cache.

Parameters:
obj - A configuration object

update

void update(ICfgObject obj)
Overwrites a configuration object which already exists in the cache with a new copy.

Parameters:
obj - A configuration object

remove

void remove(ICfgObject obj)
Removes the specified configuration object from the cache.

Parameters:
obj - A configuration object

remove

void remove(CfgObjectType type,
            int dbid)
Removes the configuration object with the specified type and dbid from the cache.

Parameters:
type - The type of configuration object
dbid - The dbid of the configuration object

clear

void clear()
Removes all cache contents.


retrieve

<T extends ICfgObject> T retrieve(java.lang.Class<T> cls,
                                  CfgObjectType type,
                                  int dbid)
Retrieves a configuration object from the cache.

Type Parameters:
T - The type of configuration object that should be returned
Parameters:
cls - class of object to be retrieved
type - The type of configuration object
dbid - The dbid of the configuration object
Returns:
A configuration object of the requested type

retrieve

<T extends ICfgObject> T retrieve(java.lang.Class<T> cls,
                                  ICfgQuery query)
Retrieves a configuration object from the cache.

Type Parameters:
T - The type of configuration object that should be returned
Parameters:
cls - class of object to be retrieved
query - A query based on which the result is obtained
Returns:
A configuration object matching the specified query

retrieveMultiple

<T extends ICfgObject> java.lang.Iterable<T> retrieveMultiple(java.lang.Class<T> cls,
                                                              ICfgQuery query)
Retrieves an enumerable list of objects from the cache.

Type Parameters:
T - The types of configuration objects to be included in the list.
Parameters:
cls - class of objects to be retrieved
query - A query based on which the result is obtained
Returns:
An enumerable list of configuration objects matching the specified query

retrieveMultiple

<T extends ICfgObject> java.lang.Iterable<T> retrieveMultiple(java.lang.Class<T> cls)
Retrieves an enumerable list of objects from the cache.

Type Parameters:
T - The types of configuration objects to be included in the list.
Parameters:
cls - class of objects to be retrieved
Returns:
An enumerable list of configuration objects matching the specified query

contains

boolean contains(ICfgObject obj)
Determines whether the cache contains the specified object.

Parameters:
obj - The configuration object to look for
Returns:
true if the object is in the cache, false otherwise

serialize

void serialize(javax.xml.transform.Result result)
Serializes the cache to the specified result.

Parameters:
result - The result into which the cache is to be written
See Also:
StreamResult, DOMResult

deserialize

void deserialize(javax.xml.transform.Source source)
Deserializes the cache from the specified source.

Parameters:
source - The source from which the cache is to be read
See Also:
StreamSource, DOMSource

refresh

void refresh()
             throws ConfigException,
                    java.lang.InterruptedException
Synchronously updates all configuration objects which are currently in the cache.

Throws:
ConfigException - is thrown in case of object(s) reload exception
java.lang.InterruptedException - is thrown in case of working thread interrupted

beginRefresh

java.util.concurrent.Future<IConfCache> beginRefresh(AsyncInvoker asyncInvoker,
                                                     Action<java.util.concurrent.Future<IConfCache>> finishCallback)
Asynchronously updates all configuration objects in the cache. Refresh operation will be executed in provided sync invoker as single task, so, invoker will be busy for all this time. Usage sample:
   AsyncInvoker invoker =
           new SingleThreadInvoker("CacheAsyncRefresh");
   Future asyncRefresh =
           cache.beginRefresh(invoker, null);
   // DO SOMETHING...
   // To check that refresh is done: 
   if (asyncRefresh.isDone()) {
       // ...
   }
   // To wait for refresh is done:
   asyncRefresh.get();
   // After refresh is done and invoker is not needed:
   invoker.dispose();
 

Parameters:
asyncInvoker - invoker for refresh task execution
finishCallback - The callback method to be invoked when the operation completes
Returns:
The async result associated with this operation

endRefresh

void endRefresh(java.util.concurrent.Future<IConfCache> asyncResult)
To be called when the asynchronous refresh operation is complete. If called before the refresh operation completes, this method will block until completion.

Parameters:
asyncResult - The async result associated with the current operation

getPolicy

IConfCachePolicy getPolicy()
Returns the current policy associated with this cache.

Returns:
current policy associated with this cache

Platform SDK Java 8.5 API Reference

Send comments on this topicTechpubs.webadmin@genesys.com.
Document version: 8.5.302.00
Copyright © 2006–2017 Genesys Telecommunications Laboratories, Inc. All rights reserved.