Platform SDK Java 8.5 API Reference

com.genesyslab.platform.applicationblocks.com
Class ConfService

java.lang.Object
  extended by com.genesyslab.platform.applicationblocks.com.ConfService
All Implemented Interfaces:
IConfService, SubscriptionService<ConfEvent>, AsyncInvokerSupport

public class ConfService
extends java.lang.Object
implements IConfService, AsyncInvokerSupport

This class holds a reference to the connection to Configuration Server (ConfServerProtocol). Please, use this class to create new instances of configuration objects, subscribe to events, register on notifications.

Author:
Petr Makagon, Vladislav Baranovsky, Alexander Filatov, Anton Brazhnyk, Sergii Volokh
See Also:
ConfServiceFactory

Constructor Summary
protected ConfService(Protocol protocol)
          Creates a new instance of the class.
 
Method Summary
protected  boolean addObjectOnRetrieve(ICfgObject object)
           
<T extends ICfgObject>
AsyncRequestResult<T>
beginRetrieveMultipleObjects(java.lang.Class<T> cls, ICfgQuery query, Action<AsyncRequestResult<T>> finishCallback)
          Starts reading of configuration objects collection from server.
<T extends ICfgObject>
AsyncRequestResult<T>
beginRetrieveMultipleObjects(java.lang.Class<T> cls, ICfgQuery query, Action<java.util.Collection<T>> dataCallback, Action<AsyncRequestResult<T>> finishCallback)
          Starts reading of configuration objects collection from server.
<T extends ICfgObject>
AsyncRequestResult<T>
beginRetrieveMultipleObjects(java.lang.Class<T> cls, ICfgQuery query, Action<java.util.Collection<T>> dataCallback, Action<AsyncRequestResult<T>> finishCallback, long timeout)
          Starts reading of configuration objects collection from server.
<T extends ICfgObject>
java.util.Collection<T>
createMultipleObjects(ConfDataCollection<? extends ConfObjectBase> confObjects, java.lang.String[] objectsPaths, int[] foldersDbids)
          Wraps a single configuration structure with COM configuration object using the passed parameters.
 java.util.Collection<ICfgObject> createMultipleObjects(ConfObjectsCollection confObjects)
          Creates collection of COM configuration objects using the passed parameters.
 java.util.Collection<ICfgObject> createMultipleObjectsFromXML(org.w3c.dom.Node confObjectsContainer)
          Creates a list of configuration objects based on XML received from Configuration Server.
Usage sample:
 java.util.Collection<ICfgObject> createMultipleObjectsFromXML(org.w3c.dom.NodeList confObjects)
          Creates a list of configuration objects based on XML received from Configuration Server.
<T extends ICfgObject>
java.util.Collection<T>
createMultipleObjectsFromXML(org.w3c.dom.NodeList confObjects, java.lang.String[] objectsPaths, int[] foldersDbids)
          Creates a list of COM configuration objects using the passed parameters.
<T extends ICfgObject>
java.util.Collection<T>
createMultipleObjectsFromXML(org.w3c.dom.Node confObjectsContainer, java.lang.String[] objectsPaths, int[] foldersDbids)
          Creates a list of COM configuration objects using the passed parameters.
 ICfgObject createObject(ConfObjectBase confObject, boolean isSaved)
          Wraps a single configuration structure with COM configuration object using the passed parameters.
 ICfgObject createObject(ConfObjectBase confObject, java.lang.String objectPath, int folderDbid, boolean isSaved)
          Wraps a single configuration structure with COM configuration object using the passed parameters.
 ICfgObject createObjectFromXML(org.w3c.dom.Node confObject, boolean isSaved)
          Creates a single COM configuration object using the passed parameters.
 ICfgObject createObjectFromXML(org.w3c.dom.Node confObject, java.lang.String objectPath, int folderDbid, boolean isSaved)
          Creates a single COM configuration object using the passed parameters.
 void deleteObject(ICfgObject cfgObject)
          Deletes configuration object from the Configuration Server.
