|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.ecf.core.AbstractContainer
org.eclipse.ecf.remoteservice.rest.RestContainer
public class RestContainer
A container for REST services. This was implemented using the ECF#RemoteServiceAPI.
| Field Summary | |
|---|---|
static java.lang.String |
NAME
|
| Constructor Summary | |
|---|---|
RestContainer()
|
|
RestContainer(ID id)
|
|
| Method Summary | |
|---|---|
void |
addRemoteServiceListener(IRemoteServiceListener listener)
Add listener for remote service registration/unregistration for this container |
org.eclipse.equinox.concurrent.future.IFuture |
asyncGetRemoteServiceReferences(ID[] idFilter,
java.lang.String clazz,
java.lang.String filter)
Asynchronously returns an array of IRemoteServiceReference objects. |
org.eclipse.equinox.concurrent.future.IFuture |
asyncGetRemoteServiceReferences(ID target,
java.lang.String clazz,
java.lang.String filter)
Asynchronously returns an array of IRemoteServiceReference objects. |
void |
connect(ID targetID,
IConnectContext connectContext)
Connect to a target remote process or process group. |
IRemoteFilter |
createRemoteFilter(java.lang.String filter)
Creates a IRemoteFilter object. |
void |
disconnect()
Disconnect. |
void |
dispose()
Dispose this IContainer instance. |
IRemoteServiceReference[] |
getAllRemoteServiceReferences(java.lang.String clazz,
java.lang.String filter)
Returns an array of IRemoteServiceReference objects. |
ID |
getConnectedID()
Get the target ID that this container instance has connected to. |
Namespace |
getConnectNamespace()
Get the Namespace for creating a targetID suitable for use as the first parameter in subsequent calls to IContainer.connect(ID, IConnectContext). |
IContainer |
getContainer()
Get the container instance for this remote service container. |
IRemoteServiceContainerAdapter |
getContainerAdapter()
Get the container adapter for this remote service container. |
ID |
getID()
Return the ID for this 'identifiable' object. |
IRemoteService |
getRemoteService(IRemoteServiceReference reference)
Get remote service for given IRemoteServiceReference. |
IRemoteService |
getRemoteService(java.lang.String serviceInterfaceClass)
Get the remote service for given serviceInterface class. |
IRemoteService |
getRemoteService(java.lang.String targetLocation,
java.lang.String serviceInterfaceClass)
Get the remote service for given targetLocation and given serviceInterface class. |
IRemoteService |
getRemoteService(java.lang.String targetLocation,
java.lang.String serviceInterfaceClass,
java.lang.String filter)
Get the remote service for given targetLocation and given serviceInterface class. |
IRemoteServiceID |
getRemoteServiceID(ID containerID,
long containerRelativeID)
Get a remote service ID from a containerID and a containerRelative long value. |
Namespace |
getRemoteServiceNamespace()
Get namespace to use for this remote service provider. |
IRemoteServiceReference |
getRemoteServiceReference(IRemoteServiceID serviceID)
Get the remote service reference known to this container for the given IRemoteServiceID. |
IRemoteServiceReference[] |
getRemoteServiceReferences(ID[] idFilter,
java.lang.String clazz,
java.lang.String filter)
Returns an array of IRemoteServiceReference objects. |
IRemoteServiceReference[] |
getRemoteServiceReferences(ID target,
java.lang.String clazz,
java.lang.String filter)
Returns an array of IRemoteServiceReference objects. |
IRestCall |
lookupRestCall(IRemoteCall call)
|
IRemoteServiceRegistration |
registerRemoteService(java.lang.String[] clazzes,
java.lang.Object service,
java.util.Dictionary properties)
Register a new remote service. |
RestServiceRegistration |
registerRestService(java.lang.String[] clazzes,
java.lang.Object service,
java.util.Map restCalls,
java.util.Dictionary properties)
Registers a POJO object as a REST service. |
void |
removeRemoteServiceListener(IRemoteServiceListener listener)
Remove remote service registration/unregistration listener for this container. |
void |
setConnectContextForAuthentication(IConnectContext connectContext)
Set connect context for authentication upon subsequent calls to IRemoteServiceContainerAdapter.getRemoteServiceReferences(ID[], String, String) or IRemoteServiceContainerAdapter.asyncGetRemoteServiceReferences(ID[], String, String). |
boolean |
ungetRemoteService(IRemoteServiceReference reference)
Unget IRemoteServiceReference. |
| Methods inherited from class org.eclipse.ecf.core.AbstractContainer |
|---|
addListener, fireContainerEvent, getAdapter, getPasswordFromConnectContext, removeListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.eclipse.core.runtime.IAdaptable |
|---|
getAdapter |
| Field Detail |
|---|
public static final java.lang.String NAME
| Constructor Detail |
|---|
public RestContainer(ID id)
public RestContainer()
| Method Detail |
|---|
public void connect(ID targetID,
IConnectContext connectContext)
throws ContainerConnectException
IContainer
connect in interface IContainertargetID - the ID of the remote server or group to connect to. See
IContainer.getConnectNamespace() for a explanation of the
constraints upon this parameter.connectContext - any required context to allow this container to authenticate.
May be null if underlying provider does not
have any authentication requirements for connection.
ContainerConnectException - thrown if communication cannot be established with remote
service. Causes can include network connection failure,
authentication failure, server error, or if container is
already connected.public void disconnect()
IContainernull.
disconnect in interface IContainerpublic void dispose()
IContainer
dispose in interface IContainerdispose in class AbstractContainerpublic Namespace getConnectNamespace()
IContainerIContainer.connect(ID, IConnectContext).
If this method returns null, then it means that
null is expected as a valid parameter in subsequent calls
to IContainer.connect(ID, IConnectContext). If this method returns a non-null
Namespace, then the targetID parameter in
IContainer.connect(ID, IConnectContext) must be non-null
instance created of the returned Namespace.
getConnectNamespace in interface IContainerIContainer.connect(ID, IConnectContext). If null,
then the targetID instances passed to
IContainer.connect(ID, IConnectContext) may be null.
If not null, then targetID
instances passed to IContainer.connect(ID, IConnectContext) must be
instances of the returned Namespace.public ID getConnectedID()
IContainer
getConnectedID in interface IContainernull
if container not connected.public ID getID()
IIdentifiablenull.
getID in interface IIdentifiablenull.public void addRemoteServiceListener(IRemoteServiceListener listener)
IRemoteServiceContainerAdapter
addRemoteServiceListener in interface IRemoteServiceContainerAdapterlistener - notified of service registration/unregistration events. Must
not be null .
public org.eclipse.equinox.concurrent.future.IFuture asyncGetRemoteServiceReferences(ID[] idFilter,
java.lang.String clazz,
java.lang.String filter)
IRemoteServiceContainerAdapterIRemoteServiceReference objects. The
returned array of IRemoteServiceReference objects contains
services that were registered under the specified class and match the
specified idFilter, and filter criteria.
Note this method assumes that the enclosing container has previously
been connected, and uses the idFilter to filter among targets within the
previously connected set of container IDs. To request connection as
part of reference lookup, see IRemoteServiceContainerAdapter.getRemoteServiceReferences(ID, String, String).
The IFuture is returned immediately, and subsequent calls to IFuture.get()
or IFuture.get(long) will return the actual results received. The type of
the Object returned from IFuture.get() will be IRemoteServiceReference [].
The list is valid at the time of the call to this method, however since the Framework is a very dynamic environment, services can be modified or unregistered at anytime.
idFilter is used to select a registered services that were
registered by a given set of containers with id in idFilter. Only
services exposed by a container with id in idFilter will be returned.
If idFilter is null, all containers are
considered to match the filter.
filter is used to select the registered service whose
properties objects contain keys and values which satisfy the filter. See
Filter for a description of the filter string syntax.
asyncGetRemoteServiceReferences in interface IRemoteServiceContainerAdapteridFilter - an array of ID instances that will restrict the search for
matching container ids If null, all remote containers will be
considered in search for matching IRemoteServiceReference
instances. May be null.clazz - the fully qualified name of the interface class that describes
the desired service. Must not be null.filter - The filter criteria. May be null.
null.
public org.eclipse.equinox.concurrent.future.IFuture asyncGetRemoteServiceReferences(ID target,
java.lang.String clazz,
java.lang.String filter)
IRemoteServiceContainerAdapterIRemoteServiceReference objects. The
returned array of IRemoteServiceReference objects contains
services that were registered under the specified class and match the
specified idFilter, and filter criteria.
The IFuture is returned immediately, and subsequent calls to IFuture.get()
or IFuture.get(long) will return the actual results received. The type of
the Object returned from IFuture.get() will be IRemoteServiceReference [].
The list is valid at the time of the call to this method, however since the Framework is a very dynamic environment, services can be modified or unregistered at anytime.
idFilter is used to select a registered services that were
registered by a given set of containers with id in idFilter. Only
services exposed by a container with id in idFilter will be returned.
target is a remote container to connect to.
filter is used to select the registered service whose
properties objects contain keys and values which satisfy the filter. See
Filter for a description of the filter string syntax.
asyncGetRemoteServiceReferences in interface IRemoteServiceContainerAdaptertarget - an target to connect to if enclosing container is not already
connected. May be null.clazz - the fully qualified name of the interface class that describes
the desired service. Must not be null.filter - The filter criteria. May be null.
null.
public IRemoteFilter createRemoteFilter(java.lang.String filter)
throws org.osgi.framework.InvalidSyntaxException
IRemoteServiceContainerAdapterIRemoteFilter object. This IRemoteFilter object may
be used to match a IRemoteServiceReference object or a
Dictionary object.
If the filter cannot be parsed, an InvalidSyntaxException will be
thrown with a human readable message where the filter became unparsable.
createRemoteFilter in interface IRemoteServiceContainerAdapterfilter - The filter string.
IRemoteFilter object encapsulating the filter string.
org.osgi.framework.InvalidSyntaxException - If filter contains an invalid
filter string that cannot be parsed.FrameworkUtil.createFilter(String)
public IRemoteServiceReference[] getAllRemoteServiceReferences(java.lang.String clazz,
java.lang.String filter)
throws org.osgi.framework.InvalidSyntaxException
IRemoteServiceContainerAdapter
Returns an array of IRemoteServiceReference objects. The
returned array of IRemoteServiceReference objects contains
services that were registered under the specified class, or if the clazz
parameter is null all services registered.
The list is valid at the time of the call to this method, however since the remote service container is a very dynamic environment, services can be modified or unregistered at anytime.
filter is used to select the registered service whose
properties objects contain keys and values which satisfy the filter. See
Filter for a description of the filter string syntax.
If filter is null, all registered services
are considered to match the filter. If filter cannot be
parsed, an InvalidSyntaxException will be thrown with a human
readable message where the filter became unparsable.
getAllRemoteServiceReferences in interface IRemoteServiceContainerAdapterclazz - the fully qualified name of the interface class that describes
the desired service. May be null.filter - The filter criteria. May be null.
null if no services are found that match the search.
org.osgi.framework.InvalidSyntaxException - If filter contains an invalid filter string that cannot be parsed.public IRemoteService getRemoteService(IRemoteServiceReference reference)
IRemoteServiceContainerAdapterIRemoteServiceContainerAdapter.ungetRemoteService(IRemoteServiceReference)
when the IRemoteService will no longer be used.
getRemoteService in interface IRemoteServiceContainerAdapterreference - the IRemoteServiceReference for the desired service. Must not
be null .
null is
returned.IRemoteServiceContainerAdapter.ungetRemoteService(IRemoteServiceReference)
public IRemoteServiceID getRemoteServiceID(ID containerID,
long containerRelativeID)
IRemoteServiceContainerAdapternull
if not.
getRemoteServiceID in interface IRemoteServiceContainerAdaptercontainerID - the containerID that is the server/host for the remote service. Must not be null. This
must be the containerID for the server/host of the remote service.containerRelativeID - the long value identifying the remote service relative to the container ID.
null if it is not.public Namespace getRemoteServiceNamespace()
IRemoteServiceContainerAdapter
getRemoteServiceNamespace in interface IRemoteServiceContainerAdapternull.public IRemoteServiceReference getRemoteServiceReference(IRemoteServiceID serviceID)
IRemoteServiceContainerAdapter
getRemoteServiceReference in interface IRemoteServiceContainerAdapterserviceID - the serviceID to retrieve the IRemoteServiceReference for.
null if no IRemoteServiceReference found for the given serviceID.
public IRemoteServiceReference[] getRemoteServiceReferences(ID[] idFilter,
java.lang.String clazz,
java.lang.String filter)
throws org.osgi.framework.InvalidSyntaxException
IRemoteServiceContainerAdapterIRemoteServiceReference objects. The
returned array of IRemoteServiceReference objects contains
services that were registered under the specified class and match the
specified idFilter, and filter criteria.
Note this method assumes that the enclosing container has previously
been connected, and uses the idFilter to filter among targets within the
previously connected set of container IDs. To request connection as
part of reference lookup, see IRemoteServiceContainerAdapter.getRemoteServiceReferences(ID, String, String).
The list is valid at the time of the call to this method, however since the Framework is a very dynamic environment, services can be modified or unregistered at anytime.
idFilter is used to select a registered services that were
registered by a given set of containers with id in idFilter. Only
services exposed by a container with id in idFilter will be returned.
If idFilter is null, all containers are
considered to match the filter.
filter is used to select the registered service whose
properties objects contain keys and values which satisfy the filter. See
Filter for a description of the filter string syntax.
If filter is null, all registered services
are considered to match the filter. If filter cannot be
parsed, an InvalidSyntaxException will be thrown with a human
readable message where the filter became unparsable.
getRemoteServiceReferences in interface IRemoteServiceContainerAdapteridFilter - an array of ID instances that will restrict the search for
matching container ids If null, all remote containers will be
considered in search for matching IRemoteServiceReference
instances. May be null.clazz - the fully qualified name of the interface class that describes
the desired service. Must not be null.filter - The filter criteria. May be null.
null if no services are found that match the search.
org.osgi.framework.InvalidSyntaxException - If filter contains an invalid filter string that cannot be parsed.
public IRemoteServiceReference[] getRemoteServiceReferences(ID target,
java.lang.String clazz,
java.lang.String filter)
throws org.osgi.framework.InvalidSyntaxException,
ContainerConnectException
IRemoteServiceContainerAdapter
Returns an array of IRemoteServiceReference objects. The
returned array of IRemoteServiceReference objects contains
services that were registered under the specified class and match the
specified idFilter, and filter criteria.
The list is valid at the time of the call to this method, however since the Framework is a very dynamic environment, services can be modified or unregistered at anytime.
target is a remote container to connect to.
filter is used to select the registered service whose
properties objects contain keys and values which satisfy the filter. See
Filter for a description of the filter string syntax.
If filter is null, all registered services
are considered to match the filter. If filter cannot be
parsed, an InvalidSyntaxException will be thrown with a human
readable message where the filter became unparsable.
getRemoteServiceReferences in interface IRemoteServiceContainerAdaptertarget - an target to connect to if enclosing container is not already
connected. May be null.clazz - the fully qualified name of the interface class that describes
the desired service. Must not be null.filter - The filter criteria. May be null.
null if no services are found that match the search.
org.osgi.framework.InvalidSyntaxException - If filter contains an invalid filter string that cannot be parsed.
ContainerConnectException
public IRemoteServiceRegistration registerRemoteService(java.lang.String[] clazzes,
java.lang.Object service,
java.util.Dictionary properties)
IRemoteServiceContainerAdapter
registerRemoteService in interface IRemoteServiceContainerAdapterclazzes - the interface classes that the service exposes to remote
clients. Must not be null and must not be an
empty array.service - the service object itself. This object must implement all of
the classes specified by the first parameterproperties - to be associated with service
null .public void removeRemoteServiceListener(IRemoteServiceListener listener)
IRemoteServiceContainerAdapter
removeRemoteServiceListener in interface IRemoteServiceContainerAdapterlistener - to remove. Must not be null .public void setConnectContextForAuthentication(IConnectContext connectContext)
IRemoteServiceContainerAdapterIRemoteServiceContainerAdapter.getRemoteServiceReferences(ID[], String, String) or IRemoteServiceContainerAdapter.asyncGetRemoteServiceReferences(ID[], String, String). This
method should be called with a non-null connectContext in order to allow
authentication to occur during.
setConnectContextForAuthentication in interface IRemoteServiceContainerAdapterconnectContext - the connect context to use for authenticating.
If null, then no authentication will be
attempted.public boolean ungetRemoteService(IRemoteServiceReference reference)
IRemoteServiceContainerAdapterIRemoteServiceContainerAdapter.getRemoteService(IRemoteServiceReference).
If this method returns true, then the previously used IRemoteService will
no longer be usable.
ungetRemoteService in interface IRemoteServiceContainerAdapterreference - the IRemoteServiceReference to unget
IRemoteServiceContainerAdapter.getRemoteService(IRemoteServiceReference)public IContainer getContainer()
IRemoteServiceContainernull.
getContainer in interface IRemoteServiceContainernull.public IRemoteServiceContainerAdapter getContainerAdapter()
IRemoteServiceContainernull
getContainerAdapter in interface IRemoteServiceContainerIRemoteServiceContainer.getContainer().
public IRemoteService getRemoteService(java.lang.String targetLocation,
java.lang.String serviceInterfaceClass,
java.lang.String filter)
throws ContainerConnectException,
org.osgi.framework.InvalidSyntaxException
IRemoteServiceContainer
getRemoteService in interface IRemoteServiceContainertargetLocation - the targetLocation to connect to.
See IRemoteServiceContainerAdapter.getRemoteServiceReferences(org.eclipse.ecf.core.identity.ID, String, String). May be null.serviceInterfaceClass - the service to find. Must not be null.filter - the IRemoteFilter to use for finding the desired remote service.
null if the desired remote service is not available.
ContainerConnectException - thrown if underlying container cannot connect to get remote service.
org.osgi.framework.InvalidSyntaxException - thrown if the filter does not have correct syntax.
public IRemoteService getRemoteService(java.lang.String targetLocation,
java.lang.String serviceInterfaceClass)
throws ContainerConnectException
IRemoteServiceContainer
getRemoteService in interface IRemoteServiceContainertargetLocation - the targetLocation to connect to.
See IRemoteServiceContainerAdapter.getRemoteServiceReferences(org.eclipse.ecf.core.identity.ID, String, String). May be null.serviceInterfaceClass - the service to find. Must not be null.
null if the desired remote service is not available.
ContainerConnectException - thrown if underlying container cannot connect to get remote service.public IRemoteService getRemoteService(java.lang.String serviceInterfaceClass)
IRemoteServiceContainer
getRemoteService in interface IRemoteServiceContainerserviceInterfaceClass - the service to find. Must not be null.
null if the desired remote service is not available.public IRestCall lookupRestCall(IRemoteCall call)
public RestServiceRegistration registerRestService(java.lang.String[] clazzes,
java.lang.Object service,
java.util.Map restCalls,
java.util.Dictionary properties)
throws ECFException
IRestResponseProcessor to get notified about an incoming response.
This method also registers a IRemoteService object for the rest service.
To associate a IRemoteCall to the rest service object the
IRemoteCall.getMethod() will be used. Therefore a Map has to
passed to this method with a String as key and an IRestCall object
as value.
clazzes - a String array woth classnames which the service object has to implement.service - the service object as a POJOrestCalls - a Map with String as keys and IRestCall objects as value.properties - to be associated with service.
IRemoteService.
Will not return null.
ECFException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||