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