<T extends ICfgObject>
java.util.Collection<T>
endRetrieveMultipleObjects(AsyncRequestResult<T> rqResult)
          Waits until asynchronous reading operation done and return requested data.
protected  void exceptionIfDisposed()
          Ensures that this ConfService instance is not disposed.
 IConfCache getCache()
          Returns an instance of the configuration cache or null if caching is not enabled.
protected  AsyncInvoker getInvokerNotNull()
           
protected  ILogger getLogger()
           
 CfgMetadata getMetaData()
          Returns reference to the configuration Metadata.
 IConfServicePolicy getPolicy()
          Returns the policy associated with this service.
 Protocol getProtocol()
          Returns a reference to the protocol connection to Configuration Server.
 boolean isDisposed()
           
protected  KeyValueCollection prepareReadObjectsFilter(ICfgFilterBasedQuery query)
           
protected  Message prepareRequestReadBriefInfoMessage(ICfgQuery query)
           
protected  Message prepareRequestReadObjectsMessage(ICfgQuery query)
          Create Configuration Protocol Request Message for configuration objects reading.
 void refreshObject(ICfgObject cfgObject)
          Reloads configuration object data from the Configuration Server.
 void register(Action<ConfEvent> handler, Predicate<ConfEvent> filter)
          Registers custom handler for ConfigurationEvent's handling.
 void register(Subscriber<ConfEvent> subscriber)
          Registers custom handler for ConfigurationEvent's handling.
<T extends ICfgObject>
java.util.Collection<T>
retrieveMultipleObjects(java.lang.Class<T> cls, ICfgQuery query)
          Reads collection of configuration objects from server.
<T extends ICfgObject>
java.util.Collection<T>
retrieveMultipleObjects(java.lang.Class<T> cls, ICfgQuery query, long timeout)
          Retrieves a list of typed objects based on the specified query.
 ICfgObject retrieveObject(CfgObjectType objectType, int dbId)
          Reads configuration object from server by object type and DBID.
<T extends ICfgObject>
T
retrieveObject(java.lang.Class<T> cls, ICfgQuery query)
          Reads configuration object from server.
<T extends ICfgObject>
T
retrieveObject(ICfgQuery<T> query)
          Retrieves an object based on the specified query.
protected
<T extends ICfgObject>
T
retrieveObject(T confObj, ICfgQuery query)
          Deprecated.  
protected
<T extends ICfgObject>
T
retrieveObject(T confObj, ICfgQuery query, boolean isBriefInfo)
          Reads or refreshes configuration object from server.
 void saveObject(ICfgObject cfgObject)
          Saves local object modifications to the configuration server or create new one if it has been created locally.
 void setBrokerInvoker(AsyncInvoker invoker)
          Sets user defined custom invoker for ConfEvent broker.
 void setInvoker(AsyncInvoker invoker)
          Sets user defined custom invoker for callback notifications on asynchronous multiple objects reading operations.
 void setUserMessageHandler(MessageHandler msgHandler)
          Sets extra MessageHandler for custom handling of incoming asynchronous protocol messages on the channel.
It will be called in the protocol invoker thread after procession by the ConfService internal handler.
 Subscription subscribe(ICfgObject obj)
          Subscribes to receiving notifications from Configuration Server.
 Subscription subscribe(NotificationQuery query)
          Subscribes to receiving notifications from Configuration Server.
 void unregister(Action<ConfEvent> handler)
          Unregisters custom ConfigurationEvent's handler.
 void unregister(Subscriber<ConfEvent> subscriber)
          Unregisters custom ConfigurationEvent's handler.
 void unsubscribe(Subscription subscription)
          Unsubscribes from the subscription on the Configuration server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfService

protected ConfService(Protocol protocol)
Creates a new instance of the class.

Parameters:
protocol - A reference to a connection to Configuration Server
Method Detail

isDisposed

public boolean isDisposed()

