Search in sources :

Example 16 with IRemoteServiceContainerAdapter

use of org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter in project ecf by eclipse.

the class RemoteServiceHandlerUtil method getActiveIRemoteServiceReferencesChecked.

public static IRemoteServiceReference[] getActiveIRemoteServiceReferencesChecked(ExecutionEvent event) throws ExecutionException {
    final IServiceInfo serviceInfo = DiscoveryHandlerUtil.getActiveIServiceInfoChecked(event);
    final IRemoteServiceContainerAdapter adapter = getActiveIRemoteServiceContainerAdapterChecked(event);
    try {
        return getRemoteServiceReferencesForRemoteServiceAdapter(adapter, serviceInfo);
    } catch (IDCreateException e) {
        throw new ExecutionException(e.getMessage(), e);
    } catch (InvalidSyntaxException e) {
        throw new ExecutionException(e.getMessage(), e);
    }
}
Also used : IDCreateException(org.eclipse.ecf.core.identity.IDCreateException) IServiceInfo(org.eclipse.ecf.discovery.IServiceInfo) IRemoteServiceContainerAdapter(org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter) InvalidSyntaxException(org.osgi.framework.InvalidSyntaxException) ExecutionException(org.eclipse.core.commands.ExecutionException)

Example 17 with IRemoteServiceContainerAdapter

use of org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter in project ecf by eclipse.

the class AbstractRemoteServiceTest method testGetServiceReferencesWithFilterFail.

public void testGetServiceReferencesWithFilterFail() throws Exception {
    final IRemoteServiceContainerAdapter[] adapters = getRemoteServiceAdapters();
    final Properties props = new Properties();
    props.put("foo", "bar");
    props.put("foo1", "bar");
    registerService(adapters[0], IConcatService.class.getName(), createService(), customizeProperties(props), SLEEPTIME);
    // Create dictionary that is *not* the same as props, so the filter
    // should miss
    final Properties missProps = new Properties();
    missProps.put("bar", "foo");
    final String missFilter = getFilterFromServiceProperties(missProps);
    final IRemoteServiceReference[] refs = getRemoteServiceReferences(adapters[1], getConnectTargetID(), getIDFilter(), IConcatService.class.getName(), missFilter);
    assertTrue(refs == null);
    Thread.sleep(SLEEPTIME);
}
Also used : IRemoteServiceReference(org.eclipse.ecf.remoteservice.IRemoteServiceReference) IRemoteServiceContainerAdapter(org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter) Properties(java.util.Properties)

Example 18 with IRemoteServiceContainerAdapter

use of org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter in project ecf by eclipse.

the class AbstractRemoteServiceTest method testUnregisterService.

public void testUnregisterService() throws Exception {
    final IRemoteServiceContainerAdapter[] adapters = getRemoteServiceAdapters();
    // adapter [0] is the service 'server'
    final IRemoteServiceRegistration reg = registerService(adapters[0], IConcatService.class.getName(), createService(), customizeProperties(null), SLEEPTIME);
    assertNotNull(reg);
    assertNotNull(reg.getContainerID());
    reg.unregister();
    Thread.sleep(SLEEPTIME);
}
Also used : IRemoteServiceContainerAdapter(org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter) IRemoteServiceRegistration(org.eclipse.ecf.remoteservice.IRemoteServiceRegistration)

Example 19 with IRemoteServiceContainerAdapter

use of org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter in project ecf by eclipse.

the class AbstractRemoteServiceTest method testGetProxyNoRemoteServiceProxy.

public void testGetProxyNoRemoteServiceProxy() throws Exception {
    final IRemoteServiceContainerAdapter[] adapters = getRemoteServiceAdapters();
    Properties props = new Properties();
    props.put(Constants.SERVICE_PREVENT_RSPROXY, "true");
    final IRemoteService service = registerAndGetRemoteService(adapters[0], adapters[1], getClient(0).getConnectedID(), getIDFilter(), IConcatService.class.getName(), customizeProperties(props), SLEEPTIME);
    assertNotNull(service);
    Object proxy = service.getProxy();
    assertTrue(!(proxy instanceof IRemoteServiceProxy));
    Thread.sleep(SLEEPTIME);
}
Also used : IRemoteServiceContainerAdapter(org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter) IRemoteServiceProxy(org.eclipse.ecf.remoteservice.IRemoteServiceProxy) Properties(java.util.Properties) IRemoteService(org.eclipse.ecf.remoteservice.IRemoteService)

Example 20 with IRemoteServiceContainerAdapter

use of org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter in project ecf by eclipse.

the class AbstractRemoteServiceTest method testRemoteServiceNamespace.

public void testRemoteServiceNamespace() throws Exception {
    final IRemoteServiceContainerAdapter[] adapters = getRemoteServiceAdapters();
    assertNotNull(adapters);
    for (int i = 0; i < adapters.length; i++) {
        Namespace namespace = adapters[i].getRemoteServiceNamespace();
        assertNotNull(namespace);
    }
    Thread.sleep(SLEEPTIME);
}
Also used : IRemoteServiceContainerAdapter(org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter) Namespace(org.eclipse.ecf.core.identity.Namespace)

Aggregations

IRemoteServiceContainerAdapter (org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter)35 IRemoteServiceReference (org.eclipse.ecf.remoteservice.IRemoteServiceReference)16 IConcatService (org.eclipse.ecf.tests.remoteservice.IConcatService)14 IRemoteService (org.eclipse.ecf.remoteservice.IRemoteService)9 IContainer (org.eclipse.ecf.core.IContainer)7 ID (org.eclipse.ecf.core.identity.ID)7 Dictionary (java.util.Dictionary)6 IRemoteServiceListener (org.eclipse.ecf.remoteservice.IRemoteServiceListener)6 IRemoteServiceEvent (org.eclipse.ecf.remoteservice.events.IRemoteServiceEvent)6 IRemoteServiceRegisteredEvent (org.eclipse.ecf.remoteservice.events.IRemoteServiceRegisteredEvent)6 IFuture (org.eclipse.equinox.concurrent.future.IFuture)6 IRemoteServiceContainer (org.eclipse.ecf.remoteservice.IRemoteServiceContainer)5 RemoteServiceContainer (org.eclipse.ecf.remoteservice.RemoteServiceContainer)5 Hashtable (java.util.Hashtable)4 Properties (java.util.Properties)4 IRemoteServiceRegistration (org.eclipse.ecf.remoteservice.IRemoteServiceRegistration)4 RemoteServiceTracker (org.eclipse.ecf.remoteservice.util.tracker.RemoteServiceTracker)4 ArrayList (java.util.ArrayList)3 ContainerCreateException (org.eclipse.ecf.core.ContainerCreateException)3 IRemoteServiceID (org.eclipse.ecf.remoteservice.IRemoteServiceID)3