Search in sources :

Example 91 with IContainer

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);
    }
}
Also used : RemoteServiceContainer(org.eclipse.ecf.remoteservice.RemoteServiceContainer) IRemoteServiceContainer(org.eclipse.ecf.remoteservice.IRemoteServiceContainer) IRemoteServiceContainerAdapter(org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter) ContainerCreateException(org.eclipse.ecf.core.ContainerCreateException) IContainer(org.eclipse.ecf.core.IContainer)

Example 92 with IContainer

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);
}
Also used : RemoteServiceContainer(org.eclipse.ecf.remoteservice.RemoteServiceContainer) IRemoteServiceContainer(org.eclipse.ecf.remoteservice.IRemoteServiceContainer) IRemoteServiceContainerAdapter(org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter) IContainer(org.eclipse.ecf.core.IContainer)

Example 93 with IContainer

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;
}
Also used : ContainerTypeDescription(org.eclipse.ecf.core.ContainerTypeDescription) IContainer(org.eclipse.ecf.core.IContainer)

Example 94 with IContainer

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());
}
Also used : ID(org.eclipse.ecf.core.identity.ID) IContainer(org.eclipse.ecf.core.IContainer)

Example 95 with IContainer

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();
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) IContainer(org.eclipse.ecf.core.IContainer) HashSet(java.util.HashSet)

Aggregations

IContainer (org.eclipse.ecf.core.IContainer)121 ID (org.eclipse.ecf.core.identity.ID)29 ContainerTypeDescription (org.eclipse.ecf.core.ContainerTypeDescription)20 IRosterEntry (org.eclipse.ecf.presence.roster.IRosterEntry)9 IRoster (org.eclipse.ecf.presence.roster.IRoster)8 IChannelContainerAdapter (org.eclipse.ecf.datashare.IChannelContainerAdapter)7 IRemoteServiceContainer (org.eclipse.ecf.remoteservice.IRemoteServiceContainer)7 IRemoteServiceContainerAdapter (org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter)7 ISharedObjectContainer (org.eclipse.ecf.core.sharedobject.ISharedObjectContainer)5 IPresenceContainerAdapter (org.eclipse.ecf.presence.IPresenceContainerAdapter)5 RemoteServiceContainer (org.eclipse.ecf.remoteservice.RemoteServiceContainer)5 Action (org.eclipse.jface.action.Action)5 IAction (org.eclipse.jface.action.IAction)5 URL (java.net.URL)4 Job (org.eclipse.core.runtime.jobs.Job)4 ContainerConnectException (org.eclipse.ecf.core.ContainerConnectException)4 IContainerManager (org.eclipse.ecf.core.IContainerManager)4 ISharedObject (org.eclipse.ecf.core.sharedobject.ISharedObject)4 ISharedObjectManager (org.eclipse.ecf.core.sharedobject.ISharedObjectManager)4 RestClientContainer (org.eclipse.ecf.remoteservice.rest.client.RestClientContainer)4