exceptionIfDisposed

protected void exceptionIfDisposed()
Ensures that this ConfService instance is not disposed.

Throws:
java.lang.IllegalStateException - if service is disposed.

getMetaData

public CfgMetadata getMetaData()
Description copied from interface: IConfService
Returns reference to the configuration Metadata.

Specified by:
getMetaData in interface IConfService
Returns:
Metadata reference from the underlying protocol.

getLogger

protected ILogger getLogger()

getProtocol

public Protocol getProtocol()
Returns a reference to the protocol connection to Configuration Server.

Specified by:
getProtocol in interface IConfService
Returns:
Configuration protocol instance

setUserMessageHandler

public void setUserMessageHandler(MessageHandler msgHandler)
Sets extra MessageHandler for custom handling of incoming asynchronous protocol messages on the channel.
It will be called in the protocol invoker thread after procession by the ConfService internal handler.

Specified by:
setUserMessageHandler in interface IConfService
Parameters:
msgHandler - user handler

getInvokerNotNull

protected AsyncInvoker getInvokerNotNull()

setInvoker

public void setInvoker(AsyncInvoker invoker)
Sets user defined custom invoker for callback notifications on asynchronous multiple objects reading operations. Invoker life cycle is under user control, so, user should dispose invoker separately from ConfService.

Specified by:
setInvoker in interface IConfService
Specified by:
setInvoker in interface AsyncInvokerSupport
Parameters:
invoker - user defined invoker
Throws:
java.lang.IllegalStateException - if service is already disposed.
See Also:
beginRetrieveMultipleObjects(Class, ICfgQuery, Action), beginRetrieveMultipleObjects(Class, ICfgQuery, Action, Action)

setBrokerInvoker

public void setBrokerInvoker(AsyncInvoker invoker)
Sets user defined custom invoker for ConfEvent broker. Invoker life cycle is under user control, so, user should dispose invoker separately from ConfService.

Specified by:
setBrokerInvoker in interface IConfService
Parameters:
invoker - user defined invoker
Throws:
java.lang.IllegalStateException - if service is already disposed.

getCache

public IConfCache getCache()
Description copied from interface: IConfService
Returns an instance of the configuration cache or null if caching is not enabled.

Specified by:
getCache in interface IConfService

getPolicy

public IConfServicePolicy getPolicy()
Description copied from interface: IConfService
Returns the policy associated with this service.

Specified by:
getPolicy in interface IConfService

retrieveObject

public ICfgObject retrieveObject(CfgObjectType objectType,
                                 int dbId)
                          throws ConfigException
Reads configuration object from server by object type and DBID.

Specified by:
retrieveObject in interface IConfService
Parameters:
objectType - type of configuration object to be read
dbId - object DBID
Returns:
configuration object read or null
Throws:
ConfigException - in case of problems while reading data from server.
java.lang.IllegalStateException - if service is already disposed.

retrieveObject

public <T extends ICfgObject> T retrieveObject(ICfgQuery<T> query)
                                    throws ConfigException
Retrieves an object based on the specified query.

Specified by:
retrieveObject in interface IConfService
Parameters:
query - the query by which to retrieve the object
Returns:
The retrieved object or null
Throws:
ConfigException - in case of problems while reading data from server.
java.lang.IllegalArgumentException - if query type is unsupported.
java.lang.IllegalStateException - if service is already disposed.

retrieveObject

public <T extends ICfgObject> T retrieveObject(java.lang.Class<T> cls,
                                               ICfgQuery query)
                                    throws ConfigException
Reads configuration object from server.

Specified by:
retrieveObject in interface IConfService
Type Parameters:
T - specific wrapping class of particular configuration object type
Parameters:
cls - class used for generic matching
query - query for object reading
Returns:
configuration object read or null
Throws:
ConfigException - in case of problems while reading data from server.
java.lang.IllegalArgumentException - if query type is unsupported.
java.lang.IllegalStateException - if service is already disposed.
See Also:
retrieveObject(com.genesyslab.platform.configuration.protocol.types.CfgObjectType, int)

