Package net.jini.core.constraint

Examples of net.jini.core.constraint.RemoteMethodControl


  throws RemoteException
    {
  if (obj == null || ctx == null) {
      throw new NullPointerException();
  }
  RemoteMethodControl inputServer;
  ServiceID inputRegistrarID;
  if (obj instanceof ConstrainableRegistrarProxy) {
      RegistrarProxy proxy = (RegistrarProxy) obj;
      inputServer = (RemoteMethodControl) proxy.server;
      inputRegistrarID = proxy.registrarID;
  } else if (obj instanceof ConstrainableAdminProxy) {
      AdminProxy proxy = (AdminProxy) obj;
      inputServer = (RemoteMethodControl) proxy.server;
      inputRegistrarID = proxy.registrarID;
  } else if (obj instanceof ConstrainableRegistration) {
      Registration reg = (Registration) obj;
      if (!isTrustedObject(reg.lease, ctx)) {
    return false;
      }
      inputServer = (RemoteMethodControl) reg.server;
      inputRegistrarID = registrarID;
  } else if (obj instanceof ConstrainableEventLease ||
       obj instanceof ConstrainableServiceLease)
  {
      RegistrarLease lease = (RegistrarLease) obj;
      inputServer = (RemoteMethodControl) lease.server;
      inputRegistrarID = lease.registrarID;
  } else if (obj instanceof RemoteMethodControl) {
      inputServer = (RemoteMethodControl) obj;
      inputRegistrarID = registrarID;
  } else {
      return false;
  }

  TrustEquivalence trustEquiv = (TrustEquivalence)
      server.setConstraints(inputServer.getConstraints());
  return trustEquiv.checkTrustEquivalence(inputServer) &&
         registrarID.equals(inputRegistrarID);
    }
View Full Code Here


        MethodConstraints constraints)
    {
  final MethodConstraints serverRefConstraints
      = ConstrainableProxyUtil.translateConstraints(constraints,
                methodMapArray);
  final RemoteMethodControl constrainedServer =
      ((RemoteMethodControl)server).
      setConstraints(serverRefConstraints);

  return (OutriggerServer)constrainedServer;
    }
View Full Code Here

  if (obj == null || ctx == null) {
      throw new NullPointerException();
  } else if (!(obj instanceof RemoteMethodControl)) {
      return false;
  }
  RemoteMethodControl unverifiedProxy = (RemoteMethodControl) obj;
  MethodConstraints constraints = unverifiedProxy.getConstraints();
  TrustEquivalence trustedProxy =
      (TrustEquivalence) proxy.setConstraints(constraints);
  return trustedProxy.checkTrustEquivalence(unverifiedProxy);
    }
View Full Code Here

     */
    public RemoteMethodControl setConstraints(MethodConstraints constraints) {
  MethodConstraints actConstraints =
      ConstrainableProxyUtil.translateConstraints(constraints,
              methodMapping);
  RemoteMethodControl act =
      ((RemoteMethodControl) activator).setConstraints(actConstraints);
  return new ConstrainableAID((Activator) act, uid, constraints);
    }
View Full Code Here

      if (obj == null || ctx == null) {
    throw new NullPointerException();
      } else if (!(obj instanceof ConstrainableAID)) {
    return false;
      }
      RemoteMethodControl act =
    (RemoteMethodControl) ((ConstrainableAID) obj).activator;
      MethodConstraints mc = act.getConstraints();
      TrustEquivalence trusted =
    (TrustEquivalence) activator.setConstraints(mc);
      return trusted.checkTrustEquivalence(act);
  }
