Search in sources :

Example 66 with IContainer

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

the class Activator method disposeServiceRegistration.

/**
 * @param serviceRegistration disconnects the underlying IContainer and unregisters the service
 */
private void disposeServiceRegistration(ServiceRegistration serviceRegistration) {
    final ServiceReference reference = serviceRegistration.getReference();
    final IContainer aContainer = (DnsSdDiscoveryContainerAdapter) context.getService(reference);
    serviceRegistration.unregister();
    final IContainer container = (IContainer) aContainer.getAdapter(IContainer.class);
    container.dispose();
    container.disconnect();
}
Also used : IContainer(org.eclipse.ecf.core.IContainer) ServiceReference(org.osgi.framework.ServiceReference)

Example 67 with IContainer

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

the class RosterWriterHelper method getConnectedContainerAdapters.

private Object[] getConnectedContainerAdapters(Class adapterType) {
    IContainer[] containers = getContainers();
    List l = new ArrayList();
    for (int i = 0; i < containers.length; i++) {
        // Make sure connected
        if (containers[i].getConnectedID() != null) {
            Object o = containers[i].getAdapter(adapterType);
            if (o != null)
                l.add(o);
        }
    }
    return (Object[]) l.toArray();
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) IContainer(org.eclipse.ecf.core.IContainer)

Example 68 with IContainer

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

the class ShowAllRostersContribution method getContributionItems.

/* (non-Javadoc)
	 * @see org.eclipse.ui.actions.CompoundContributionItem#getContributionItems()
	 */
protected IContributionItem[] getContributionItems() {
    IAction action = new Action() {

        public void run() {
            // Get containers from container manager
            IContainer[] containers = Activator.getDefault().getContainers();
            List l = new ArrayList();
            for (int i = 0; i < containers.length; i++) {
                // Make sure the container is connected
                if (containers[i].getConnectedID() != null) {
                    // Make sure container implements IPresenceContainerAdapter API
                    Object o = containers[i].getAdapter(IPresenceContainerAdapter.class);
                    if (o != null)
                        l.add(o);
                }
            }
            IPresenceContainerAdapter[] adapters = (IPresenceContainerAdapter[]) l.toArray(new IPresenceContainerAdapter[] {});
            for (int i = 0; i < adapters.length; i++) {
                // Show all rosters on console...or do other things with it here.
                new RosterWriterHelper().writeRosterToConsole(adapters[i].getRosterManager().getRoster());
            }
        }
    };
    action.setText("show all rosters on console");
    return new IContributionItem[] { new ActionContributionItem(action) };
}
Also used : IAction(org.eclipse.jface.action.IAction) Action(org.eclipse.jface.action.Action) IAction(org.eclipse.jface.action.IAction) IContributionItem(org.eclipse.jface.action.IContributionItem) ArrayList(java.util.ArrayList) RosterWriterHelper(org.eclipse.ecf.internal.examples.webinar.util.RosterWriterHelper) IPresenceContainerAdapter(org.eclipse.ecf.presence.IPresenceContainerAdapter) ActionContributionItem(org.eclipse.jface.action.ActionContributionItem) List(java.util.List) ArrayList(java.util.ArrayList) IContainer(org.eclipse.ecf.core.IContainer)

Example 69 with IContainer

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

the class RpcContainerTest method testCreateContainer.

public void testCreateContainer() throws Exception {
    IContainer container = createRpcContainer(RpcConstants.TEST_ECHO_TARGET);
    assertNotNull(container);
    assertTrue(container instanceof RpcClientContainer);
}
Also used : RpcClientContainer(org.eclipse.ecf.remoteservice.rpc.client.RpcClientContainer) IContainer(org.eclipse.ecf.core.IContainer)

Example 70 with IContainer

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

the class RpcContainerTest method testCreateContainer2.

public void testCreateContainer2() throws Exception {
    ContainerTypeDescription description = getContainerFactory().getDescriptionByName(RpcConstants.RPC_CONTAINER_TYPE);
    IContainer container = getContainerFactory().createContainer(description, new Object[] { new URL(RpcConstants.TEST_ECHO_TARGET) });
    assertNotNull(container);
    assertTrue(container instanceof RpcClientContainer);
}
Also used : RpcClientContainer(org.eclipse.ecf.remoteservice.rpc.client.RpcClientContainer) ContainerTypeDescription(org.eclipse.ecf.core.ContainerTypeDescription) IContainer(org.eclipse.ecf.core.IContainer) URL(java.net.URL)

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