Package org.eclipse.ecf.remoteservice

Examples of org.eclipse.ecf.remoteservice.IRemoteServiceRegistration


    IRemoteServiceContainerAdapter containerAdapter = rsContainer
        .getContainerAdapter();

    // Register remote service via ECF container adapter to create
    // remote service registration
    IRemoteServiceRegistration remoteRegistration = null;
    if (containerAdapter instanceof IOSGiRemoteServiceContainerAdapter) {
      IOSGiRemoteServiceContainerAdapter osgiContainerAdapter = (IOSGiRemoteServiceContainerAdapter) containerAdapter;
      remoteRegistration = osgiContainerAdapter.registerRemoteService(
          exportedInterfaces, serviceReference, PropertiesUtil
              .createDictionaryFromMap(remoteServiceProperties));
    } else {
      Object service = AccessController
          .doPrivileged(new PrivilegedAction<Object>() {
            public Object run() {
              return getClientBundleContext().getService(
                  serviceReference);
            }
          });
      remoteRegistration = containerAdapter.registerRemoteService(
          exportedInterfaces, service, PropertiesUtil
              .createDictionaryFromMap(remoteServiceProperties));
    }
   
    endpointDescriptionProperties.put(
        org.eclipse.ecf.remoteservice.Constants.SERVICE_ID,
        remoteRegistration.getID().getContainerRelativeID());

    if (remoteRegistration instanceof IExtendedRemoteServiceRegistration) {
      IExtendedRemoteServiceRegistration iersr = (IExtendedRemoteServiceRegistration) remoteRegistration;
      Map<String, Object> extraProperties = iersr.getExtraProperties();
      if (extraProperties != null)
View Full Code Here


      throw new RuntimeException("cannot create connect id for client " + 1, e);
    }
  }

  protected IRemoteServiceRegistration registerService(IRemoteServiceContainerAdapter adapter, String serviceInterface, Object service, Dictionary serviceProperties, int sleepTime) {
    final IRemoteServiceRegistration result = adapter.registerRemoteService(new String[] {serviceInterface}, service, serviceProperties);
    sleep(sleepTime);
    return result;
  }
View Full Code Here

    IRemoteServiceReference remoteServiceReference = getRemoteServiceClientContainerAdapter().getRemoteServiceReference(registration.getID());
    assertEquals(registration.getReference(), remoteServiceReference);
  }
 
  public void testUngetRemoteService() {
    IRemoteServiceRegistration registration = createRestRegistration("resourcePath");
    IRemoteServiceReference reference = registration.getReference();
    getRemoteServiceClientContainerAdapter().getRemoteService(reference);
    assertTrue(getRemoteServiceClientContainerAdapter().ungetRemoteService(reference));
  }
View Full Code Here

      fail();
    }   
  }
 
  public void testGetRemoteServiceID() {
    IRemoteServiceRegistration registration = createRestRegistration("resourcePath");
    long containerRelativeID = registration.getID().getContainerRelativeID();
    IRemoteServiceID remoteServiceID = getRemoteServiceClientContainerAdapter().getRemoteServiceID(container.getID(), containerRelativeID);
    assertEquals(registration.getID(), remoteServiceID);
  }
View Full Code Here

  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);
  }
View Full Code Here

    IRemoteCallable callable = RestCallableFactory.createCallable(resourcePath,resourcePath);
    return registerCallable(container, callable, null);
  }
 
  public void testGetRemoteService() {
    IRemoteServiceRegistration registration = createRestRegistration("resourcePath");
    IRemoteServiceReference reference = registration.getReference();
    assertNotNull(reference);
    IRemoteService remoteService = getRemoteServiceClientContainerAdapter().getRemoteService(reference);
    assertNotNull(remoteService);
  }
View Full Code Here

    IRemoteService remoteService = getRemoteServiceClientContainerAdapter().getRemoteService(reference);
    assertNotNull(remoteService);
  }
 
  public void testGetRemoteServiceReference() {
    IRemoteServiceRegistration registration = createRestRegistration("resourcePath");
    IRemoteServiceReference remoteServiceReference = getRemoteServiceClientContainerAdapter().getRemoteServiceReference(registration.getID());
    assertEquals(registration.getReference(), remoteServiceReference);
  }
View Full Code Here

    assertNull(remoteRefs);
  }
 
  public void testGetLocalRemoteServiceReferences() throws Exception {
    // First register some service locally
    IRemoteServiceRegistration registration = containerAdapter.registerRemoteService(new String[] { IConcatService.class.getName() }, createConcatService(), null);

    // Now lookup all references
    IRemoteServiceReference[] allRefs = containerAdapter.getAllRemoteServiceReferences(IConcatService.class.getName(), null);
    assertNotNull(allRefs);
    assertTrue(allRefs.length == 1);
   
    // Unregister
    registration.unregister();
  }
View Full Code Here

    registration.unregister();
  }

  public void testGetAllLocalRemoteServiceReference() throws Exception {
    // First register some service locally
    IRemoteServiceRegistration registration = containerAdapter.registerRemoteService(new String[] { IConcatService.class.getName() }, createConcatService(), null);

    // Now lookup all references
    IRemoteServiceReference[] allRefs = containerAdapter.getAllRemoteServiceReferences(null, null);
    assertNotNull(allRefs);
    assertTrue(allRefs.length == 1);
   
    // Unregister
    registration.unregister();
  }
View Full Code Here

  }

  protected IRemoteServiceRegistration registerRemoteService(
      IRemoteServiceContainerAdapter adapter, String serviceInterface,
      Object service, Dictionary serviceProperties, int sleepTime) {
    final IRemoteServiceRegistration result = adapter
        .registerRemoteService(new String[] { serviceInterface },
            service, serviceProperties);
    sleep(sleepTime);
    return result;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.ecf.remoteservice.IRemoteServiceRegistration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.