Class GenericContainerInstantiator
- java.lang.Object
- 
- org.eclipse.ecf.provider.generic.GenericContainerInstantiator
 
- 
- All Implemented Interfaces:
- IContainerInstantiator,- IRemoteServiceContainerInstantiator
 
 public class GenericContainerInstantiator extends Object implements IContainerInstantiator, IRemoteServiceContainerInstantiator 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description protected classGenericContainerInstantiator.GenericContainerArgs
 - 
Field SummaryFields Modifier and Type Field Description protected static String[]genericProviderIntentsstatic StringTCPCLIENT_NAMEstatic StringTCPSERVER_NAME
 - 
Constructor SummaryConstructors Constructor Description GenericContainerInstantiator()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected IContainercreateClientContainer(GenericContainerInstantiator.GenericContainerArgs gcargs)IContainercreateInstance(ContainerTypeDescription description, Object[] args)Create instance of IContainer.protected IContainercreateServerContainer(GenericContainerInstantiator.GenericContainerArgs gcargs)protected SetgetAdaptersForClass(Class clazz)protected GenericContainerInstantiator.GenericContainerArgsgetClientArgs(Object[] args)protected IDgetIDFromArg(Object arg)String[]getImportedConfigs(ContainerTypeDescription description, String[] exporterSupportedConfigs)Get the imported config types for a given ContainerTypeDescription for the given exporter supported config types.protected IntegergetIntegerFromArg(Object arg)protected String[]getInterfacesAndAdaptersForClass(Class clazz)protected SetgetInterfacesForClass(Class clazz)protected SetgetInterfacesForClass(Set s, Class clazz)DictionarygetPropertiesForImportedConfigs(ContainerTypeDescription description, String[] importedConfigs, Dictionary exportedProperties)Get the properties associated with the given description, with the given importedConfigTypes, via the given exportedProperties.protected GenericContainerInstantiator.GenericContainerArgsgetServerArgs(Object[] args)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 booleanisClient(ContainerTypeDescription description)
 
- 
- 
- 
Field Detail- 
genericProviderIntentsprotected static final String[] genericProviderIntents - Since:
- 2.0
 
 - 
TCPCLIENT_NAMEpublic static final String TCPCLIENT_NAME - See Also:
- Constant Field Values
 
 - 
TCPSERVER_NAMEpublic static final String TCPSERVER_NAME - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
getIDFromArgprotected ID getIDFromArg(Object arg) throws IDCreateException - Throws:
- IDCreateException
 
 - 
getClientArgsprotected GenericContainerInstantiator.GenericContainerArgs getClientArgs(Object[] args) throws IDCreateException - Parameters:
- args- arguments
- Returns:
- GenericContainerArgs the client args created
- Throws:
- IDCreateException- if the client args cannot be retrieved from given args
- Since:
- 3.0
 
 - 
isClientprotected boolean isClient(ContainerTypeDescription description) 
 - 
getServerArgsprotected GenericContainerInstantiator.GenericContainerArgs getServerArgs(Object[] args) throws IDCreateException, ContainerIntentException - Parameters:
- args- arguments
- Returns:
- GenericContainerArgs the server args created
- Throws:
- IDCreateException- if the server args cannot be retrieved from given args
- ContainerIntentException
- Since:
- 3.0
 
 - 
createClientContainerprotected IContainer createClientContainer(GenericContainerInstantiator.GenericContainerArgs gcargs) throws Exception - Parameters:
- gcargs- the generic container args
- Returns:
- IContainer the created container
- Throws:
- Exception- if something goes wrong
- Since:
- 4.5
 
 - 
createServerContainerprotected IContainer createServerContainer(GenericContainerInstantiator.GenericContainerArgs gcargs) throws Exception - Parameters:
- gcargs- the generic container args
- Returns:
- IContainer the created container
- Throws:
- Exception- if something goes wrong
- Since:
- 4.5
 
 - 
createInstancepublic IContainer createInstance(ContainerTypeDescription description, Object[] args) throws ContainerCreateException Description copied from interface:IContainerInstantiatorCreate instance of IContainer. This is the interface that container provider implementations must implement for the containerFactory extension point. The caller may optionally specify both argument types and arguments that will be passed into this method (and therefore to the provider implementation implementing this method). For example:ContainerFactory.getDefault().createContainer("foocontainer",new Object { "hello" }); - Specified by:
- createInstancein interface- IContainerInstantiator
- Parameters:
- description- the ContainerTypeDescription associated with the registered container provider implementation
- args- parameters specified by the caller. May be null if no parameters are passed in by caller to ContainerFactory.getDefault().createContainer(...)
- Returns:
- IContainer instance. The provider implementation must return a valid object implementing IContainer OR throw a ContainerCreateException. Null will not be returned.
- Throws:
- ContainerCreateException- thrown if instance cannot be created
 
 - 
