Search in sources :

Example 56 with IContainer

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

the class RemoteServiceHandlerUtil method getContainerWithConnectID.

// TODO push this functionality down into the ContainerManager
private static IContainer getContainerWithConnectID(ID aConnectedID) {
    final IContainerManager containerManager = Activator.getDefault().getContainerManager();
    final IContainer[] containers = containerManager.getAllContainers();
    if (containers == null) {
        return null;
    }
    for (int i = 0; i < containers.length; i++) {
        ID connectedId = containers[i].getConnectedID();
        if (connectedId != null && connectedId.equals(aConnectedID)) {
            return containers[i];
        }
    }
    return null;
}
Also used : IContainerManager(org.eclipse.ecf.core.IContainerManager) ID(org.eclipse.ecf.core.identity.ID) IContainer(org.eclipse.ecf.core.IContainer)

Example 57 with IContainer

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

the class RemoteServiceHandlerUtil method getActiveIRemoteServiceContainerChecked.

public static IContainer getActiveIRemoteServiceContainerChecked(ExecutionEvent event) throws ExecutionException {
    final IServiceInfo serviceInfo = DiscoveryHandlerUtil.getActiveIServiceInfoChecked(event);
    final ID createConnectId = getActiveConnectIDChecked(event);
    final IContainer container = getContainerWithConnectID(createConnectId);
    if (container != null) {
        return container;
    }
    // TODO remove parameters once
    // https://bugs.eclipse.org/bugs/show_bug.cgi?id=256586 is fixed
    final Object[] parameters = new Object[] { createConnectId };
    try {
        // new one
        return ContainerFactory.getDefault().createContainer(getContainerFactory(serviceInfo), parameters);
    } catch (ContainerCreateException e) {
        throw new ExecutionException(e.getMessage(), e);
    }
}
Also used : IServiceInfo(org.eclipse.ecf.discovery.IServiceInfo) ContainerCreateException(org.eclipse.ecf.core.ContainerCreateException) ID(org.eclipse.ecf.core.identity.ID) IContainer(org.eclipse.ecf.core.IContainer) ExecutionException(org.eclipse.core.commands.ExecutionException)

Example 58 with IContainer

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

the class RemoteServiceHandlerUtil method getActiveIRemoteServiceContainerAdapterChecked.

public static IRemoteServiceContainerAdapter getActiveIRemoteServiceContainerAdapterChecked(ExecutionEvent event) throws ExecutionException {
    final ID activeConnectId = getActiveConnectIDChecked(event);
    final IContainer container = getContainerWithConnectID(activeConnectId);
    if (container == null) {
        return null;
    }
    final IRemoteServiceContainerAdapter adapter = (IRemoteServiceContainerAdapter) container.getAdapter(IRemoteServiceContainerAdapter.class);
    return adapter;
}
Also used : IRemoteServiceContainerAdapter(org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter) ID(org.eclipse.ecf.core.identity.ID) IContainer(org.eclipse.ecf.core.IContainer)

Example 59 with IContainer

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

the class SCPOutgoingTest method setUp.

protected void setUp() throws Exception {
    super.setUp();
    final IContainer container = ContainerFactory.getDefault().createContainer();
    adapter = (ISendFileTransferContainerAdapter) container.getAdapter(ISendFileTransferContainerAdapter.class);
    // $NON-NLS-1$
    senderTransferListener = getFileTransferListener("localhost");
    // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
    String targetURL = "scp://" + username + "@" + host + (targetSendFile.startsWith("/") ? "" : "/") + targetSendFile;
    targetID = FileIDFactory.getDefault().createFileID(adapter.getOutgoingNamespace(), new URL(targetURL));
    adapter.setConnectContextForAuthentication(ConnectContextFactory.createPasswordConnectContext(password));
}
Also used : IContainer(org.eclipse.ecf.core.IContainer) URL(java.net.URL)

Example 60 with IContainer

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

the class AbstractChatRoomSOAddTest method testAddTwoSharedObjects.

public void testAddTwoSharedObjects() throws Exception {
    if (chatRoomContainer[0] == null)
        return;
    final IContainer client0Container = chatRoomContainer[0];
    assertNotNull(client0Container);
    final ISharedObjectContainer socontainer = (ISharedObjectContainer) client0Container.getAdapter(ISharedObjectContainer.class);
    final ISharedObjectManager manager = socontainer.getSharedObjectManager();
    assertNotNull(manager);
    final ID objectID0 = createSharedObjectID();
    final ID id0 = manager.addSharedObject(objectID0, createSharedObject(objectID0), null);
    assertNotNull(id0);
    final ID objectID1 = createSharedObjectID();
    final ID id1 = manager.addSharedObject(objectID1, createSharedObject(objectID1), null);
    assertNotNull(id1);
    final ISharedObject sharedObject0 = manager.getSharedObject(id0);
    assertNotNull(sharedObject0);
    final ISharedObject sharedObject1 = manager.getSharedObject(id1);
    assertNotNull(sharedObject1);
    sleep(5000);
}
Also used : ISharedObjectContainer(org.eclipse.ecf.core.sharedobject.ISharedObjectContainer) ISharedObjectManager(org.eclipse.ecf.core.sharedobject.ISharedObjectManager) ID(org.eclipse.ecf.core.identity.ID) ISharedObject(org.eclipse.ecf.core.sharedobject.ISharedObject) IContainer(org.eclipse.ecf.core.IContainer)

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