use of org.eclipse.ecf.core.ContainerTypeDescription 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;
}
use of org.eclipse.ecf.core.ContainerTypeDescription in project ecf by eclipse.
the class AbstractConsumerContainerSelector method matchSupportedConfigs.
protected boolean matchSupportedConfigs(IContainer container, String[] remoteSupportedConfigs) {
if (remoteSupportedConfigs == null)
return false;
ContainerTypeDescription description = getContainerTypeDescription(container);
if (description == null)
return false;
String[] importedConfigs = description.getImportedConfigs(remoteSupportedConfigs);
return (importedConfigs == null || importedConfigs.length == 0) ? false : true;
}
use of org.eclipse.ecf.core.ContainerTypeDescription in project ecf by eclipse.
the class AbstractHostContainerSelector method getContainerTypeDescriptionsForDefaultConfigTypes.
protected ContainerTypeDescription[] getContainerTypeDescriptionsForDefaultConfigTypes(ContainerTypeDescription[] descriptions) {
String[] defaultConfigTypes = getDefaultConfigTypes();
if (defaultConfigTypes == null || defaultConfigTypes.length == 0)
return null;
List results = new ArrayList();
for (int i = 0; i < descriptions.length; i++) {
// For each description, get supported config types
String[] supportedConfigTypes = descriptions[i].getSupportedConfigs();
if (supportedConfigTypes != null && matchDefaultConfigTypes(defaultConfigTypes, supportedConfigTypes))
results.add(descriptions[i]);
}
return (ContainerTypeDescription[]) results.toArray(new ContainerTypeDescription[] {});
}
use of org.eclipse.ecf.core.ContainerTypeDescription in project ecf by eclipse.
the class AbstractRemoteServiceRegisterTest method getServerContainerAdapter.
private IRemoteServiceContainerAdapter getServerContainerAdapter() {
if (this.server != null)
return (IRemoteServiceContainerAdapter) this.server.getAdapter(IRemoteServiceContainerAdapter.class);
IContainer[] containers = getContainerManager().getAllContainers();
String containerType = getServerContainerTypeName();
for (int i = 0; i < containers.length; i++) {
ContainerTypeDescription ctd = getContainerManager().getContainerTypeDescription(containers[i].getID());
if (ctd != null && ctd.getName().equals(containerType))
return (IRemoteServiceContainerAdapter) containers[i].getAdapter(IRemoteServiceContainerAdapter.class);
}
return null;
}
use of org.eclipse.ecf.core.ContainerTypeDescription in project ecf by eclipse.
the class ContainerFactoryServiceCreateTest method testCreateBaseContainer1.
public void testCreateBaseContainer1() throws Exception {
final ContainerTypeDescription desc = getContainerFactoryService().getDescriptionByName(BASE_CONTAINER_TYPE_NAME);
assertNotNull(desc);
final IContainer base = getContainerFactoryService().createContainer(desc, IDFactory.getDefault().createGUID());
assertNotNull(base);
}
Aggregations