retrieveMultipleObjects

public <T extends ICfgObject> java.util.Collection<T> retrieveMultipleObjects(java.lang.Class<T> cls,
                                                                              ICfgQuery query)
                                                                   throws ConfigException,
                                                                          java.lang.InterruptedException
Reads collection of configuration objects from server.

Note: Don't call the method inside any PSDK callback handler. It locks config server channel's notification mechanism (because the mechanism is based on a single thread executor and the synchronous method won't get the completion notification and you will get the ProtocolTimeoutException). You should call the method from a separate thread or use the asynchronous version beginRetrieveMultipleObjects(Class, ICfgQuery, Action).

Specified by:
retrieveMultipleObjects in interface IConfService
Type Parameters:
T - specific wrapping class of particular configuration objects type
Parameters:
cls - class used for generic matching
query - query for objects reading
Returns:
configuration objects read or null
Throws:
ConfigException - in case of problems while reading data from server.
java.lang.InterruptedException - in case of forced interrupt.
java.lang.IllegalStateException - if service is already disposed.
java.lang.IllegalArgumentException - if query type is unsupported.

retrieveMultipleObjects

public <T extends ICfgObject> java.util.Collection<T> retrieveMultipleObjects(java.lang.Class<T> cls,
                                                                              ICfgQuery query,
                                                                              long timeout)
                                                                   throws ConfigException,
                                                                          java.lang.InterruptedException
Retrieves a list of typed objects based on the specified query.

Specified by:
retrieveMultipleObjects in interface IConfService
Type Parameters:
T - The type of objects to retrieve
Parameters:
query - the query by which to retrieve the objects
timeout - timeout in milliseconds which will be used for waiting messages from server (excluding parsing time of messages)
Returns:
a list of retrieved objects or null
Throws:
java.lang.IllegalStateException - if service is already disposed.
java.lang.IllegalArgumentException - if query type is unsupported.
ConfigException - in case of problems while reading data from server.
java.lang.InterruptedException

saveObject

public void saveObject(ICfgObject cfgObject)
                throws ConfigException
Saves local object modifications to the configuration server or create new one if it has been created locally.

Specified by:
saveObject in interface IConfService
Parameters:
cfgObject - configuration object instance
Throws:
ConfigException - in case of problems on object update or create operations.
java.lang.IllegalStateException - if service is already disposed.

deleteObject

public void deleteObject(ICfgObject cfgObject)
                  throws ConfigException
Deletes configuration object from the Configuration Server. Object is been removed using object type and DBID properties, so provided configuration object should have DBID initialized.

Specified by:
deleteObject in interface IConfService
Parameters:
cfgObject - configuration object instance
Throws:
ConfigException - in case of problems on object remove operation.
java.lang.IllegalStateException - if service is already disposed.

refreshObject

public void refreshObject(ICfgObject cfgObject)
                   throws ConfigException
Reloads configuration object data from the Configuration Server. Object is been refreshed using object type and DBID properties, so provided configuration object should have DBID initialized.

Specified by:
refreshObject in interface IConfService
Parameters:
cfgObject - configuration object instance
Throws:
ConfigException - in case of problems on object read operation.
java.lang.IllegalStateException - if service is already disposed.

register

public void register(Subscriber<ConfEvent> subscriber)
Registers custom handler for ConfigurationEvent's handling.

Specified by:
register in interface SubscriptionService<ConfEvent>
Parameters:
subscriber - user defined events handler
Throws:
java.lang.IllegalStateException - if service is already disposed.
See Also:
unregister(Subscriber)

register

public void register(Action<ConfEvent> handler,
                     Predicate<ConfEvent> filter)
Registers custom handler for ConfigurationEvent's handling.

Specified by:
register in interface SubscriptionService<ConfEvent>
Parameters:
handler - user defined events handler
filter - configuration events filter
Throws:
java.lang.IllegalStateException - if service is already disposed.
See Also:
unregister(Action)

unregister

public void unregister(Subscriber<ConfEvent> subscriber)
Unregisters custom ConfigurationEvent's handler.

Specified by:
unregister in interface SubscriptionService<ConfEvent>
Parameters:
subscriber - user defined events handler
See Also:
register(Subscriber), register(Action, Predicate)

unregister

public void unregister(Action<ConfEvent> handler)
Unregisters custom ConfigurationEvent's handler.

Specified by:
unregister in interface SubscriptionService<ConfEvent>
Parameters:
handler - user defined events handler
See Also:
register(Subscriber), register(Action, Predicate)

subscribe

public Subscription subscribe(NotificationQuery query)
                       throws ConfigException
Subscribes to receiving notifications from Configuration Server. Should be used in conjunction with Register method so that events reach the event handler.

Specified by:
subscribe in interface IConfService
Parameters:
query - query for subscription
Returns:
subscription keeping object
Throws:
ConfigException - exception while working with server side.
java.lang.IllegalStateException - if service is already disposed.
See Also:
unsubscribe(Subscription)

subscribe

public Subscription subscribe(ICfgObject obj)
                       throws ConfigException
Subscribes to receiving notifications from Configuration Server. Should be used in conjunction with Register method so that events reach the event handler.

Specified by:
subscribe in interface IConfService
Parameters:
obj - object to listen events on
Returns:
subscription keeping object
Throws:
ConfigException - exception while working with server side.
java.lang.IllegalStateException - if service is already disposed.
See Also:
unsubscribe(Subscription)

unsubscribe

public void unsubscribe(Subscription subscription)
                 throws ConfigException
Unsubscribes from the subscription on the Configuration server.

Specified by:
unsubscribe in interface IConfService
Parameters:
subscription - subscription holder got with call to subscribe(ICfgObject) or subscribe(NotificationQuery).
Throws:
ConfigException - exception while working with server side.
java.lang.IllegalStateException - if service is already disposed.
See Also:
subscribe(ICfgObject), subscribe(NotificationQuery)

retrieveObject

protected <T extends ICfgObject> T retrieveObject(T confObj,
                                                  ICfgQuery query)
                                       throws ConfigException
Deprecated. 

Reads or refreshes configuration object from server. It's for internal usage only.

Parameters:
confObj - object instance to refresh or null
query - query for object reading
Returns:
configuration object read/refreshed (or null)
Throws:
ConfigException - in case of problems while reading data from server.
java.lang.IllegalStateException - if service is already disposed.
See Also:
retrieveObject(com.genesyslab.platform.configuration.protocol.types.CfgObjectType, int), retrieveObject(ICfgObject, ICfgQuery, boolean)

retrieveObject

protected <T extends ICfgObject> T retrieveObject(T confObj,
                                                  ICfgQuery query,
                                                  boolean isBriefInfo)
                                       throws ConfigException
Reads or refreshes configuration object from server. It's for internal usage only.

Parameters:
confObj - object instance to refresh or null
query - query for object reading
isBriefInfo - flag for objects' brief info request (is used when confObj is null)
Returns:
configuration object read/refreshed (or null)
Throws:
ConfigException - in case of problems while reading data from server
java.lang.IllegalStateException - if service is already disposed.
See Also:
retrieveObject(com.genesyslab.platform.configuration.protocol.types.CfgObjectType, int)

prepareReadObjectsFilter

protected KeyValueCollection prepareReadObjectsFilter(ICfgFilterBasedQuery query)

prepareRequestReadBriefInfoMessage

protected Message prepareRequestReadBriefInfoMessage(ICfgQuery query)

beginRetrieveMultipleObjects

public <T extends ICfgObject> AsyncRequestResult<T> beginRetrieveMultipleObjects(java.lang.Class<T> cls,
                                                                                 ICfgQuery query,
                                                                                 Action<AsyncRequestResult<T>> finishCallback)
                                                                      throws ConfigException
Starts reading of configuration objects collection from server. Callback notifications are done with additional invoker, so, async invoker must be set with setInvoker(AsyncInvoker) before this method invocation if we have non-null callback.

Example
 // application initialization
 AsyncInvoker inv = InvokerFactory.namedInvoker("my");
 confService.setInvoker(inv);
 // …
 Action<AsyncRequestResult<CfgApplication>> callback =
                 new Action<AsyncRequestResult<CfgApplication>>() {
                     public void handle(final AsyncRequestResult<CfgApplication> obj) {
                         try {
                             Collection<CfgApplication> applications = obj.get();
                             // todo : process the result
                         } catch (Exception e) {  e.printStackTrace();  }
                     }
                 };
         // Start application configuration objects reading:
         AsyncRequestResult<CfgApplication> asyncRequest =
                 confService.beginRetrieveMultipleObjects(CfgApplication.class,
                         new CfgApplicationQuery(), callback);
 
 // application deinitialization
 confService.setInvoker(null);
 InvokerFactory. releaseInvoker("my");
 

Specified by:
beginRetrieveMultipleObjects in interface IConfService
Type Parameters:
T - specific wrapping class of particular configuration objects type
Parameters:
cls - class used for generic matching
query - query for objects reading
finishCallback - user defined callback action for data readiness notification or null
Throws:
ConfigException - in case of problems while reading data from server.
java.lang.IllegalArgumentException - if query type is unsupported.
java.lang.IllegalStateException - if service is already disposed.
See Also:
setInvoker(AsyncInvoker)

beginRetrieveMultipleObjects

public <T extends ICfgObject> AsyncRequestResult<T> beginRetrieveMultipleObjects(java.lang.Class<T> cls,
                                                                                 ICfgQuery query,
                                                                                 Action<java.util.Collection<T>> dataCallback,
                                                                                 Action<AsyncRequestResult<T>> finishCallback)
                                                                      throws ConfigException
Starts reading of configuration objects collection from server. Callback notifications are done with additional invoker, so, async invoker must be set with setInvoker(AsyncInvoker) before this method invocation if we have non-null callback.

Specified by:
beginRetrieveMultipleObjects in interface IConfService
Type Parameters:
T - specific wrapping class of particular configuration objects type
Parameters:
cls - class used for generic matching
query - query for objects reading
dataCallback - user defined callback action for data parts arrival notification or null
finishCallback - user defined callback action for data readiness notification or null
Throws:
ConfigException - in case of problems while reading data from server.
java.lang.IllegalArgumentException - if query type is unsupported.
java.lang.IllegalStateException - if service is already disposed.
See Also:
endRetrieveMultipleObjects(AsyncRequestResult), setInvoker(AsyncInvoker)

beginRetrieveMultipleObjects

public <T extends ICfgObject> AsyncRequestResult<T> beginRetrieveMultipleObjects(java.lang.Class<T> cls,
                                                                                 ICfgQuery query,
                                                                                 Action<java.util.Collection<T>> dataCallback,
                                                                                 Action<AsyncRequestResult<T>> finishCallback,
                                                                                 long timeout)
                                                                      throws ConfigException
Starts reading of configuration objects collection from server. Callback notifications are done with additional invoker, so, async invoker must be set with setInvoker(AsyncInvoker) before this method invocation if we have non-null callback.

Specified by:
beginRetrieveMultipleObjects in interface IConfService
Type Parameters:
T - specific wrapping class of particular configuration objects type
Parameters:
cls - class used for generic matching
query - query for objects reading
dataCallback - user defined callback action for data parts arrival notification or null
finishCallback - user defined callback action for data readiness notification or null
timeout - timeout in milliseconds which will be used for waiting messages from server (excluding parsing time of messages)
Throws:
ConfigException - in case of problems while reading data from server.
java.lang.IllegalArgumentException - if query type is unsupported.
java.lang.IllegalStateException - if service is already disposed.
See Also:
endRetrieveMultipleObjects(AsyncRequestResult), setInvoker(AsyncInvoker)

endRetrieveMultipleObjects

public <T extends ICfgObject> java.util.Collection<T> endRetrieveMultipleObjects(AsyncRequestResult<T> rqResult)
                                                                      throws ConfigException,
                                                                             java.lang.InterruptedException
Waits until asynchronous reading operation done and return requested data.

Specified by:
endRetrieveMultipleObjects in interface IConfService
Type Parameters:
T - specific wrapping class of particular configuration object type
Parameters:
rqResult - future object instance created on asynchronous operation start
Returns:
configuration data read or null
Throws:
ConfigException - in case of exception in configuration information reading.
java.lang.InterruptedException - if operation was interrupted in some way.
java.lang.IllegalArgumentException - if query type is unsupported.

createObjectFromXML

public ICfgObject createObjectFromXML(org.w3c.dom.Node confObject,
                                      java.lang.String objectPath,
                                      int folderDbid,
                                      boolean isSaved)
                               throws ConfigException
Creates a single COM configuration object using the passed parameters.

Specified by:
createObjectFromXML in interface IConfService
Parameters:
confObject - The XML node describing a single configuration object as received from Configuration Server
objectPath - The folder path of the object in Configuration Server
folderDbid - The DBID of the folder in which the object resides
isSaved - Specifies whether the object has been previously saved in the configuration database
Returns:
the newly created object
Throws:
ConfigException - in case of object instantiation problems.
java.lang.IllegalStateException - if service is already disposed.

createObjectFromXML

public ICfgObject createObjectFromXML(org.w3c.dom.Node confObject,
                                      boolean isSaved)
                               throws ConfigException
Creates a single COM configuration object using the passed parameters.

Specified by:
createObjectFromXML in interface IConfService
Parameters:
confObject - The XML node describing a single configuration object as received from Configuration Server.
isSaved - Specifies whether the object has been previously saved in the configuration database.
Returns:
the newly created object
Throws:
ConfigException - in case of object instantiation problems.
java.lang.IllegalStateException - if service is already disposed.

createMultipleObjectsFromXML

public <T extends ICfgObject> java.util.Collection<T> createMultipleObjectsFromXML(org.w3c.dom.Node confObjectsContainer,
                                                                                   java.lang.String[] objectsPaths,
                                                                                   int[] foldersDbids)
                                                                        throws ConfigException
Creates a list of COM configuration objects using the passed parameters.

Specified by:
createMultipleObjectsFromXML in interface IConfService
Parameters:
confObjectsContainer - Parent node containing set of XML nodes describing configuration objects as received from Configuration Server
objectsPaths - The folders paths of objects in Configuration Server
foldersDbids - The DBIDs of folders where objects reside
Returns:
a list of newly created objects
Throws:
ConfigException - in case of objects instantiation problems.
java.lang.IllegalStateException - if service is already disposed.

createMultipleObjectsFromXML

public <T extends ICfgObject> java.util.Collection<T> createMultipleObjectsFromXML(org.w3c.dom.NodeList confObjects,
                                                                                   java.lang.String[] objectsPaths,
                                                                                   int[] foldersDbids)
                                                                        throws ConfigException
Creates a list of COM configuration objects using the passed parameters.

Parameters:
confObjects - List of XML nodes describing configuration objects as received from Configuration Server
objectsPaths - The folders paths of objects in Configuration Server
foldersDbids - The DBIDs of folders where objects reside
Returns:
a list of newly created objects
Throws:
ConfigException - in case of objects instantiation problems.
java.lang.IllegalStateException - if service is already disposed.

createObject

public ICfgObject createObject(ConfObjectBase confObject,
                               java.lang.String objectPath,
                               int folderDbid,
                               boolean isSaved)
                        throws ConfigException
Description copied from interface: IConfService
Wraps a single configuration structure with COM configuration object using the passed parameters.

Specified by:
createObject in interface IConfService
Parameters:
confObject - initial content of the object to be created
objectPath - The folder path of the object in Configuration Server
folderDbid - The DBID of the folder in which the object resides
isSaved - specifies whether the object has been previously saved in the configuration database
Returns:
newly created configuration object.
Throws:
ConfigException - in case of problems in communication with server.

createObject

public ICfgObject createObject(ConfObjectBase confObject,
                               boolean isSaved)
                        throws ConfigException
Wraps a single configuration structure with COM configuration object using the passed parameters.

Specified by:
createObject in interface IConfService
Parameters:
confObject - initial content of the object to be created
isSaved - specifies whether the object has been previously saved in the configuration database
Returns:
newly created configuration object.
Throws:
ConfigException - in case of problems in the given structure.
java.lang.IllegalStateException - if service is already disposed.
java.lang.IllegalArgumentException - if given objects structure is null or invalid.

createMultipleObjects

public <T extends ICfgObject> java.util.Collection<T> createMultipleObjects(ConfDataCollection<? extends ConfObjectBase> confObjects,
                                                                            java.lang.String[] objectsPaths,
                                                                            int[] foldersDbids)
                                                                 throws ConfigException
Wraps a single configuration structure with COM configuration object using the passed parameters.

Specified by:
createMultipleObjects in interface IConfService
Parameters:
confObjects - collection with initial contents of objects to be created
Returns:
newly created configuration object.
Throws:
ConfigException - in case of problems in the given structure.
java.lang.IllegalStateException - if service is already disposed.
java.lang.NullPointerException - if given collection is null.
java.lang.IllegalArgumentException - if given object structure in the collection is null or invalid.

createMultipleObjects

public java.util.Collection<ICfgObject> createMultipleObjects(ConfObjectsCollection confObjects)
                                                       throws ConfigException
Creates collection of COM configuration objects using the passed parameters.

Specified by:
createMultipleObjects in interface IConfService
Parameters:
confObjects - collection of objects declarations to be created
Returns:
newly created configuration objects.
Throws:
ConfigException - in case of problems in communication with server.
java.lang.IllegalStateException - if service is already disposed.
java.lang.IllegalArgumentException - if given object structure in the collection is null or invalid.

createMultipleObjectsFromXML

public java.util.Collection<ICfgObject> createMultipleObjectsFromXML(org.w3c.dom.Node confObjectsContainer)
                                                              throws ConfigException
Creates a list of configuration objects based on XML received from Configuration Server.
Usage sample:
      List<CfgObject> objs = cfgService.createMultipleObjectsFromXML(
              eventObjectsRead.getConfObject().getDocumentElement()
      );
 

Specified by:
createMultipleObjectsFromXML in interface IConfService
Parameters:
confObjectsContainer - parent node containing set of XML nodes describing configuration objects as received from Configuration Server
Returns:
a list of newly created objects
Throws:
ConfigException - in case of objects instantiation problems.
java.lang.IllegalStateException - if service is already disposed.

createMultipleObjectsFromXML

public java.util.Collection<ICfgObject> createMultipleObjectsFromXML(org.w3c.dom.NodeList confObjects)
                                                              throws ConfigException
Creates a list of configuration objects based on XML received from Configuration Server.

Parameters:
confObjects - list of XML nodes describing configuration objects as received from Configuration Server
Returns:
a list of newly created objects
Throws:
ConfigException - in case of objects instantiation problems

prepareRequestReadObjectsMessage

protected Message prepareRequestReadObjectsMessage(ICfgQuery query)
Create Configuration Protocol Request Message for configuration objects reading.

Parameters:
query - query for configuration object(s)
Returns:
Configuration Protocol Message with proper filter initialized
Throws:
java.lang.IllegalArgumentException - if query type is unsupported

addObjectOnRetrieve

protected boolean addObjectOnRetrieve(ICfgObject object)

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.