Package net.jini.jeri

Examples of net.jini.jeri.BasicILFactory


    config, COMPONENT, "serverExporter", Exporter.class,
    new ActivationExporter(
        this.activationID,
        new BasicJeriExporter(
      TcpServerEndpoint.getInstance(0),
      new BasicILFactory())),
    this.activationID);
  } else {
      this.activationID = null;
      activationSystem = null;

      serverExporter = (Exporter) Config.getNonNullEntry(
    config, COMPONENT, "serverExporter", Exporter.class,
    new BasicJeriExporter(
        TcpServerEndpoint.getInstance(0),
        new BasicILFactory()));
  }

  /* fetch "initial*" config entries, if first time starting up */
  if (!recoveredSnapshot) {
      Entry[] initialLookupAttributes = (Entry[]) config.getEntry(
View Full Code Here


       || object instanceof ClassLoader)
  {
      String className = object.getClass().getName();
      return className.substring(className.lastIndexOf('.') + 1);
  } else if (object instanceof BasicILFactory) {
      BasicILFactory factory = (BasicILFactory) object;
      Class permClass = factory.getPermissionClass();
      return "BasicILFactory[" +
    factory.getServerConstraints() +
    (permClass != null ? ", " + permClass.getName() : "") +
    "]";
  } else if (object instanceof Uuid) {
      return "Uuid";
  } else if (object instanceof BasicJeriExporter) {
View Full Code Here

        //Verify that an object exported by BasicJeriExporter is trusted
        BasicJeriTrustVerifier verifier = new BasicJeriTrustVerifier();
        Integer port = new Integer(getStringValue("listenPort"));
        BasicJeriExporter exporter = new BasicJeriExporter(
            TcpServerEndpoint.getInstance(port.intValue()),
      new BasicILFactory());
        Remote stub = exporter.export(new TestServiceImpl());
  exporter.unexport(true);
        ClassLoader loader = Thread.currentThread().getContextClassLoader();
        TestTrustVerifierCtx ctx = new TestTrustVerifierCtx(
            true, loader);
View Full Code Here

        Redirector rd = new Redirector(getHost(),getPort(),redirectPort);
        ((TestServerEndpoint) se).redirect(redirectPort);
        Thread t = new Thread(rd);
        t.start();
        BasicJeriExporter exporter = new BasicJeriExporter(se,
            new BasicILFactory());
        TestService stub = (TestService) exporter.export(service);
        //Connect to the mux server
        Socket s = new Socket(getHost(),getPort());
        InputStream is = s.getInputStream();
        OutputStream os = s.getOutputStream();
        //Send client connection header
        ClientConnectionHeader cHeader = new ClientConnectionHeader();
        cHeader.send(os);
        //Receive ServerConnection header and verify format
        ServerConnectionHeader sHeader = new ServerConnectionHeader();
        try {
            sHeader.receive(is,getTimeout());
        } catch (ProtocolException e) {
            e.printStackTrace();
            throw new TestException(e.getMessage(),e);
        }
        //Make a remote call that returns something
        stub.doSomething();
        exporter.unexport(true);
        rd.stop();
        //Extract and analyze the messages sent by the mux server
        try {
            analyzeServerDataBytes(rd.getServerConversation());
        } catch (ProtocolException e) {
            e.printStackTrace();
            throw new TestException(e.getMessage(),e);
        }
                //Ping the server
        PingMessage pm = new PingMessage().setCookie((short)0x5544);
        pm.send(os);
        //Receive a ping ack from server and verify that the correct cookie
        //is included
        se = getServerEndpoint();
        service = new TestServiceImpl();
        exporter = new BasicJeriExporter(se,
            new BasicILFactory());
        stub = (TestService) exporter.export(service);
        //Connect to the mux server
        s = new Socket(getHost(),getPort());
        is = s.getInputStream();
        os = s.getOutputStream();
View Full Code Here

  Thread t = new Thread(new Runnable() {
      public void run() {
    Exporter exporter =
        new BasicJeriExporter(new BlockingListenServerEndpoint(),
            new BasicILFactory(), false, false);
    try {
        exporter.export(new Remote() { });
    } catch (ExportException e) {
        throw new Error(e);
    }
      }
  });
  t.setDaemon(true);
  t.start();
  synchronized (lock) {
      while (!blocking) {
    lock.wait();
      }
  }
  Exporter exporter =
      new BasicJeriExporter(TcpServerEndpoint.getInstance(0),
          new BasicILFactory(), false, false);
  exporter.export(new Remote() { });
  exporter.unexport(true);
  System.err.println("TEST PASSED");
    }
View Full Code Here

    public void setup(QAConfig sysConfig) throws Exception {
    }

    // inherit javadoc
    public void run() throws Exception {
        BasicILFactory factory1;
        BasicILFactory factory2;
        int counter = 1;
        for (int i = 0; i < cases.length; i++) {
            FakeMethodConstraints mConstraints1 =
                (FakeMethodConstraints)cases[i][0];
            Class permClass1 = (Class)cases[i][1];
            ClassLoader classLoader1 = (ClassLoader)cases[i][2];

            factory1 =
                new BasicILFactory(mConstraints1,permClass1,classLoader1);

            logger.log(Level.FINE,"=================================");
            logger.log(Level.FINE,"test case " + (counter++) + ": "
                + "equals is false with AbstractILFactory impl");
            logger.log(Level.FINE,"");

            FakeAbstractILFactory fa = new FakeAbstractILFactory();
            assertion(! factory1.equals(fa));

            logger.log(Level.FINE,"=================================");
            logger.log(Level.FINE,"test case " + (counter++) + ": "
                + "equals is false with InvocationLayerFactory impl");
            logger.log(Level.FINE,"");

            FakeInvocationLayerFactory fi =new FakeInvocationLayerFactory();
            assertion(! factory1.equals(fi));

            for (int j = 0; j < cases.length; j++) {
                FakeMethodConstraints mConstraints2 =
                    (FakeMethodConstraints)cases[j][0];
                Class permClass2 = (Class)cases[j][1];
                ClassLoader classLoader2 = (ClassLoader)cases[j][2];

                factory2 = new BasicILFactory(
                    mConstraints2,permClass2,classLoader2);

                logger.log(Level.FINE,"=================================");
                logger.log(Level.FINE,"test case " + (counter++) + ": "
                    + "equals, hashCode, toString method calls: "
                    + "methodConstraints1:" + mConstraints1
                    + ", permClass1:" + permClass1
                    + ", classLoader1:" + classLoader1
                    + ", methodConstraints2:" + mConstraints2
                    + ", permClass2:" + permClass2
                    + ", classLoader2:" + classLoader2);
                logger.log(Level.FINE,"");

                // verify equals, hashCode, and toString methods
                assertion(! factory1.equals(null));
                assertion(factory1.equals(factory1));
                assertion(factory2.equals(factory2));
                assertion(factory1.toString() != null);
                assertion(factory2.toString() != null);

                if (i == j) {
                    assertion(factory1.equals(factory2));
                    assertion(factory2.equals(factory1));
                    assertion(factory1.hashCode() == factory2.hashCode());
                } else {
                    assertion(! factory1.equals(factory2));
                    assertion(! factory2.equals(factory1));
                }

            } //for j

        } //for i
View Full Code Here

     *
     * @return a default jeri exporter
     */
    public static Exporter getDefaultExporter() {
  return new BasicJeriExporter(TcpServerEndpoint.getInstance(0),
             new BasicILFactory());
    }
View Full Code Here

    public void run() throws Exception {
        // create test infrastructure
        ObjectEndpoint oe = new FakeObjectEndpoint();
        FakeMethodConstraints fakeMethodConstraints =
            new FakeMethodConstraints(null);
        BasicILFactory factory = new BasicILFactory(
            fakeMethodConstraints,ExportPermission.class);
        FakeServerCapabilities sc = new FakeServerCapabilities(null);
        int counter = 1;

        logger.log(Level.FINE,"=================================");
        logger.log(Level.FINE,"test case " + (counter++)
            + ": createInstances(null,null,null)");
        logger.log(Level.FINE,"");

        // null parameter tests
        try {
            factory.createInstances(null, null, null);
            assertion(false);
        } catch (NullPointerException npe) {}

        logger.log(Level.FINE,"=================================");
        logger.log(Level.FINE,"test case " + (counter++)
            + ": createInstances(Remote,null,null)");
        logger.log(Level.FINE,"");

        try {
            factory.createInstances(new Remote() {}, null, null);
            assertion(false);
        } catch (NullPointerException npe) {}

        logger.log(Level.FINE,"=================================");
        logger.log(Level.FINE,"test case " + (counter++) + ": "
            + "createInstances(null,ObjectEndpoint,null)");
        logger.log(Level.FINE,"");

        try {
            factory.createInstances(null, oe, null);
            assertion(false);
        } catch (NullPointerException npe) {}

        logger.log(Level.FINE,"=================================");
        logger.log(Level.FINE,"test case " + (counter++) + ": "
            + "createInstances(null,null,ServerCapabilities)");
        logger.log(Level.FINE,"");

        try {
            factory.createInstances(null, null, sc);
            assertion(false);
        } catch (NullPointerException npe) {}

        for (int i = 0; i < cases.length; i++) {
            Class[] interfaces = (Class[])cases[i][0];
            boolean legal = ((Boolean)cases[i][1]).booleanValue();
            Class[] expectedInterfaces = (Class[])cases[i][2];

            logger.log(Level.FINE,"=================================");
            logger.log(Level.FINE,"test case " + (counter++) + ": "
                + "legal:" + legal + ", interfaces:" + interfaces);
            logger.log(Level.FINE,"");

            Remote impl = createImpl(interfaces, oe);

            // verify createInstances behavior using legal and illegal
            // parameters
            if (legal) {
                Object proxy =
                    factory.createInstances(impl,oe,sc).getProxy();
                InvocationHandler handler =
                    Proxy.getInvocationHandler(proxy);
                assertion(proxy.getClass().getClassLoader() ==
                    impl.getClass().getClassLoader());
                assertion(handler instanceof BasicInvocationHandler);
                assertion(((BasicInvocationHandler)handler).
                    getObjectEndpoint() == oe);
                assertion(((BasicInvocationHandler)handler).
                    getServerConstraints() == fakeMethodConstraints);
                assertion(Arrays.equals(expectedInterfaces,
                    proxy.getClass().getInterfaces()));
            } else {
                try {
                    factory.createInstances(impl,oe,sc);
                    assertion(false);
                } catch (ExportException ignore) { }
            }
        }
    }
View Full Code Here

      }
  }
  if (noneConfiguration) {
      serverExporter =
    new BasicJeriExporter(TcpServerEndpoint.getInstance(0),
              new BasicILFactory());
      if (activationID != null) {
    serverExporter = new ActivationExporter(activationID,
              serverExporter);
      }
  } else {
View Full Code Here

        Thread t = new Thread(rd);
        t.start();
        ((TestServerEndpoint) se).redirect(getPort() + 1);
        TestService service = new TestServiceImpl();
        BasicJeriExporter exporter = new BasicJeriExporter(se,
            new BasicILFactory());
        TestService stub = (TestService) exporter.export(service);
        //Obtain a message to send for the test
        byte[] ball = new byte[800];
        Arrays.fill(ball, (byte)0x88);
        stub.bounce(ball);
View Full Code Here

TOP

Related Classes of net.jini.jeri.BasicILFactory

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.