View Full Code Here

    endpoint,
    UuidFactory.create("57117a56-2750-11b2-b312-080020c9e4a1"),
    false);
  InvocationHandler invocationHandler =
      new BasicInvocationHandler(objectEndpoint, null);
  RemoteMethodControl proxy =
      (RemoteMethodControl) Proxy.newProxyInstance(
     TestConnectTimeout.class.getClassLoader(),
     new Class[] { Ping.class, RemoteMethodControl.class },
     invocationHandler);

  tryProxy(proxy.setConstraints(
      new BasicMethodConstraints(new InvocationConstraints(
    new ConnectionRelativeTime(TIMEOUT),
    null
      ))
  ));

  tryProxy(proxy.setConstraints(
      new BasicMethodConstraints(new InvocationConstraints(
    ConstraintAlternatives.create(new InvocationConstraint[] {
        new ConnectionRelativeTime(TIMEOUT),
        new ConnectionRelativeTime(TIMEOUT + 1)
    }),
    null
      ))
  ));

  tryProxy(proxy.setConstraints(
      new BasicMethodConstraints(new InvocationConstraints(
    null,
    new ConnectionRelativeTime(TIMEOUT)))));

  tryProxy(proxy.setConstraints(
      new BasicMethodConstraints(new InvocationConstraints(
    null,
    ConstraintAlternatives.create(new InvocationConstraint[] {
        new ConnectionRelativeTime(TIMEOUT),
        new ConnectionRelativeTime(TIMEOUT + 1)
    })
      ))
  ));

  tryProxy(proxy.setConstraints(
      new BasicMethodConstraints(new InvocationConstraints(
    new ConnectionAbsoluteTime(System.currentTimeMillis()),
    null
      ))
  ));

  tryProxy(proxy.setConstraints(
      new BasicMethodConstraints(new InvocationConstraints(
    ConstraintAlternatives.create(new InvocationConstraint[] {
        new ConnectionAbsoluteTime(System.currentTimeMillis()),
        new ConnectionAbsoluteTime(System.currentTimeMillis() + 1)
    }),
    null
      ))
  ));

  tryProxy(proxy.setConstraints(
      new BasicMethodConstraints(new InvocationConstraints(
    null,
    new ConnectionAbsoluteTime(System.currentTimeMillis())
      ))
  ));

  tryProxy(proxy.setConstraints(
      new BasicMethodConstraints(new InvocationConstraints(
    null,
    ConstraintAlternatives.create(new InvocationConstraint[] {
        new ConnectionAbsoluteTime(System.currentTimeMillis()),
        new ConnectionAbsoluteTime(System.currentTimeMillis() + 1)
View Full Code Here

                                                       throws RemoteException
        {
            if (obj == null || ctx == null) {
                throw new NullPointerException("arguments must not be null");
            }//endif
            RemoteMethodControl inputProxy;
            Uuid inputProxyID;
            if(obj instanceof TestServiceProxy.ConstrainableTestServiceProxy) {
                inputProxy =
                       (RemoteMethodControl)((TestServiceProxy)obj).innerProxy;
                inputProxyID = ((ReferentUuid)obj).getReferentUuid();
            } else if( obj instanceof RemoteMethodControl ) {
                inputProxy = (RemoteMethodControl)obj;
                inputProxyID = proxyID;
            } else {
                return false;
            }//endif
            final MethodConstraints mConstraints = inputProxy.getConstraints();
            final TrustEquivalence constrainedInnerProxy =
                     (TrustEquivalence)innerProxy.setConstraints(mConstraints);
            return (    constrainedInnerProxy.checkTrustEquivalence(inputProxy)
                     && proxyID.equals(inputProxyID) );
        }//end isTrustedObject
View Full Code Here

  throws RemoteException
    {
  if (obj == null || ctx == null) {
      throw new NullPointerException();
  }
  RemoteMethodControl inputServer;
  if (obj instanceof LookupSimulatorConstrainableProxy) {
      inputServer = (RemoteMethodControl) ((LookupSimulatorProxy) obj).server;
  } else {
      return false;
  }

  TrustEquivalence trustEquiv = (TrustEquivalence)
      server.setConstraints(inputServer.getConstraints());
  return trustEquiv.checkTrustEquivalence(inputServer);
    }
View Full Code Here

                                                MethodConstraints constraints )
        {
            MethodConstraints newConstraints
               = ConstrainableProxyUtil.translateConstraints(constraints,
                                                             methodMapArray);
            RemoteMethodControl constrainedServer =
                ((RemoteMethodControl)server).setConstraints(newConstraints);

            return ((Fiddler)constrainedServer);
        }//end constrainServer
View Full Code Here

         *  - ConstrainableFiddlerProxy
         *  - ConstrainableFiddlerRegistration
         *  - ConstrainableFiddlerLease
         *  - ConstrainableFiddlerAdminProxy
         */
        RemoteMethodControl inputProxy;
        Uuid inputProxyID;
        if( obj instanceof FiddlerProxy.ConstrainableFiddlerProxy ) {
            inputProxy = (RemoteMethodControl)((FiddlerProxy)obj).server;
            inputProxyID = ((ReferentUuid)obj).getReferentUuid();
        } else if
          (obj instanceof FiddlerRegistration.ConstrainableFiddlerRegistration)
        {
            FiddlerRegistration reg = (FiddlerRegistration)obj;
            if( !this.isTrustedObject( (reg.eventReg).getSource(), ctx) ) {
                return false;
            }//endif
            if( !this.isTrustedObject( (reg.eventReg).getLease(), ctx) ) {
                return false;
            }//endif
            inputProxy = (RemoteMethodControl)reg.server;
            /* FiddlerRegistration doesn't carry a proxyID. Default to the
             * cannonical proxyID to avoid complicated handler logic below.
             */
            inputProxyID = proxyID;
        } else if( obj instanceof FiddlerLease.ConstrainableFiddlerLease ) {
            inputProxy = (RemoteMethodControl)((FiddlerLease)obj).server;
            inputProxyID = ((FiddlerLease)obj).getServerID();
        } else if
             (obj instanceof FiddlerAdminProxy.ConstrainableFiddlerAdminProxy)
        {
            inputProxy = (RemoteMethodControl)((FiddlerAdminProxy)obj).server;
            inputProxyID = ((ReferentUuid)obj).getReferentUuid();
        } else if( obj instanceof RemoteMethodControl ) {
            /* This block handles the case where the inner proxy itself
             * (rather than an outer proxy that contains the inner proxy)
             * is being verified for trust. Unlike most of the outer proxies,
             * the inner proxy doesn't provide a means for obtaining the UUID
             * of the associated backend server. Thus, to avoid complicated
             * handler logic, for this case the cannonical proxyID is used
             * in the trust equivalence comparison that is performed below.
             */
            inputProxy = (RemoteMethodControl)obj;
            inputProxyID = proxyID;
        } else {
            return false;
        }//endif
        /* Get the client constraints currently set on the input proxy */
        final MethodConstraints mConstraints
                                        = inputProxy.getConstraints();
        /* Create a copy of the canonical proxy with its method constraints
         * replaced with the method constraints of the input proxy.
         */
        final TrustEquivalence constrainedInnerProxy =
             (TrustEquivalence)innerProxy.setConstraints(mConstraints);
View Full Code Here

TOP

Related Classes of net.jini.core.constraint.RemoteMethodControl

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.