Package net.aifusion.cimserver
Class CimClient
java.lang.Object
net.aifusion.cimserver.CimClient
- All Implemented Interfaces:
CimEventGenerator,CimListener,Repository,Provider
Class to implement the client side interface for a Cim Server.
The client implements a Provider interface as well as a CimListener to enable the application to receive server-side events.
The client forwards all requests to the server, and does not (currently) cache any data on the client side.
- Author:
- Sharad Singhal
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddListener(CimEventType type, CimListener listener) Add a listener to this generatorbooleancontains(ObjectPath path) Check if a named element exists in the repositorybooleandelete(ObjectPath path) Delete a named element from the repositorybooleanexecuteQuery(String query) Execute a query against this provider, and return the result setfilter(ObjectPath path, CimFilter filter) Find all structure value instances based on some filter criteriaget(ObjectPath path) Get a named element from the repositorygetElements(String elementTypes, String localNameSpaces, String elementNames, boolean locateSubTypes) Get elements from this repository.getMethodNames(ObjectPath path) Get the method names defined in a given CIM classgetMethodParameters(ObjectPath path, String methodName) Get the parameter list associated with a methodgetMethodReturnType(ObjectPath path, String methodName) Get the return type associated with a methodGet a list of all name spaces known to this repository.getPropertyNames(ObjectPath path) Get the property names for a given named element.getPropertyType(ObjectPath path, String propertyName) Get the data type corresponding to a particular property (or enumeration key)getPropertyValue(ObjectPath path, String propertyName) Get a property value from this provider, or one of its children.Get the underlying repository for this providergetURL()Get the URL for this providerinthashCode()booleanhasListener(CimEventType type, CimListener listener) Check if this event generator has a listener for an event typeinvokeMethod(ObjectPath path, String methodName, List<CimParameter> methodParameters) Invoke an extrinsic method on a class or instance within this provider, or one of its childrenvoidNotify this listener of a given event at some event generatorbooleanput(NamedElement element) Put a named element into the repositoryvoidregisterChildProvider(Provider child) Register a child provider with this provider.voidremoveListener(CimEventType type, CimListener listener) Remove a listener from this generatorvoidsetKeepAlive(boolean keepAlive) Set the keep-alive value for connections by the clientvoidsetPropertyValue(ObjectPath path, String propertyName, DataValue propertyValue) Set a property value within this provider, or one of its childrenvoidshutdown()Shut down the repository.voidunregisterChildProvider(Provider child) Unregister a child provider.
-
Constructor Details
-
CimClient
Create a CimClient using a server URL and an optional proxy- Parameters:
serverURL- - server to which this client should connectclientURL- - the URL of this client (if any) for inbound communication. Null if no inbound connections expected.proxyHost- - outbound HTTP proxy host, if anyproxyPort- - outbound HTTP proxy port, if any
-
CimClient
Create a new CimClient using a configuration- Parameters:
serverURL- - CimServer to which this client should connectconfiguration- - configuration for the client. Maybe null if client configuration is not needed for Http
-
-
Method Details
-
setKeepAlive
public void setKeepAlive(boolean keepAlive) Set the keep-alive value for connections by the client- Parameters:
keepAlive- - true (default) to keep connections alive. False to close connections after each request
-
getNameSpaces
Description copied from interface:RepositoryGet a list of all name spaces known to this repository. Note that because implementations can add or remove name spaces as elements are added or deleted, this list may not be complete, and depends on the repository implementation- Specified by:
getNameSpacesin interfaceRepository- Returns:
- - list of name spaces
-
get
Description copied from interface:RepositoryGet a named element from the repository- Specified by:
getin interfaceRepository- Parameters:
path- - object path corresponding to the named element- Returns:
- - Named Element corresponding to the element. Null returned if no such element exists in the repository
-
contains
Description copied from interface:RepositoryCheck if a named element exists in the repository- Specified by:
containsin interfaceRepository- Parameters:
path- - object path corresponding to the named element- Returns:
- - true if the path exists in the repository, false otherwise
-
put
Description copied from interface:RepositoryPut a named element into the repository- Specified by:
putin interfaceRepository- Parameters:
element- - element to be added- Returns:
- - true if successfully added, false otherwise
-
delete
Description copied from interface:RepositoryDelete a named element from the repository- Specified by:
deletein interfaceRepository- Parameters:
path- - object path corresponding to the named element- Returns:
- - true if deletion succeeded, false otherwise
-
getElements
public List<NamedElement> getElements(String elementTypes, String localNameSpaces, String elementNames, boolean locateSubTypes) Description copied from interface:RepositoryGet elements from this repository. Depending on the size of the repository, this method can be very expensive in time and/or memory- Specified by:
getElementsin interfaceRepository- Parameters:
elementTypes- - Optional comma separated list of element types to retrieve. Must be a NamedElement type (QualifierType, Enumeration, Interface, Structure, Class, StructureValue or Instance). A null will retrieve all types. Note that standard qualifier types are "built in" and are not returned by this method.localNameSpaces- - Optional comma separated list of local name spaces to search. A null will retrieve elements from all name spaceselementNames- - Optional comma-separated list of element names to retrieve. A null will retrieve all elements of the given type. For instances, all instances corresponding to the class name are returnedlocateSubTypes- - if true, locate all subtypes of the given element types (e.g., all subclasses of the requested class).- Returns:
- - list of elements that match the given criteria. An empty list is returned if no matching elements are found
- See Also:
-
filter
Description copied from interface:RepositoryFind all structure value instances based on some filter criteria- Specified by:
filterin interfaceRepository- Parameters:
path- - object path to the structure to usefilter- - filter to apply- Returns:
- - list of structureValues that pass the given filter. Empty list if none available
-
shutdown
public void shutdown()Description copied from interface:RepositoryShut down the repository. This method MUST be called before exiting to cleanly finish all pending tasks and release resources in the repository- Specified by:
shutdownin interfaceRepository
-
addListener
Description copied from interface:CimEventGeneratorAdd a listener to this generator- Specified by:
addListenerin interfaceCimEventGenerator- Parameters:
type- - type of event the listener wantslistener- - CimListener interested in events- Returns:
- - true if listener was successfully added, false otherwise
-
removeListener
Description copied from interface:CimEventGeneratorRemove a listener from this generator- Specified by:
removeListenerin interfaceCimEventGenerator- Parameters:
type- of event the listener wantslistener- - CimListener to be removed
-
hasListener
Description copied from interface:CimEventGeneratorCheck if this event generator has a listener for an event type- Specified by:
hasListenerin interfaceCimEventGenerator- Parameters:
type- - type of eventlistener- - listener to check. If null, check if any listener is registered- Returns:
- - true if the generator has at least one registered listener for the event type, false otherwise
-
registerChildProvider
Description copied from interface:ProviderRegister a child provider with this provider. This enables this provider to dispatch queries to the child provider and and delegate selected queries to the child provider.- Specified by:
registerChildProviderin interfaceProvider- Parameters:
child- - child provider to be registered with this provider
-
unregisterChildProvider
Description copied from interface:ProviderUnregister a child provider. This disconnects the child from this provider- Specified by:
unregisterChildProviderin interfaceProvider- Parameters:
child- - child provider to be unregistered
-
getPropertyNames
Description copied from interface:ProviderGet the property names for a given named element. In case the objectPath is an enumeration, the key names are returned- Specified by:
getPropertyNamesin interfaceProvider- Parameters:
path- - object path for the CIM element from which property names are desired- Returns:
- - list containing names of the properties. Empty if none defined
-
getPropertyType
Description copied from interface:ProviderGet the data type corresponding to a particular property (or enumeration key)- Specified by:
getPropertyTypein interfaceProvider- Parameters:
path- - object path of the CIM element from which the property is selectedpropertyName- - name of the property or key- Returns:
- - DataType of the corresponding property or key
-
getPropertyValue
Description copied from interface:ProviderGet a property value from this provider, or one of its children.- Specified by:
getPropertyValuein interfaceProvider- Parameters:
path- - object path of the CIM Element from which the property is being readpropertyName- - case insensitive name of the property being read- Returns:
- - data value containing the property or key value
-
setPropertyValue
Description copied from interface:ProviderSet a property value within this provider, or one of its children- Specified by:
setPropertyValuein interfaceProvider- Parameters:
path- - object path of the CIM Element in which the property is being set. Note that only Classes and Instances have settable propertiespropertyName- - case insensitive name of the property being setpropertyValue- - value of the property being set
-
getMethodNames
Description copied from interface:ProviderGet the method names defined in a given CIM class- Specified by:
getMethodNamesin interfaceProvider- Parameters:
path- - object path for the CIM class from which method names are desired- Returns:
- - list containing method names. Empty if no methods are defined.
-
getMethodReturnType
Description copied from interface:ProviderGet the return type associated with a method- Specified by:
getMethodReturnTypein interfaceProvider- Parameters:
path- - object path for the CIM class from which the method is selectedmethodName- - name of the method- Returns:
- - data type associated with the method. Null if no such method exists
-
getMethodParameters
Description copied from interface:ProviderGet the parameter list associated with a method- Specified by:
getMethodParametersin interfaceProvider- Parameters:
path- - object path of the CIM class from which the method is desiredmethodName- - name of the method desired- Returns:
- - list of parameters. Empty if the method does not take parameters.
-
invokeMethod
public DataValue invokeMethod(ObjectPath path, String methodName, List<CimParameter> methodParameters) Description copied from interface:ProviderInvoke an extrinsic method on a class or instance within this provider, or one of its children- Specified by:
invokeMethodin interfaceProvider- Parameters:
path- - object path of the CIM element on which the method is being invokedmethodName- - case insensitive name of the method being invokedmethodParameters- - list of parameters to be passed to the method- Returns:
- - value returned from the method invocation
-
executeQuery
Description copied from interface:ProviderExecute a query against this provider, and return the result set- Specified by:
executeQueryin interfaceProvider- Parameters:
query- - query to be executed- Returns:
- - set of results
-
notify
Description copied from interface:CimListenerNotify this listener of a given event at some event generator- Specified by:
notifyin interfaceCimListener- Parameters:
event- - event generated by the corresponding event generator
-
getRepository
Description copied from interface:ProviderGet the underlying repository for this provider- Specified by:
getRepositoryin interfaceProvider- Returns:
- - reference to the underlying repository
-
getURL
Description copied from interface:ProviderGet the URL for this provider- Specified by:
getURLin interfaceCimListener- Specified by:
getURLin interfaceProvider- Returns:
- - URL where this provider can be reached. Null if the provider is not network accessible
-
hashCode
public int hashCode() -
equals
-