Class AbstractRestClientContainer
- java.lang.Object
-
- org.eclipse.ecf.core.AbstractContainer
-
- org.eclipse.ecf.remoteservice.client.AbstractClientContainer
-
- org.eclipse.ecf.remoteservice.rest.client.AbstractRestClientContainer
-
- All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable
,IContainer
,IIdentifiable
,IRemoteServiceClientContainerAdapter
,IRemoteServiceConsumer
,IRemoteServiceContainerAdapter
,IRemoteServiceHost
- Direct Known Subclasses:
RestClientContainer
public abstract class AbstractRestClientContainer extends AbstractClientContainer
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
AbstractRestClientContainer.RestRemoteServiceClientRegistration
-
Field Summary
Fields Modifier and Type Field Description static String
SLASH
-
Fields inherited from class org.eclipse.ecf.remoteservice.client.AbstractClientContainer
alwaysSendDefaultParameters, connectContext, connectedID, connectLock, containerID, parameterSerializer, parameterSerializerLock, registry, remoteResponseDeserializer, remoteResponseDeserializerLock, remoteServiceFactory, remoteServiceListeners
-
-
Constructor Summary
Constructors Constructor Description AbstractRestClientContainer(RestID containerID)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract IRemoteService
createRemoteService(RemoteServiceClientRegistration registration)
Create a remote service for a given remote service registration.protected RemoteServiceClientRegistration
createRestServiceRegistration(String[] clazzes, IRemoteCallable[][] callables, Dictionary properties)
protected RemoteServiceClientRegistration
createRestServiceRegistration(IRemoteCallable[] callables, Dictionary properties)
Namespace
getConnectNamespace()
Get the Namespace for creating a targetID suitable for use as the first parameter in subsequent calls toIContainer.connect(ID, IConnectContext)
.IRemoteServiceReference[]
getRemoteServiceReferences(ID target, String clazz, String filter)
Returns an array ofIRemoteServiceReference
objects.IRemoteServiceReference[]
getRemoteServiceReferences(ID target, ID[] idFilter, String clazz, String filter)
Returns an array ofIRemoteServiceReference
objects.protected String
prepareBaseUri(IRemoteCall call, IRemoteCallable callable)
String
prepareEndpointAddress(IRemoteCall call, IRemoteCallable callable)
Prepare an endpoint address for the given call and callable.protected String
prepareResourcePath(IRemoteCall call, IRemoteCallable callable)
boolean
setRemoteServiceCallPolicy(IRemoteServiceCallPolicy policy)
Set the remote service call policy to enable authorization on remote service method callsprotected String
substituteParameters(String path, Object[] parameters)
protected ID
transformTarget(ID originalTarget, String filter)
-
Methods inherited from class org.eclipse.ecf.remoteservice.client.AbstractClientContainer
addRemoteServiceListener, asyncGetRemoteServiceReferences, asyncGetRemoteServiceReferences, asyncGetRemoteServiceReferences, connect, createRemoteFilter, createUriRequest, disconnect, dispose, getAllRemoteServiceReferences, getConnectContextForAuthentication, getConnectedID, getID, getParameterSerializer, getParameterSerializer, getRemoteCallTargetID, getRemoteService, getRemoteServiceID, getRemoteServiceNamespace, getRemoteServiceReference, getRemoteServiceReferences, getResponseDeserializer, getResponseDeserializer, logException, prepareCallParameters, prepareExtraParameters, prepareParameters, processResponse, registerCallables, registerCallables, registerCallables, registerRemoteService, removeRemoteServiceListener, serializeParameter, serializeParameter, setAlwaysSendDefaultParameters, setConnectContextForAuthentication, setParameterSerializer, setRemoteServiceFactory, setResponseDeserializer, ungetRemoteService
-
Methods inherited from class org.eclipse.ecf.core.AbstractContainer
addListener, fireContainerEvent, getAdapter, getPasswordFromConnectContext, removeListener
-
-
-
-
Field Detail
-
SLASH
public static final String SLASH
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractRestClientContainer
public AbstractRestClientContainer(RestID containerID)
-
-
Method Detail
-
setRemoteServiceCallPolicy
public boolean setRemoteServiceCallPolicy(IRemoteServiceCallPolicy policy)
Description copied from interface:IRemoteServiceContainerAdapter
Set the remote service call policy to enable authorization on remote service method calls- Parameters:
policy
- Implementation ofIRemoteServiceCallPolicy
containing authorization specific code- Returns:
true
if the underlying provider supports using the policy,false
if it does not support using the policy.
-
getConnectNamespace
public Namespace getConnectNamespace()
Description copied from interface:IContainer
Get the Namespace for creating a targetID suitable for use as the first parameter in subsequent calls toIContainer.connect(ID, IConnectContext)
. If this method returnsnull
, then it means thatnull
is expected as a valid parameter in subsequent calls toIContainer.connect(ID, IConnectContext)
. If this method returns a non-null
Namespace, then thetargetID
parameter inIContainer.connect(ID, IConnectContext)
must be non-null
instance created of the returned Namespace.- Returns:
- Namespace the namespace associated with subsequent calls to
IContainer.connect(ID, IConnectContext)
. Ifnull
, then thetargetID
instances passed toIContainer.connect(ID, IConnectContext)
may benull
. If notnull
, thentargetID
instances passed toIContainer.connect(ID, IConnectContext)
must be instances of the returned Namespace.
-
createRemoteService
protected abstract IRemoteService createRemoteService(RemoteServiceClientRegistration registration)
Description copied from class:AbstractClientContainer
Create a remote service for a given remote service registration. This method will be called as part of the RemoteServiceAdmin.importService.- Overrides:
createRemoteService
in classAbstractClientContainer
- Parameters:
registration
- the remote service client registration associated with the service being imported. Will not benull
.
-
getRemoteServiceReferences
public IRemoteServiceReference[] getRemoteServiceReferences(ID target, ID[] idFilter, String clazz, String filter) throws InvalidSyntaxException, ContainerConnectException
Description copied from interface:IRemoteServiceContainerAdapter
Returns an array ofIRemoteServiceReference
objects. The returned array ofIRemoteServiceReference
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.
target
is a remote container to connect to. Ifnull
, no connection attempt is made.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. IfidFilter
isnull
, 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. SeeFilter
for a description of the filter string syntax. Iffilter
isnull
, all registered services are considered to match the filter. Iffilter
cannot be parsed, anInvalidSyntaxException
will be thrown with a human readable message where the filter became unparsable.- Specified by:
getRemoteServiceReferences
in interfaceIRemoteServiceConsumer
- Specified by:
getRemoteServiceReferences
in interfaceIRemoteServiceContainerAdapter
- Overrides:
getRemoteServiceReferences
in classAbstractClientContainer
- Parameters:
target
- a target container to connect to if enclosing container is not already connected. May benull
.idFilter
- 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 benull
.clazz
- the fully qualified name of the interface class that describes the desired service. Must not benull
.filter
- The filter criteria. May benull
.- Returns:
- Array of IRemoteServiceReferences matching given search criteria or
null
if no services are found that match the search. - Throws:
InvalidSyntaxException
- If filter contains an invalid filter string that cannot be parsed.ContainerConnectException
- if container cannot connect
-
getRemoteServiceReferences
public IRemoteServiceReference[] getRemoteServiceReferences(ID target, String clazz, String filter) throws InvalidSyntaxException, ContainerConnectException
Description copied from interface:IRemoteServiceContainerAdapter
Returns an array of
IRemoteServiceReference
objects. The returned array ofIRemoteServiceReference
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. SeeFilter
for a description of the filter string syntax.If
filter
isnull
, all registered services are considered to match the filter. Iffilter
cannot be parsed, anInvalidSyntaxException
will be thrown with a human readable message where the filter became unparsable.- Specified by:
getRemoteServiceReferences
in interfaceIRemoteServiceConsumer
- Specified by:
getRemoteServiceReferences
in interfaceIRemoteServiceContainerAdapter
- Overrides:
getRemoteServiceReferences
in classAbstractClientContainer
- Parameters:
target
- an target to connect to if enclosing container is not already connected. May benull
.clazz
- the fully qualified name of the interface class that describes the desired service. Must not benull
.filter
- The filter criteria. May benull
.- Returns:
- Array of IRemoteServiceReferences matching given search criteria or
null
if no services are found that match the search. - Throws:
InvalidSyntaxException
- If filter contains an invalid filter string that cannot be parsed.ContainerConnectException
- if container cannot connect
-
transformTarget
protected ID transformTarget(ID originalTarget, String filter) throws InvalidSyntaxException
- Throws:
InvalidSyntaxException
-
prepareBaseUri
protected String prepareBaseUri(IRemoteCall call, IRemoteCallable callable)
-
prepareResourcePath
protected String prepareResourcePath(IRemoteCall call, IRemoteCallable callable)
-
prepareEndpointAddress
public String prepareEndpointAddress(IRemoteCall call, IRemoteCallable callable)
Description copied from class:AbstractClientContainer
Prepare an endpoint address for the given call and callable.- Specified by:
prepareEndpointAddress
in classAbstractClientContainer
- Parameters:
call
- to create an endpoint for. Will not benull
.callable
- to create an endpoing for. Will not benull
.- Returns:
- String that represents the endpoing for the given call and callable. May only return
null
if the given call should not be completed (i.e. there is no endpoint associated with the given call).
-
createRestServiceRegistration
protected RemoteServiceClientRegistration createRestServiceRegistration(String[] clazzes, IRemoteCallable[][] callables, Dictionary properties)
- Overrides:
createRestServiceRegistration
in classAbstractClientContainer
-
createRestServiceRegistration
protected RemoteServiceClientRegistration createRestServiceRegistration(IRemoteCallable[] callables, Dictionary properties)
- Overrides:
createRestServiceRegistration
in classAbstractClientContainer
-
-