Class GenericContainerInstantiator

    • Constructor Detail

      • GenericContainerInstantiator

        public GenericContainerInstantiator()
    • Method Detail

      • getIntegerFromArg

        protected Integer getIntegerFromArg​(Object arg)
      • createInstance

        public IContainer createInstance​(ContainerTypeDescription description,
                                         Object[] args)
                                  throws ContainerCreateException
        Description copied from interface: IContainerInstantiator
        Create 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:
        createInstance in 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
      • getAdaptersForClass

        protected Set getAdaptersForClass​(Class clazz)
      • getInterfacesForClass

        protected Set getInterfacesForClass​(Set s,
                                            Class clazz)
      • getInterfacesForClass

        protected Set getInterfacesForClass​(Class clazz)
      • getInterfacesAndAdaptersForClass

        protected String[] getInterfacesAndAdaptersForClass​(Class clazz)
      • getSupportedAdapterTypes

        public String[] getSupportedAdapterTypes​(ContainerTypeDescription description)
        Description copied from interface: IContainerInstantiator
        Get 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 to IContainer.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.
        Specified by:
        getSupportedAdapterTypes in 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. null may be returned by the provider if no adapters are supported for this description.
      • getSupportedIntents

        public String[] getSupportedIntents​(ContainerTypeDescription description)
        Description copied from interface: IRemoteServiceContainerInstantiator
        Get 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:
        getSupportedIntents in interface IContainerInstantiator
        Specified by:
        getSupportedIntents in interface IRemoteServiceContainerInstantiator
        Parameters:
        description - the ContainerTypeDescription to return the supported intents for. Will not be null.
        Returns:
        String[] the supported intents. null may be returned if the given description does not support any intents.
      • getSupportedConfigs

        public String[] getSupportedConfigs​(ContainerTypeDescription description)
        Description copied from interface: IRemoteServiceContainerInstantiator
        Get 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:
        getSupportedConfigs in interface IRemoteServiceContainerInstantiator
        Parameters:
        description - the ContainerTypeDescription to return the supported configs for. Will not be null.
        Returns:
        String[] the supported config types. null may be returned if the given description does not support any config types.
        Since:
        3.0
      • getImportedConfigs

        public String[] getImportedConfigs​(ContainerTypeDescription description,
                                           String[] exporterSupportedConfigs)
        Description copied from interface: IRemoteServiceContainerInstantiator

        Get 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:
        getImportedConfigs in 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