Search in sources :

Example 1 with IContainer

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

the class AbstractURLHyperlink method open.

/*
	 * @see org.eclipse.jdt.internal.ui.javaeditor.IHyperlink#open()
	 */
public void open() {
    try {
        IWorkbench workbench = PlatformUI.getWorkbench();
        IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
        IContainer container = createContainer();
        Assert.isNotNull(container);
        IConnectWizard icw = createConnectWizard();
        Assert.isNotNull(icw);
        icw.init(workbench, container);
        WizardDialog dialog = new WizardDialog(window.getShell(), icw);
        dialog.open();
    } catch (Exception ex) {
        IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, Messages.AbstractURIHyperlink_EXCEPTION_HYPERLINK, ex);
        ErrorDialog.openError(null, null, null, status);
        Activator.getDefault().getLog().log(status);
    }
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IStatus(org.eclipse.core.runtime.IStatus) IContainer(org.eclipse.ecf.core.IContainer) IConnectWizard(org.eclipse.ecf.ui.IConnectWizard) WizardDialog(org.eclipse.jface.wizard.WizardDialog) ContainerCreateException(org.eclipse.ecf.core.ContainerCreateException)

Example 2 with IContainer

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

the class CompositeDiscoveryContainer method dispose.

/* (non-Javadoc)
	 * @see org.eclipse.ecf.discovery.AbstractDiscoveryContainerAdapter#dispose()
	 */
public void dispose() {
    disconnect();
    synchronized (containers) {
        for (final Iterator itr = containers.iterator(); itr.hasNext(); ) {
            final IContainer container = (IContainer) itr.next();
            container.dispose();
        }
        containers.clear();
    }
    targetID = null;
    super.dispose();
}
Also used : IContainer(org.eclipse.ecf.core.IContainer)

Example 3 with IContainer

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

the class CompositeDiscoveryContainer method addContainer.

/**
 * @param object
 * @return true on success
 * @see java.util.List#add(java.lang.Object)
 */
public boolean addContainer(final Object object) {
    // connect the new container if necessary and register ourself as listeners
    IContainer iContainer = (IContainer) object;
    if (iContainer.getConnectedID() == null) {
        try {
            iContainer.connect(targetID, null);
        } catch (ContainerConnectException e) {
            // we eat the exception here
            // $NON-NLS-1$
            Trace.catching(Activator.PLUGIN_ID, METHODS_CATCHING, this.getClass(), "addContainer(Object)", e);
            return false;
        }
    }
    final IDiscoveryLocator idca = (IDiscoveryLocator) object;
    idca.addServiceListener(ccsl);
    idca.addServiceTypeListener(ccstl);
    // register previously registered with the new IDS
    synchronized (registeredServices) {
        final IDiscoveryAdvertiser ida = (IDiscoveryAdvertiser) object;
        for (final Iterator itr = registeredServices.iterator(); itr.hasNext(); ) {
            final IServiceInfo serviceInfo = (IServiceInfo) itr.next();
            try {
                ida.registerService(serviceInfo);
            } catch (final ECFRuntimeException e) {
                // we eat the exception here since the original registerService call is long done
                // $NON-NLS-1$
                Trace.catching(Activator.PLUGIN_ID, METHODS_CATCHING, this.getClass(), "addContainer(Object)", e);
            }
        }
    }
    synchronized (containers) {
        Trace.trace(Activator.PLUGIN_ID, METHODS_TRACING, this.getClass(), "addContainer(Object)", // $NON-NLS-1$ //$NON-NLS-2$
        "addContainer " + object.toString());
        return containers.add(object);
    }
}
Also used : ContainerConnectException(org.eclipse.ecf.core.ContainerConnectException) IContainer(org.eclipse.ecf.core.IContainer) ECFRuntimeException(org.eclipse.ecf.core.util.ECFRuntimeException)

Example 4 with IContainer

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

the class RestContainerTest method testCreateContainer3.

public void testCreateContainer3() throws Exception {
    ContainerTypeDescription description = getContainerFactory().getDescriptionByName(RestConstants.REST_CONTAINER_TYPE);
    IContainer container = getContainerFactory().createContainer(description, new Object[] { new URI(RestConstants.TEST_DE_TARGET) });
    assertNotNull(container);
    assertTrue(container instanceof RestClientContainer);
}
Also used : ContainerTypeDescription(org.eclipse.ecf.core.ContainerTypeDescription) RestClientContainer(org.eclipse.ecf.remoteservice.rest.client.RestClientContainer) IContainer(org.eclipse.ecf.core.IContainer) URI(java.net.URI)

Example 5 with IContainer

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

the class RestContainerTest method testRegisterRestService.

public void testRegisterRestService() throws Exception {
    IContainer container = createRestContainer(RestConstants.TEST_DE_TARGET);
    Dictionary properties = new Hashtable();
    properties.put("user", "null");
    IRemoteCallable callable = RestCallableFactory.createCallable("methodName", "resourcePath", null, new HttpGetRequestType());
    IRemoteServiceRegistration registration = registerCallable(container, callable, properties);
    assertNotNull(registration);
}
Also used : IRemoteCallable(org.eclipse.ecf.remoteservice.client.IRemoteCallable) Dictionary(java.util.Dictionary) Hashtable(java.util.Hashtable) HttpGetRequestType(org.eclipse.ecf.remoteservice.rest.client.HttpGetRequestType) IContainer(org.eclipse.ecf.core.IContainer) IRemoteServiceRegistration(org.eclipse.ecf.remoteservice.IRemoteServiceRegistration)

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