use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.
the class AbstractConsumerContainerSelector method createContainer.
/**
* @param containerTypeDescription containerTypeDescription
* @param containerTypeDescriptionName containerTypeDescriptionName
* @param properties properties
* @return IRemoteServiceContainer created container. Should not be <code>null</code>
* @throws SelectContainerException thrown if container cannot be created or configured
* @since 2.0
*/
protected IRemoteServiceContainer createContainer(ContainerTypeDescription containerTypeDescription, String containerTypeDescriptionName, Map properties) throws SelectContainerException {
try {
IContainer container = (properties == null) ? getContainerFactory().createContainer(containerTypeDescriptionName) : getContainerFactory().createContainer(containerTypeDescriptionName, properties);
IRemoteServiceContainerAdapter adapter = (IRemoteServiceContainerAdapter) container.getAdapter(IRemoteServiceContainerAdapter.class);
if (adapter == null)
throw new SelectContainerException("Container config id=" + containerTypeDescriptionName + " does not implement IRemoteServiceContainerAdapter", null, // $NON-NLS-1$ //$NON-NLS-2$
containerTypeDescription);
return new RemoteServiceContainer(container);
} catch (ContainerCreateException e) {
String message = // $NON-NLS-1$
"Cannot create container config id=" + containerTypeDescriptionName;
logException(message, e);
throw new SelectContainerException(message, e, containerTypeDescription);
}
}
use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.
the class AbstractHostContainerSelector method createRSContainer.
/**
* @param serviceReference serviceReference
* @param properties properties
* @param containerTypeDescription container type description
* @return IRemoteServiceContainer created remote service container
* @throws SelectContainerException if could not be created
* @since 4.6
*/
protected IRemoteServiceContainer createRSContainer(ServiceReference serviceReference, Map<String, Object> properties, ContainerTypeDescription containerTypeDescription, String[] intents) throws SelectContainerException {
trace(// $NON-NLS-1$
"createRSContainer", // $NON-NLS-1$ //$NON-NLS-2$
"Creating container instance for ref=" + serviceReference + ";properties=" + properties + ";description=" + containerTypeDescription.getName() + // $NON-NLS-1$ //$NON-NLS-2$
";intents=" + // $NON-NLS-1$
((intents == null) ? "" : Arrays.asList(intents).toString()));
IContainer container = createContainer(serviceReference, properties, containerTypeDescription, intents);
if (container == null)
return null;
IRemoteServiceContainerAdapter adapter = (IRemoteServiceContainerAdapter) container.getAdapter(IRemoteServiceContainerAdapter.class);
if (adapter == null)
throw new SelectContainerException("Container does not implement IRemoteServiceContainerAdapter", null, // $NON-NLS-1$
containerTypeDescription);
return new RemoteServiceContainer(container, adapter);
}
use of org.eclipse.ecf.core.IContainer 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.IContainer in project ecf by eclipse.
the class AbstractConnectTest method testConnectOneClient.
public void testConnectOneClient() throws Exception {
final int clientIndex = 0;
final IContainer client = getClient(clientIndex);
assertNull(client.getConnectedID());
final ID serverConnectID = getServerConnectID(clientIndex);
assertNotNull(serverConnectID);
connectClient(client, serverConnectID, getConnectContext(clientIndex));
assertEquals(serverConnectID, client.getConnectedID());
sleep(SLEEPTIME);
client.disconnect();
assertNull(client.getConnectedID());
}
use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.
the class DiscoveryServiceTest method setUp.
/* (non-Javadoc)
* @see org.eclipse.ecf.tests.discovery.AbstractDiscoveryTest#setUp()
*/
protected void setUp() throws Exception {
super.setUp();
final IContainer adapter = (IContainer) getDiscoveryLocator().getAdapter(IContainer.class);
final Set set = new HashSet();
set.add(adapter.getID());
idsToExpect = Collections.unmodifiableSet(set);
discoveryLocator.purgeCache();
}
Aggregations