Search in sources :

Example 1 with IContainerFactory

use of org.eclipse.ecf.core.IContainerFactory in project ecf by eclipse.

the class HostContainerFactoryBean method createContainer.

protected IContainer createContainer() throws ContainerCreateException {
    if (containerId == null)
        return super.createBasicContainer();
    IContainerFactory containerFactory = getContainerFactory();
    String containerType = getContainerType();
    return containerFactory.createContainer(containerType, containerId);
}
Also used : IContainerFactory(org.eclipse.ecf.core.IContainerFactory)

Example 2 with IContainerFactory

use of org.eclipse.ecf.core.IContainerFactory in project ecf by eclipse.

the class HelloConsumerApplication method getContainerFactory.

private IContainerFactory getContainerFactory() {
    if (containerFactoryServiceTracker == null) {
        containerFactoryServiceTracker = new ServiceTracker(bundleContext, IContainerFactory.class.getName(), null);
        containerFactoryServiceTracker.open();
    }
    return (IContainerFactory) containerFactoryServiceTracker.getService();
}
Also used : IContainerFactory(org.eclipse.ecf.core.IContainerFactory) ServiceTracker(org.osgi.util.tracker.ServiceTracker)

Example 3 with IContainerFactory

use of org.eclipse.ecf.core.IContainerFactory in project ecf by eclipse.

the class AbstractDatashareApplication method createContainer.

protected void createContainer() throws ECFException {
    // get container factory and create container
    IContainerFactory containerFactory = getContainerManager().getContainerFactory();
    // If the containerId is null, the id is *not* passed to the container
    // factory
    // If it is non-null (i.e. the server), then it's passed to the factory
    container = (containerId == null) ? containerFactory.createContainer(containerType) : containerFactory.createContainer(containerType, new Object[] { containerId });
}
Also used : IContainerFactory(org.eclipse.ecf.core.IContainerFactory)

Example 4 with IContainerFactory

use of org.eclipse.ecf.core.IContainerFactory in project ecf by eclipse.

the class AbstractEventAdminApplication method createConfigureAndConnectContainer.

protected void createConfigureAndConnectContainer() throws ContainerCreateException, SharedObjectAddException, ContainerConnectException {
    // get container factory and create container
    IContainerFactory containerFactory = getContainerManager().getContainerFactory();
    container = (containerId == null) ? containerFactory.createContainer(containerType) : containerFactory.createContainer(containerType, new Object[] { containerId });
    // Get socontainer
    ISharedObjectContainer soContainer = (ISharedObjectContainer) container.getAdapter(ISharedObjectContainer.class);
    // Add to soContainer, with topic as name
    soContainer.getSharedObjectManager().addSharedObject(IDFactory.getDefault().createStringID(DEFAULT_TOPIC), eventAdminImpl, null);
    // then connect to target Id
    if (targetId != null)
        container.connect(IDFactory.getDefault().createID(container.getConnectNamespace(), targetId), null);
}
Also used : IContainerFactory(org.eclipse.ecf.core.IContainerFactory) ISharedObjectContainer(org.eclipse.ecf.core.sharedobject.ISharedObjectContainer)

Example 5 with IContainerFactory

use of org.eclipse.ecf.core.IContainerFactory in project ecf by eclipse.

the class AbstractConsumerContainerSelector method createAndConfigureConsumerContainer.

protected IRemoteServiceContainer createAndConfigureConsumerContainer(String[] remoteSupportedConfigs, Map remoteExportedProperties) throws SelectContainerException {
    if (remoteSupportedConfigs == null || remoteSupportedConfigs.length == 0)
        return null;
    // Get container factory
    IContainerFactory containerFactory = getContainerFactory();
    if (containerFactory == null)
        return null;
    // Get all container type descriptions from factory
    List containerTypeDescriptions = containerFactory.getDescriptions();
    if (containerTypeDescriptions == null)
        return null;
    // Go through all containerTypeDescriptions
    for (Iterator i = containerTypeDescriptions.iterator(); i.hasNext(); ) {
        ContainerTypeDescription desc = (ContainerTypeDescription) i.next();
        // For each one, get the localImportedConfigs for the remote
        // supported configs
        String[] localImportedConfigs = desc.getImportedConfigs(remoteSupportedConfigs);
        // If their are some local imported configs for this description
        if (localImportedConfigs != null) {
            // Then get the imported config properties
            Dictionary importedConfigProperties = desc.getPropertiesForImportedConfigs(localImportedConfigs, PropertiesUtil.createDictionaryFromMap(remoteExportedProperties));
            // Then select a specific local imported config (typically the
            // first on in the array)
            String selectedConfig = selectLocalImportedConfig(localImportedConfigs, importedConfigProperties);
            // If we have one to use, then create the container
            if (selectedConfig != null) {
                IRemoteServiceContainer rsContainer = createContainer(desc, selectedConfig, PropertiesUtil.createMapFromDictionary(importedConfigProperties));
                if (rsContainer != null)
                    return rsContainer;
            }
        }
    }
    return null;
}
Also used : Dictionary(java.util.Dictionary) IRemoteServiceContainer(org.eclipse.ecf.remoteservice.IRemoteServiceContainer) IContainerFactory(org.eclipse.ecf.core.IContainerFactory) ContainerTypeDescription(org.eclipse.ecf.core.ContainerTypeDescription) Iterator(java.util.Iterator) List(java.util.List)

Aggregations

IContainerFactory (org.eclipse.ecf.core.IContainerFactory)7 Dictionary (java.util.Dictionary)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 ContainerCreateException (org.eclipse.ecf.core.ContainerCreateException)1 ContainerTypeDescription (org.eclipse.ecf.core.ContainerTypeDescription)1 IContainer (org.eclipse.ecf.core.IContainer)1 ID (org.eclipse.ecf.core.identity.ID)1 ContainerIntentException (org.eclipse.ecf.core.provider.ContainerIntentException)1 ISharedObjectContainer (org.eclipse.ecf.core.sharedobject.ISharedObjectContainer)1 IRemoteServiceContainer (org.eclipse.ecf.remoteservice.IRemoteServiceContainer)1 ServiceTracker (org.osgi.util.tracker.ServiceTracker)1