public abstract class RemoteServiceContainerInstantiator extends BaseContainerInstantiator implements IRemoteServiceContainerInstantiator
| Modifier and Type | Field and Description |
|---|---|
protected static String[] |
defaultSupportedAdapterTypes |
protected static String[] |
defaultSupportedIntents |
protected static Class[][] |
defaultSupportedParameterTypes |
protected List<String> |
exporterConfigs |
protected Map<String,List<String>> |
exporterConfigToImporterConfigs |
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, NO_ADAPTERS_ARRAY| Modifier | Constructor and Description |
|---|---|
protected |
RemoteServiceContainerInstantiator() |
protected |
RemoteServiceContainerInstantiator(List<String> exporterConfigs,
Map<String,List<String>> exporterConfigToImporterConfig) |
protected |
RemoteServiceContainerInstantiator(String exportingProvider,
String importingProvider) |
| Modifier and Type | Method and Description |
|---|---|
protected static String[] |
addSupportedIntent(String intent,
String[] currentSupportedIntents) |
protected boolean |
checkAsyncIntent(ContainerTypeDescription description,
Map<String,?> properties) |
protected void |
checkConfidential(ContainerTypeDescription description,
String uri) |
protected boolean |
checkConfidentialIntent(ContainerTypeDescription description,
String uri,
Map<String,?> properties) |
protected boolean |
checkIntentSupported(ContainerTypeDescription description,
String intent) |
protected void |
checkOSGIIntents(ContainerTypeDescription description,
URI uri,
Map<String,?> properties) |
protected void |
checkPrivate(ContainerTypeDescription description,
String hostname) |
protected boolean |
checkPrivateIntent(ContainerTypeDescription description,
String hostname,
Map<String,?> properties) |
abstract IContainer |
createInstance(ContainerTypeDescription description,
Map<String,?> parameters) |
IContainer |
createInstance(ContainerTypeDescription description,
Object[] parameters)
Create instance of IContainer.
|
String[] |
getImportedConfigs(ContainerTypeDescription description,
String[] exporterSupportedConfigs)
Get the imported config types for a given ContainerTypeDescription for the given exporter supported config types.
|
Dictionary |
getPropertiesForImportedConfigs(ContainerTypeDescription description,
String[] importedConfigs,
Dictionary exportedProperties)
Get the properties associated with the given description, with the given importedConfigTypes, via the given exportedProperties.
|
protected List<String> |
getServiceIntents(Map<String,?> properties) |
String[] |
getSupportedAdapterTypes(ContainerTypeDescription description)
Get array of supported adapters for the given container type description.
|
String[] |
getSupportedConfigs(ContainerTypeDescription description)
Get supported configs for the given ContainerTypeDescription.
|
String[] |
getSupportedIntents(ContainerTypeDescription description)
Get supported intents for the given ContainerTypeDescription.
|
Class[][] |
getSupportedParameterTypes(ContainerTypeDescription description)
Get array of parameter types for given container type description.
|
protected static String[] |
removeSupportedIntent(String intent,
String[] currentSupportedIntents) |
protected boolean |
supportsOSGIAsyncIntent(ContainerTypeDescription description) |
protected boolean |
supportsOSGIConfidentialIntent(ContainerTypeDescription description) |
protected boolean |
supportsOSGIPrivateIntent(ContainerTypeDescription description) |
protected IContainer |
throwCreateException(String message,
Throwable cause) |
getAdaptersForClass, getIDParameterValue, getIDParameterValue, getIDParameterValue, getIntegerFromArg, getInterfacesAndAdaptersForClass, getInterfacesForClass, getInterfacesForClass, getMap, getMapParameterString, getMapParameterString, getParameterValue, getParameterValue, getParameterValue, getParameterValue, getParameterValue, getStringFromArgprotected static final String[] defaultSupportedAdapterTypes
protected static final Class[][] defaultSupportedParameterTypes
protected static final String[] defaultSupportedIntents
protected RemoteServiceContainerInstantiator(String exportingProvider, String importingProvider)
exportingProvider - exporting provider (e.g. server or service host)importingProvider - importing provider (e.g. client or service client)protected RemoteServiceContainerInstantiator(List<String> exporterConfigs, Map<String,List<String>> exporterConfigToImporterConfig)
protected RemoteServiceContainerInstantiator()
public String[] getSupportedAdapterTypes(ContainerTypeDescription description)
IContainerInstantiatorIContainer.getAdapter(Class) with the same type name as a
returned value will return a non-null result. In other
words, even if the class name is in the returned array, subsequent calls
to IContainer.getAdapter(Class) may still return
null.getSupportedAdapterTypes in interface IContainerInstantiatorgetSupportedAdapterTypes in class BaseContainerInstantiatordescription - the ContainerTypeDescription to report adapters for. Must not
be null.null may be returned by
the provider if no adapters are supported for this description.public Class[][] getSupportedParameterTypes(ContainerTypeDescription description)
IContainerInstantiatorIContainerInstantiator.createInstance(ContainerTypeDescription, Object[]).
Each of the rows of the returned array specifies a Class[] of parameter
types. These parameter types correspond to the types of Object[] that can
be passed into the second parameter of
IContainerInstantiator.createInstance(ContainerTypeDescription, Object[]).
Consider the following example:
public Class[][] getSupportedParameterTypes() {
return new Class[][] { { String.class }, { String.class, String.class } };
}
The above means that there are two acceptable values for the Object []
passed into IContainerInstantiator.createInstance(ContainerTypeDescription, Object[]):
1) a single String, and 2) two Strings. These would therefore be
acceptable as input to createInstance:
IContainer container = ContainerFactory.getDefault().createContainer(
description, new Object[] { "Hello" });
IContainer container2 = ContainerFactory.getDefault().createContainer(
description, new Object[] { "Hello" });
getSupportedParameterTypes in interface IContainerInstantiatorgetSupportedParameterTypes in class BaseContainerInstantiatordescription - the ContainerTypeDescription to return parameter types forIContainerInstantiator.createInstance(ContainerTypeDescription, Object[]).
null returned if no parameter types supported for
given description.public String[] getSupportedConfigs(ContainerTypeDescription description)
IRemoteServiceContainerInstantiatorgetSupportedConfigs in interface IRemoteServiceContainerInstantiatordescription - the ContainerTypeDescription to return the supported configs for.
Will not be null.null may be returned if the
given description does not support any config types.public String[] getImportedConfigs(ContainerTypeDescription description, String[] exporterSupportedConfigs)
IRemoteServiceContainerInstantiatorGet the imported config types for a given ContainerTypeDescription for the given exporter supported config types. This method will be called to determine what the local container imported configs are for the given description and exporterSupportedConfigTypes. The local provider can decide which (if any) imported config types should be returned and return them.
As an example, consider the config types for the ECF generic provider. A generic server has a config type
of 'ecf.generic.server', and the client has 'ecf.generic.server'. If the generic server exports a given
service, the exportersSupportedConfigTypes will be '[ecf.generic.server]'. When this method is called
with the ecf.generic.client description (i.e. the container type description named 'ecf.generic.client'), it
should respond with a non-null, non-empty array...e.g.: [ecf.generic.client]. This indicates that the
ecf.generic.client can serve as an importer for the given exporter config type. All, other descriptions
should return null, to indicate that they cannot import a remote service exported by the given
exporterSupportedConfigTypes.
getImportedConfigs in interface IRemoteServiceContainerInstantiatordescription - the container type description under consideration.exporterSupportedConfigs - the exporter supported config types under consideration.null, unless
one or more of the exporterSupportedConfigTypes is recognized for the given description.public Dictionary getPropertiesForImportedConfigs(ContainerTypeDescription description, String[] importedConfigs, Dictionary exportedProperties)
IRemoteServiceContainerInstantiatorgetPropertiesForImportedConfigs in interface IRemoteServiceContainerInstantiatordescription - the container type description under consideration.importedConfigs - the imported config types for the given properties. Will not be null, and
should be the same values as returned from IRemoteServiceContainerInstantiator.getImportedConfigs(ContainerTypeDescription, String[]).exportedProperties - the properties from the exported service. Will not be null.null if
no properties are associated with the given description, importedConfigTypes, exportedProperties.public abstract IContainer createInstance(ContainerTypeDescription description, Map<String,?> parameters) throws ContainerCreateException
ContainerCreateExceptionpublic IContainer createInstance(ContainerTypeDescription description, Object[] parameters) throws ContainerCreateException
IContainerInstantiatorContainerFactory.getDefault().createContainer("foocontainer",new Object { "hello" });
createInstance in interface IContainerInstantiatorcreateInstance in class BaseContainerInstantiatordescription - the ContainerTypeDescription associated with the registered
container provider implementationparameters - parameters specified by the caller. May be null if no
parameters are passed in by caller to
ContainerFactory.getDefault().createContainer(...)ContainerCreateException - thrown if instance cannot be createdprotected IContainer throwCreateException(String message, Throwable cause) throws ContainerCreateException
ContainerCreateExceptionprotected boolean supportsOSGIConfidentialIntent(ContainerTypeDescription description)
protected boolean supportsOSGIPrivateIntent(ContainerTypeDescription description)
protected boolean supportsOSGIAsyncIntent(ContainerTypeDescription description)
public String[] getSupportedIntents(ContainerTypeDescription description)
IRemoteServiceContainerInstantiatorgetSupportedIntents in interface IContainerInstantiatorgetSupportedIntents in interface IRemoteServiceContainerInstantiatorgetSupportedIntents in class BaseContainerInstantiatordescription - the ContainerTypeDescription to return the supported intents for.
Will not be null.null may be returned if the
given description does not support any intents.protected static String[] addSupportedIntent(String intent, String[] currentSupportedIntents)
protected static String[] removeSupportedIntent(String intent, String[] currentSupportedIntents)
protected void checkPrivate(ContainerTypeDescription description, String hostname) throws ContainerIntentException
ContainerIntentExceptionprotected boolean checkIntentSupported(ContainerTypeDescription description, String intent)
protected boolean checkAsyncIntent(ContainerTypeDescription description, Map<String,?> properties) throws ContainerIntentException
ContainerIntentExceptionprotected boolean checkPrivateIntent(ContainerTypeDescription description, String hostname, Map<String,?> properties) throws ContainerIntentException
ContainerIntentExceptionprotected boolean checkConfidentialIntent(ContainerTypeDescription description, String uri, Map<String,?> properties) throws ContainerIntentException
ContainerIntentExceptionprotected void checkConfidential(ContainerTypeDescription description, String uri) throws ContainerIntentException
ContainerIntentExceptionprotected void checkOSGIIntents(ContainerTypeDescription description, URI uri, Map<String,?> properties) throws ContainerIntentException
ContainerIntentExceptionCopyright © 2004–2020 Eclipse Foundation. All rights reserved.