Package net.jini.activation

Examples of net.jini.activation.ActivatableInvocationHandler


  /*
   * Create handler.
   */
  ActivationID id = new FakeActivationID();
      UnderlyingProxy uproxy = new UnderlyingProxy();
  ActivatableInvocationHandler aih =
      new ActivatableInvocationHandler(id, uproxy);
 
  /*
   * Serialize handler.
   */
  ByteArrayOutputStream bout = new ByteArrayOutputStream();
  MarshalOutputStream out =
      new MarshalOutputStream(bout, new HashSet());
  out.writeObject(aih);
  out.flush();
  byte[] bytes = bout.toByteArray();

  /*
   * Read in handler (should succeed).
   */
  MarshalInputStream in =
      new MarshalInputStream(new ByteArrayInputStream(bytes),
           ClassLoader.getSystemClassLoader(),
           false, null, new HashSet());
  ActivatableInvocationHandler aihRead =
      (ActivatableInvocationHandler) in.readObject();
  System.err.println("Test 1 passed: handler read successfully");

  /*
   * Set constraints on underlying proxy to make
View Full Code Here


  try {
      Class cl = RMIClassLoader.loadClass(desc.getLocation(),
            desc.getClassName());
      Class[] remoteInterfaces = Util.getRemoteInterfaces(cl);
      InvocationHandler handler =
    new ActivatableInvocationHandler(id, null);
      return (Remote) newProxyInstance(null, remoteInterfaces, handler);
  } catch (Exception e) {
      throw (RuntimeException)
    new RuntimeException("proxy creation failed").initCause(e);
  }
View Full Code Here

      if (list.remove(ProxyTrust.class)) {
    remoteInterfaces =
        (Class[]) list.toArray(new Class[list.size()]);
      }
      InvocationHandler handler =
    new ActivatableInvocationHandler(id, null);
      return (Remote) newProxyInstance(remoteInterfaces,
               new Class[]{
               RemoteMethodControl.class,
               TrustEquivalence.class},
               handler);
View Full Code Here

        Object o;

        FakeActivationID aid = new FakeActivationID(null);
        MethodSetProxy fup = new MethodSetProxy(logger);
        InvocationHandler handler =
                new ActivatableInvocationHandler(aid, fup);
        RemoteMethodSetInterface fi = (RemoteMethodSetInterface)
                Proxy.newProxyInstance(
                        RemoteMethodSetInterface.class.getClassLoader(),
                        new Class[] {RemoteMethodSetInterface.class},
                        handler);
View Full Code Here

        int i;
        Object o;

        ActivationID aid = new FakeActivationID(logger);
        MethodSetProxy fup = new MethodSetProxy(logger);
        InvocationHandler handler2 = new ActivatableInvocationHandler(aid,
                fup);
        RemoteMethodSetInterface fakeProxy = (RemoteMethodSetInterface)
                Proxy.newProxyInstance(
                        RemoteMethodSetInterface.class.getClassLoader(),
                        new Class[] {RemoteMethodSetInterface.class},
                        handler2);
        ActivationID aid2 = new FakeActivationID(logger, fakeProxy, true);
        InvocationHandler handler = new ActivatableInvocationHandler(aid2,
                null);
        RemoteMethodSetInterface fi = (RemoteMethodSetInterface)
                Proxy.newProxyInstance(
                        RemoteMethodSetInterface.class.getClassLoader(),
                        new Class[] {RemoteMethodSetInterface.class},
View Full Code Here

            boolean equalInvocationHandlers =
                    ((Boolean) cases[i][2]).booleanValue();

            // create a dynamic proxy for proxy1Interfaces
            FakeActivationID aid = new FakeActivationID(null);
            ActivatableInvocationHandler handler1 = new
                    ActivatableInvocationHandler(aid, null);
            Object proxy1 = Proxy.newProxyInstance(
                    this.getClass().getClassLoader(),
                    proxy1Interfaces,
                    handler1);

            // create a dynamic proxy for proxy2Interfaces
            FakeActivationID aid2 = aid;

            if (!equalInvocationHandlers) {
                aid2 = new FakeActivationID(null);
            }
            ActivatableInvocationHandler handler2 = new
                    ActivatableInvocationHandler(aid2, null);
            Object proxy2 = Proxy.newProxyInstance(
                    this.getClass().getClassLoader(),
                    proxy2Interfaces,
                    handler2);

            // verify ActivatableInvocationHandler.invoke equals, hashCode,
            // and toString methods
            if (equalInvocationHandlers
                    && Arrays.equals(proxy1Interfaces, proxy2Interfaces)) {
                assertion(proxy1.equals(proxy2));
                assertion(proxy2.equals(proxy1));
                assertion(proxy1.equals(proxy1));
                assertion(proxy2.equals(proxy2));
                assertion(proxy1.hashCode() == proxy2.hashCode());
            } else {
                assertion(!proxy1.equals(proxy2));
                assertion(!proxy2.equals(proxy1));
            }
            assertion(proxy1.toString() != null);
            assertion(proxy2.toString() != null);

            // verify ActivatableInvocationHandler equals, hashCode,
            // and toString methods
            if (equalInvocationHandlers) {
                assertion(handler1.equals(handler2));
                assertion(handler2.equals(handler1));
                assertion(handler1.equals(handler1));
                assertion(handler2.equals(handler2));
                assertion(handler1.hashCode() == handler2.hashCode());
            } else {
                assertion(!handler1.equals(handler2));
                assertion(!handler2.equals(handler1));
                assertion(!handler1.equals(new Object()));
            }
            assertion(handler1.toString() != null);
            assertion(handler2.toString() != null);
        }
    }
View Full Code Here

            FakeActivationID aid = new FakeActivationID(logger);
            // 1
            ExceptionThrowingProxy afup =
                    new ExceptionThrowingProxy(logger);
            // 2
            InvocationHandler handler2 = new
                    ActivatableInvocationHandler(aid, afup);
            // 3
            ExceptionThrowingInterface fakeProxy =
                    (ExceptionThrowingInterface) Proxy.newProxyInstance(
                        ExceptionThrowingInterface.class.getClassLoader(),
                        new Class[] {ExceptionThrowingInterface.class},
                        handler2);
            // 4
            FakeActivationID aid2 = new FakeActivationID(logger, fakeProxy,
                    true);
            // 5
            ExceptionThrowingProxy fup = new ExceptionThrowingProxy(logger);
            // 6
            InvocationHandler handler = new
                    ActivatableInvocationHandler(aid2, fup);
            // 7
            ExceptionThrowingInterface fi =
                    (ExceptionThrowingInterface) Proxy.newProxyInstance(
                        ExceptionThrowingInterface.class.getClassLoader(),
View Full Code Here

     * This method performs all actions mentioned in class description.
     */
    public void run() throws Exception {
        ActivationID aid = new ActivationID(null);
        MethodSetProxy fp = new MethodSetProxy(logger);
        ActivatableInvocationHandler handler =
                new ActivatableInvocationHandler(aid, fp);
        ActivationID aid2 = handler.getActivationID();

        if (aid2 != aid) {
            throw new TestException(
                    "getActivationID method shoud return the same"
                    + " value as used in constructor");
View Full Code Here

    /**
     * This method performs all actions mentioned in class description.
     */
    public void run() throws Exception {
        ActivatableInvocationHandler handler;
        ActivationID aid = new ActivationID(null);
        MethodSetProxy fp = new MethodSetProxy(logger);
        handler = new ActivatableInvocationHandler(aid, fp);
        aid = new ActivationID(null);
        handler = new ActivatableInvocationHandler(aid, null);
        try {
            handler = new ActivatableInvocationHandler(null, null);
            throw new TestException(
                    "ActivatableInvocationHandler constructior"
                    + " should throws NullPointerException if"
                    + " the activation identifier is null");
        } catch (NullPointerException ignore) {
View Full Code Here

     * This method performs all actions mentioned in class description.
     */
    public void run() throws Exception {
        FakeActivationID aid = new FakeActivationID(logger);
        RMCProxy fp = new RMCProxy(logger);
        ActivatableInvocationHandler handler = new
                ActivatableInvocationHandler(aid, fp);
  FakeActivationID aid2 = new FakeActivationID(logger);
        RMCProxy fp2 = new RMCProxy(logger);
        ActivatableInvocationHandler handler2 = new
                ActivatableInvocationHandler(aid2, fp2);
        aid2.setTrustEquivalence(false);
        assertion(!handler.checkTrustEquivalence(handler2),
                "checkTrustEquivalence should return false,"
                + " if ActivationID.checkTrustEquivalence returns false");
View Full Code Here

TOP

Related Classes of net.jini.activation.ActivatableInvocationHandler

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.