getSupportedAdapterTypespublic String[] getSupportedAdapterTypes(ContainerTypeDescription description) Description copied from interface:IContainerInstantiatorGet array of supported adapters for the given container type description. Providers implement this method to allow clients to inspect the adapter types exposed by the container described by the given description. The returned array entries will be the fully qualified names of the adapter classes. Note that the returned types do not guarantee that a subsequent call toIContainer.getAdapter(Class)with the same type name as a returned value will return a non-nullresult. In other words, even if the class name is in the returned array, subsequent calls toIContainer.getAdapter(Class)may still returnnull.- Specified by:
- getSupportedAdapterTypesin interface- IContainerInstantiator
- Parameters:
- description- the ContainerTypeDescription to report adapters for. Must not be- null.
- Returns:
- String[] of supported adapters. The entries in the returned array
         will be the fully qualified class names of adapters supported by
         the given description. nullmay be returned by the provider if no adapters are supported for this description.
 
 - 
getSupportedParameterTypespublic Class[][] getSupportedParameterTypes(ContainerTypeDescription description) Description copied from interface:IContainerInstantiatorGet array of parameter types for given container type description. Providers implement this method to allow clients to inspect the available set of parameter types understood for calls toIContainerInstantiator.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 intoIContainerInstantiator.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" });- Specified by:
- getSupportedParameterTypesin interface- IContainerInstantiator
- Parameters:
- description- the ContainerTypeDescription to return parameter types for
- Returns:
- Class[][] array of Class[]s. Each row in the table corresponds to
         a Class[] that describes the types of Objects in Object[] for
         second parameter to
         IContainerInstantiator.createInstance(ContainerTypeDescription, Object[]).nullreturned if no parameter types supported for given description.
- Since:
- 2.0
- See Also:
- IContainerInstantiator.getSupportedParameterTypes(org.eclipse.ecf.core.ContainerTypeDescription)
 
 - 
getSupportedIntentspublic String[] getSupportedIntents(ContainerTypeDescription description) Description copied from interface:IRemoteServiceContainerInstantiatorGet supported intents for the given ContainerTypeDescription. This method will be called to determine what the OSGi remote service supported intents are for the given description during the search for the service exporter provider/containers upon remote service registration.- Specified by:
- getSupportedIntentsin interface- IContainerInstantiator
- Specified by:
- getSupportedIntentsin interface- IRemoteServiceContainerInstantiator
- Parameters:
- description- the ContainerTypeDescription to return the supported intents for. Will not be- null.
- Returns:
- String[] the supported intents.  nullmay be returned if the given description does not support any intents.
 
 - 
getSupportedConfigspublic String[] getSupportedConfigs(ContainerTypeDescription description) Description copied from interface:IRemoteServiceContainerInstantiatorGet supported configs for the given ContainerTypeDescription. This method will be called to determine what the OSGi remote service supported config types are for the given description during the search for the service exporter provider/containers upon remote service registration.- Specified by:
- getSupportedConfigsin interface- IRemoteServiceContainerInstantiator
- Parameters:
- description- the ContainerTypeDescription to return the supported configs for. Will not be- null.
- Returns:
- String[] the supported config types.  nullmay be returned if the given description does not support any config types.
- Since:
- 3.0
 
 - 
getImportedConfigspublic String[] getImportedConfigs(ContainerTypeDescription description, String[] exporterSupportedConfigs) Description copied from interface: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.- Specified by:
- getImportedConfigsin interface- IRemoteServiceContainerInstantiator
- Parameters:
- description- the container type description under consideration.
- exporterSupportedConfigs- the exporter supported config types under consideration.
- Returns:
- String[] indicating the importer's supported config types.  Should be null, unless one or more of the exporterSupportedConfigTypes is recognized for the given description.
- Since:
- 3.0
 
 - 
getPropertiesForImportedConfigspublic Dictionary getPropertiesForImportedConfigs(ContainerTypeDescription description, String[] importedConfigs, Dictionary exportedProperties) Description copied from interface:IRemoteServiceContainerInstantiatorGet the properties associated with the given description, with the given importedConfigTypes, via the given exportedProperties.- Specified by:
- getPropertiesForImportedConfigsin interface- IRemoteServiceContainerInstantiator
- Parameters:
- description- 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.
- Returns:
- Dictionary that has all of the properties for the importedConfigTypes.  May be nullif no properties are associated with the given description, importedConfigTypes, exportedProperties.
- Since:
- 3.0
 
 
- 
 
-