Package org.eclipse.ecf.remoteservice

Examples of org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter


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


   * in the workbench UI.
   * @see IWorkbenchWindowActionDelegate#run
   */
  public void run(IAction action) {
    try {
      IRemoteServiceContainerAdapter adapter = getContainerAdapter();
      // Create target ID
      String target = TARGET;
      ID targetID = createTargetID(container,target);
      // Get and resolve remote service reference
      IRemoteServiceReference[] ref = adapter.getRemoteServiceReferences(targetID, org.eclipse.ecf.examples.remoteservices.common.IRemoteEnvironmentInfo.class.getName(), null);
      IRemoteService svc = adapter.getRemoteService(ref[0]);
      // get proxy
      IRemoteEnvironmentInfo proxy = (IRemoteEnvironmentInfo) svc.getProxy();
      // Call it!
      String osArch = proxy.getOSArch();
      // Show result
View Full Code Here

    // Start server
    server = new SimpleGenericServer(HOST,port);
    server.start(PATH, KEEPALIVE);
   
    GenericServerContainer serverContainer = server.getServerContainer(0);
    IRemoteServiceContainerAdapter adapter = (IRemoteServiceContainerAdapter) serverContainer.getAdapter(IRemoteServiceContainerAdapter.class);
    Assert.isNotNull(adapter);
    registration = adapter.registerRemoteService(new String[] { IConcatService.class.getName() }, new ConcatService(), null);
    Assert.isNotNull(registration);
    System.out.println("generic server started with id="+serverContainer.getID());
  }
View Full Code Here

 
  public void start(int port) throws Exception {
    IContainer client = ContainerFactory.getDefault().createContainer(
        CLIENT_TYPE);
    // Get adapter for accessing remote services
    IRemoteServiceContainerAdapter adapter = (IRemoteServiceContainerAdapter) client
        .getAdapter(IRemoteServiceContainerAdapter.class);

    rsContainer = new RemoteServiceContainer(client,adapter);
   
    System.out.println("Client created with ID=" + client.getID());

    ID connectTargetID = IDFactory.getDefault().createStringID(
        NLS.bind(SERVER_ID, new Integer(port)));
   
    System.out.println("Attempting connect to id="+connectTargetID);
    client.connect(connectTargetID, null);
    System.out.println("Client connected to connectTargetID="
        + connectTargetID);

    Thread.sleep(1000);
   

    // Get remote service reference
    IRemoteServiceReference[] refs = adapter.getRemoteServiceReferences(
        (ID[]) null, IConcatService.class.getName(), null);
   
    rsReference = refs[0];
   
    System.out.println("Remote service with ref=" + refs[0]);
View Full Code Here

 
  public void start(int port) throws Exception {
    IContainer client = ContainerFactory.getDefault().createContainer(
        CLIENT_TYPE);
    // Get adapter for accessing remote services
    IRemoteServiceContainerAdapter adapter = (IRemoteServiceContainerAdapter) client
        .getAdapter(IRemoteServiceContainerAdapter.class);

    rsContainer = new RemoteServiceContainer(client,adapter);
   
    System.out.println("Client created with ID=" + client.getID());

    ID connectTargetID = IDFactory.getDefault().createStringID(
        NLS.bind(SERVER_ID, new Integer(port)));
   
    System.out.println("Attempting connect to id="+connectTargetID);
    client.connect(connectTargetID, null);
    System.out.println("Client connected to connectTargetID="
        + connectTargetID);

    Thread.sleep(1000);
   

    // Get remote service reference
    IRemoteServiceReference[] refs = adapter.getRemoteServiceReferences(
        (ID[]) null, IConcatService.class.getName(), null);
   
    rsReference = refs[0];
   
    System.out.println("Remote service with ref=" + refs[0]);
View Full Code Here

    // Start server
    server = new SSLSimpleGenericServer(HOST,port);
    server.start(PATH, KEEPALIVE);
   
    SSLGenericServerContainer serverContainer = server.getServerContainer(0);
    IRemoteServiceContainerAdapter adapter = (IRemoteServiceContainerAdapter) serverContainer.getAdapter(IRemoteServiceContainerAdapter.class);
    Assert.isNotNull(adapter);
    registration = adapter.registerRemoteService(new String[] { IConcatService.class.getName() }, new ConcatService(), null);
    Assert.isNotNull(registration);
    System.out.println("generic server started with id="+serverContainer.getID());
  }
View Full Code Here

    server = null;
  }
  public void testGetRemoteServiceContainerAdapter() throws Exception {
    IContainer container = server.getFirstServerContainer();
    assertNotNull(container);
    IRemoteServiceContainerAdapter adapter = (IRemoteServiceContainerAdapter) container.getAdapter(IRemoteServiceContainerAdapter.class);
    assertNotNull(adapter);
  }
View Full Code Here

    container = getContainerManagerService().getContainerFactory()
        .createContainer(containerType,
            new Object[] { queueId });

    // Get remote service container adapter
    IRemoteServiceContainerAdapter remoteServiceContainerAdapter = (IRemoteServiceContainerAdapter) container
        .getAdapter(IRemoteServiceContainerAdapter.class);

    // Create the data processor implementation
    dataProcessorImpl = new DataProcessorImpl(container.getID());

    // Register data processor as remote services (with queue consumer
    // container)
    dataProcessorRemoteServiceRegistration = remoteServiceContainerAdapter
        .registerRemoteService(new String[] { IDataProcessor.class
            .getName() }, dataProcessorImpl, null);

    // Report success of registration
    System.out
View Full Code Here

    // Create R-OSGi Container
    IContainerManager containerManager = getContainerManagerService();
    container = containerManager.getContainerFactory().createContainer(
        "ecf.r_osgi.peer");
    // Get remote service container adapter
    IRemoteServiceContainerAdapter containerAdapter = (IRemoteServiceContainerAdapter) container
        .getAdapter(IRemoteServiceContainerAdapter.class);
    // Register remote service
    serviceRegistration = containerAdapter.registerRemoteService(
        new String[] { IHello.class.getName() }, new Hello(), null);
    System.out.println("IHello RemoteService registered");
  }
View Full Code Here

    // 1. Create R-OSGi Container
    IContainerManager containerManager = getContainerManagerService();
    container = containerManager.getContainerFactory().createContainer(
        "ecf.r_osgi.peer");
    // 2. Get remote service container adapter
    IRemoteServiceContainerAdapter containerAdapter = (IRemoteServiceContainerAdapter) container
        .getAdapter(IRemoteServiceContainerAdapter.class);
    // 3. Lookup IRemoteServiceReference
    IRemoteServiceReference[] helloReferences = containerAdapter
        .getRemoteServiceReferences(IDFactory.getDefault().createID(
            container.getConnectNamespace(), ROSGI_SERVICE_HOST),
            IHello.class.getName(), null);
    Assert.isNotNull(helloReferences);
    Assert.isTrue(helloReferences.length > 0);
    // 4. Get remote service for reference
    IRemoteService remoteService = containerAdapter
        .getRemoteService(helloReferences[0]);
    // 5. Get the proxy
    IHello proxy = (IHello) remoteService.getProxy();
    // 6. Finally...call the proxy
    proxy.hello("RemoteService Consumer");
View Full Code Here

TOP

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

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.