use of org.eclipse.ecf.core.identity.ID in project ecf by eclipse.
the class SimpleConcatClient method start.
public void start(int port) throws Exception {
IContainer client = ContainerFactory.getDefault().createContainer(CLIENT_TYPE);
// Get adapter for accessing remote services
IRemoteServiceContainerAdapter adapter = (IRemoteServiceContainerAdapter) client.getAdapter(IRemoteServiceContainerAdapter.class);
rsContainer = new RemoteServiceContainer(client, adapter);
System.out.println("Client created with ID=" + client.getID());
ID connectTargetID = IDFactory.getDefault().createStringID(NLS.bind(SERVER_ID, new Integer(port)));
System.out.println("Attempting connect to id=" + connectTargetID);
client.connect(connectTargetID, null);
System.out.println("Client connected to connectTargetID=" + connectTargetID);
Thread.sleep(1000);
// Get remote service reference
IRemoteServiceReference[] refs = adapter.getRemoteServiceReferences((ID[]) null, IConcatService.class.getName(), null);
rsReference = refs[0];
System.out.println("Remote service with ref=" + refs[0]);
}
use of org.eclipse.ecf.core.identity.ID in project ecf by eclipse.
the class AddSharedObjectTest method testAddSharedObject.
public void testAddSharedObject() throws Exception {
final ISharedObjectManager manager = getClientSOManager(0);
assertNotNull(manager);
final ID id = manager.addSharedObject(IDFactory.getDefault().createStringID("foo"), new TestSharedObject(TEST_USERNAME0), null);
assertNotNull(id);
final ISharedObject sharedObject = manager.getSharedObject(id);
assertNotNull(sharedObject);
sleep(1000);
}
use of org.eclipse.ecf.core.identity.ID in project ecf by eclipse.
the class ConnectRemoteServicehandler method getJob.
protected Job getJob(final ExecutionEvent event) throws ExecutionException {
final ID createConnectId = RemoteServiceHandlerUtil.getActiveConnectIDChecked(event);
final IContainer container = RemoteServiceHandlerUtil.getActiveIRemoteServiceContainerChecked(event);
// decouple the long running connect call from the ui thread
return new // $NON-NLS-1$
Job(// $NON-NLS-1$
NLS.bind("Connecting {0}", createConnectId.getName())) {
protected IStatus run(IProgressMonitor monitor) {
try {
if (container != null)
container.connect(createConnectId, null);
} catch (ContainerConnectException e) {
showException(e);
return Status.CANCEL_STATUS;
}
return Status.OK_STATUS;
}
};
}
use of org.eclipse.ecf.core.identity.ID in project ecf by eclipse.
the class DisonnectRemoteServicehandler method getJob.
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ecf.internal.remoteservices.ui.handlers.ConnectionHandler
* #getJob()
*/
protected Job getJob(final ExecutionEvent event) throws ExecutionException {
final ID createConnectId = RemoteServiceHandlerUtil.getActiveConnectIDChecked(event);
final IContainer container = RemoteServiceHandlerUtil.getActiveIRemoteServiceContainerChecked(event);
// decouple the long running connect call from the ui thread
return new // $NON-NLS-1$
Job(// $NON-NLS-1$
NLS.bind("Connecting {0}", createConnectId.getName())) {
protected IStatus run(IProgressMonitor monitor) {
if (container == null)
return Status.OK_STATUS;
container.disconnect();
return Status.OK_STATUS;
}
};
}
use of org.eclipse.ecf.core.identity.ID in project ecf by eclipse.
the class ConnectedTester method getContainerByConnectID.
/**
* @param connectID
* The conected ID for which an IContainer is to be returned
* @return a IContainer instance of null
*/
// TODO push this functionality down into the ContainerManager
private IContainer getContainerByConnectID(ID connectID) {
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(connectID)) {
return containers[i];
}
}
return null;
}
Aggregations