Package net.jini.export

Examples of net.jini.export.Exporter


  throws ExportException, UnsupportedConstraintException
    {
  ServerEndpoint se = getServerEndpoint(host, port, new SF(), null);
  InvocationLayerFactory ilf =
      new BasicILFactory(null, null, PingImpl.class.getClassLoader());
  Exporter exporter = new BasicJeriExporter(se, ilf, false, false);
  return (Ping) exporter.export(impl);
    }
View Full Code Here


  System.err.println("\nRegression test for RFE 4487532\n");

  System.setProperty(
      "com.sun.jini.jeri.server.suppressStackTraces", "true");

  Exporter exporter =
      new BasicJeriExporter(TcpServerEndpoint.getInstance(0), new
          BasicILFactory(), true, true);

  try {
      verifySuppression((Pong) exporter.export(new Impl()));

      System.err.println(
    "TEST PASSED (server-side stack trace data suppressed)");
  } finally {
      try {
    exporter.unexport(true);
      } catch (Exception e) {
      }
  }
    }
View Full Code Here

    }

    public static void main(String[] args) throws Exception {
 
  Remote impl = new UnmarshalUnexpectedException();
  Exporter exporter =
      new BasicJeriExporter(TcpServerEndpoint.getInstance(0),
          new TestILFactory(), false, true);
  RemoteInterface proxy = null;
 
  try {
      proxy = (RemoteInterface) exporter.export(impl);
      try {
    proxy.throwIt(new RuntimeException());
      } catch (RuntimeException e) {
    System.err.println("caught RuntimeException");
      }
      try {
    proxy.throwIt(new Error());
      } catch (ServerError e) {
    System.err.println("caught ServerError");
      }
      try {
    proxy.throwIt(new RemoteException());
      } catch (RemoteException e) {
    System.err.println("caught RemoteException");
      }
      try {
    proxy.throwIt(new IOException());
      } catch (UnexpectedException e) {
    System.err.println("caught UnexpectedException");
    if (e.getCause().getClass() != IOException.class) {
        throw new RuntimeException(
      "test failed; expected nested IOException, got " +
      e.getClass().toString());
    }
    System.err.println(
        "UnexpectedException has correct nested exception");
      }
      System.err.println("test passed");
  } finally {
      if (proxy != null) {
    exporter.unexport(true);
      }
  }
    }
View Full Code Here

    public static void main(String[] args) throws Exception {

  System.err.println("\nRegression test for RFE 4010355\n");

  Exporter exporter =
      new BasicJeriExporter(TcpServerEndpoint.getInstance(0),
          new BasicILFactory(), true, true);
 
  try {
      Ping stub = (Ping) exporter.export(new ServerStackTrace());

      StackTraceElement[] remoteTrace;
      try {
    __FOO__(stub);
    throw new RuntimeException("TEST FAILED: no exception caught");
      } catch (PingException e) {
    System.err.println(
        "trace of exception thrown by remote call:");
    e.printStackTrace();
    System.err.println();
    remoteTrace = e.getStackTrace();
      }

      int fooIndex = -1;
      int barIndex = -1;
      for (int i = 0; i < remoteTrace.length; i++) {
    StackTraceElement e = remoteTrace[i];
    if (e.getMethodName().equals("__FOO__")) {
        if (fooIndex != -1) {
      throw new RuntimeException("TEST FAILED: " +
          "trace contains more than one __FOO__");
        }
        fooIndex = i;
    } else if (e.getMethodName().equals("__BAR__")) {
        if (barIndex != -1) {
      throw new RuntimeException("TEST FAILED: " +
          "trace contains more than one __BAR__");
        }
        barIndex = i;
    }
      }
      if (fooIndex == -1) {
    throw new RuntimeException(
       "TEST FAILED: trace lacks client-side method __FOO__");
      }
      if (barIndex == -1) {
    throw new RuntimeException(
       "TEST FAILED: trace lacks server-side method __BAR__");
      }
      if (fooIndex < barIndex) {
    throw new RuntimeException(
       "TEST FAILED: trace contains client-side method __FOO__ " +
       "before server-side method __BAR__");
      }
      System.err.println("TEST PASSED");
  } finally {
      try {
    exporter.unexport(true);
      } catch (Exception e) {
      }
  }
    }
