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);
}
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();
}
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 });
}
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);
}
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;
}
Aggregations