Search in sources :

Example 1 with ContainerTypeDescription

use of org.eclipse.ecf.core.ContainerTypeDescription 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 2 with ContainerTypeDescription

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

the class RestContainerTest method testCreateContainer2.

public void testCreateContainer2() throws Exception {
    ContainerTypeDescription description = getContainerFactory().getDescriptionByName(RestConstants.REST_CONTAINER_TYPE);
    IContainer container = getContainerFactory().createContainer(description, new Object[] { new URL(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) URL(java.net.URL)

Example 3 with ContainerTypeDescription

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

the class RpcContainerTest method testCreateContainer3.

public void testCreateContainer3() throws Exception {
    ContainerTypeDescription description = getContainerFactory().getDescriptionByName(RpcConstants.RPC_CONTAINER_TYPE);
    IContainer container = getContainerFactory().createContainer(description, new Object[] { new URI(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) URI(java.net.URI)

Example 4 with ContainerTypeDescription

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

the class Activator method start.

/**
 * Called when the OSGi framework starts the bundle.
 *
 * @param bc
 *            the bundle context.
 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
 */
public void start(final BundleContext bc) throws Exception {
    this.context = bc;
    r_osgi_tracker = new ServiceTracker(context, RemoteOSGiService.class.getName(), null);
    r_osgi_tracker.open();
    // bug 495535
    if (DELETE_PROXY_BUNDLES_ON_INIT)
        deleteProxyBundles();
    SafeRunner.run(new ExtensionRegistryRunnable(bc) {

        protected void runWithoutRegistry() throws Exception {
            bc.registerService(Namespace.class, new R_OSGiNamespace(), null);
            bc.registerService(Namespace.class, new R_OSGiWSNamespace(), null);
            bc.registerService(Namespace.class, new R_OSGiWSSNamespace(), null);
            bc.registerService(Namespace.class, new R_OSGiRemoteServiceNamespace(), null);
            // $NON-NLS-1$
            bc.registerService(ContainerTypeDescription.class, new ContainerTypeDescription(R_OSGiContainerInstantiator.NAME, new R_OSGiContainerInstantiator(), "R_OSGi Container", true, false), null);
            // $NON-NLS-1$
            bc.registerService(ContainerTypeDescription.class, new ContainerTypeDescription(R_OSGiContainerInstantiator.NAME_HTTP, new R_OSGiContainerInstantiator(), "R_OSGi Websockets Container", true, false), null);
            // $NON-NLS-1$
            bc.registerService(ContainerTypeDescription.class, new ContainerTypeDescription(R_OSGiContainerInstantiator.NAME_HTTPS, new R_OSGiContainerInstantiator(), "R_OSGi Secure Websockets Container", true, false), null);
        }
    });
}
Also used : ServiceTracker(org.osgi.util.tracker.ServiceTracker) ContainerTypeDescription(org.eclipse.ecf.core.ContainerTypeDescription) ExtensionRegistryRunnable(org.eclipse.ecf.core.util.ExtensionRegistryRunnable) Namespace(org.eclipse.ecf.core.identity.Namespace)

Example 5 with ContainerTypeDescription

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

the class AbstractRemoteServiceRegisterTest method getServerContainerAdapter.

private IRemoteServiceContainerAdapter getServerContainerAdapter() {
    if (this.server != null)
        return (IRemoteServiceContainerAdapter) this.server.getAdapter(IRemoteServiceContainerAdapter.class);
    IContainer[] containers = getContainerManager().getAllContainers();
    String containerType = getServerContainerTypeName();
    for (int i = 0; i < containers.length; i++) {
        ContainerTypeDescription ctd = getContainerManager().getContainerTypeDescription(containers[i].getID());
        if (ctd != null && ctd.getName().equals(containerType))
            return (IRemoteServiceContainerAdapter) containers[i].getAdapter(IRemoteServiceContainerAdapter.class);
    }
    return null;
}
Also used : ContainerTypeDescription(org.eclipse.ecf.core.ContainerTypeDescription) IContainer(org.eclipse.ecf.core.IContainer)

Aggregations

ContainerTypeDescription (org.eclipse.ecf.core.ContainerTypeDescription)54 IContainer (org.eclipse.ecf.core.IContainer)20 List (java.util.List)5 Namespace (org.eclipse.ecf.core.identity.Namespace)5 ExtensionRegistryRunnable (org.eclipse.ecf.core.util.ExtensionRegistryRunnable)5 ArrayList (java.util.ArrayList)3 Dictionary (java.util.Dictionary)3 Properties (java.util.Properties)3 IContainerManager (org.eclipse.ecf.core.IContainerManager)3 IRemoteServiceContainer (org.eclipse.ecf.remoteservice.IRemoteServiceContainer)3 URI (java.net.URI)2 URL (java.net.URL)2 Hashtable (java.util.Hashtable)2 ContainerConnectException (org.eclipse.ecf.core.ContainerConnectException)2 ID (org.eclipse.ecf.core.identity.ID)2 IConnectHandlerPolicy (org.eclipse.ecf.core.security.IConnectHandlerPolicy)2 RestClientContainer (org.eclipse.ecf.remoteservice.rest.client.RestClientContainer)2 RpcClientContainer (org.eclipse.ecf.remoteservice.rpc.client.RpcClientContainer)2 Bundle (org.osgi.framework.Bundle)2 ServiceFactory (org.osgi.framework.ServiceFactory)2