View Full Code Here

  }
    }

    public static void main(String[] args) throws Exception {

  Exporter exporter = null;
 
  try {
      System.err.println("Regression test for 5024489\n");

      exporter = new BasicJeriExporter(TcpServerEndpoint.getInstance(0),
               new BasicILFactory());

      Remote impl = new Impl();
      Remote proxy = exporter.export(impl);

      TrustVerifier.Context ctx = new TestContext();
     
      TrustVerifier tv = new Subclass(true, true);
      if (tv.isTrustedObject(proxy, ctx) == true) {
    System.err.println("Test 1 passed");
      } else {
    throw new RuntimeException("Test 1 FAILED");
      }

      tv = new Subclass(true, false);
      if (tv.isTrustedObject(proxy, ctx) == false) {
    System.err.println("Test 2 passed");
      } else {
    throw new RuntimeException("Test 2 FAILED");
      }

      tv = new Subclass(false, true);
      if (tv.isTrustedObject(proxy, ctx) == false) {
    System.err.println("Test 3 passed");
      } else {
    throw new RuntimeException("Test 3 FAILED");
      }

      tv = new Subclass(false, false);
      if (tv.isTrustedObject(proxy, ctx) == false) {
    System.err.println("Test 4 passed");
      } else {
    throw new RuntimeException("Test 4 FAILED");
      }

      System.err.println("ALL TESTS PASSSED");

  } finally {
      if (exporter != null) {
    exporter.unexport(true);
      }
  }
    }
View Full Code Here

  public void ping() { }
    }

    public static void main(String[] args) throws Exception {
  Impl impl = new Impl();
  Exporter exporter = new BasicJeriExporter(
      TcpServerEndpoint.getInstance(null, 0, null,
            new DelayingServerSocketFactory()),
      new BasicILFactory());
  Ping stub = (Ping) exporter.export(impl);

  new Thread(new Unexporter(exporter)).start();

  try {
      stub.ping();
View Full Code Here

  this.id = id;
  int port = 0;
  if (obj != null) {
      port = ((Integer) obj.get()).intValue();
  }
  Exporter basicExporter =
      new BasicJeriExporter(TcpServerEndpoint.getInstance(port),
          new BasicILFactory(), false, true);
  exporter = new ActivationExporter(id, basicExporter);
  stub = exporter.export(this);
    }
View Full Code Here

  };
  ServerEndpoint se =
      TcpServerEndpoint.getInstance(null, 0, sf, ssf);
  InvocationLayerFactory ilf =
      new BasicILFactory(null, null, PingImpl.class.getClassLoader());
  Exporter exporter = new BasicJeriExporter(se, ilf, false, false);
  Ping proxy = (Ping) exporter.export(impl);
  /*
   * Create this object early to avoid possible FuturePing
   * verification failure when new threads cannot be created.
   */
  FuturePing future = new FuturePing(proxy);
View Full Code Here

  };
  ServerEndpoint se =
      TcpServerEndpoint.getInstance("localhost", 0, sf, ssf);
  InvocationLayerFactory ilf =
      new BasicILFactory(null, null, PingImpl.class.getClassLoader());
  Exporter exporter = new BasicJeriExporter(se, ilf, false, false);
  Ping proxy = (Ping) exporter.export(impl);
  /*
   * Create another proxy that will use a different connection
   * than the first (SocketFactory does not override equals).
   */
  Ping proxy2 = (Ping) (new MarshalledInstance(proxy)).get(false);
View Full Code Here

  Impl(ActivationID aid, MarshalledObject mo)
      throws Exception
  {
      myAid = aid;
      Exporter basicExporter =
    new BasicJeriExporter(TcpServerEndpoint.getInstance(0),
              new BasicILFactory(), false, true);
      exp = new ActivationExporter(aid, basicExporter);
      proxy = exp.export(this);
  }
View Full Code Here

TOP

Related Classes of net.jini.export.Exporter

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.