Package net.jini.core.constraint

Examples of net.jini.core.constraint.MethodConstraints


                    + " as expected.");
        }
        proxy = new RMCImpl();
        m = RemoteMethodControl.class.getDeclaredMethod(
                "setConstraints", new Class[] { MethodConstraints.class });
        MethodConstraints mc = new BasicMethodConstraints(
                new InvocationConstraints(
                    new InvocationConstraint[] { ClientAuthentication.YES },
                    null));

        try {
View Full Code Here


      } else if (!(obj instanceof ConstrainableProxy)) {
    return false;
      }
      RemoteMethodControl otherServerProxy =
    (RemoteMethodControl) ((ConstrainableProxy) obj).serverProxy;
      MethodConstraints mc = otherServerProxy.getConstraints();
      TrustEquivalence trusted =
    (TrustEquivalence) serverProxy.setConstraints(mc);
      return trusted.checkTrustEquivalence(otherServerProxy);
  }
View Full Code Here

    lookupAttrs = baseAttrs;
      }
  }

  /* fetch remaining config entries */
  MethodConstraints discoveryConstraints =
      (MethodConstraints) config.getEntry(COMPONENT,
            "discoveryConstraints",
            MethodConstraints.class, null);
  if (discoveryConstraints == null) {
      discoveryConstraints =
    new BasicMethodConstraints(InvocationConstraints.EMPTY);
  }
  try {
      discoer = (DiscoveryManagement) config.getEntry(
    COMPONENT, "discoveryManager", DiscoveryManagement.class);
  } catch (NoSuchEntryException e) {
      discoer = new LookupDiscoveryManager(
    DiscoveryGroupManagement.NO_GROUPS, null, null, config);
  }
  listenerPreparer = (ProxyPreparer) Config.getNonNullEntry(
      config, COMPONENT, "listenerPreparer", ProxyPreparer.class,
      listenerPreparer);
  locatorPreparer = (ProxyPreparer) Config.getNonNullEntry(
      config, COMPONENT, "locatorPreparer", ProxyPreparer.class,
      locatorPreparer);
  minMaxEventLease = Config.getLongEntry(
      config, COMPONENT, "minMaxEventLease",
      minMaxEventLease, 1, MAX_LEASE);
  minMaxServiceLease = Config.getLongEntry(
      config, COMPONENT, "minMaxServiceLease",
      minMaxServiceLease, 1, MAX_LEASE);
  minRenewalInterval = Config.getLongEntry(
      config, COMPONENT, "minRenewalInterval",
      minRenewalInterval, 0, MAX_RENEW);
  multicastAnnouncementInterval = Config.getLongEntry(
      config, COMPONENT, "multicastAnnouncementInterval",
      multicastAnnouncementInterval, 1, Long.MAX_VALUE);

  multicastInterfaceRetryInterval = Config.getIntEntry(
      config, COMPONENT, "multicastInterfaceRetryInterval",
      multicastInterfaceRetryInterval, 1, Integer.MAX_VALUE);
  try {
      multicastInterfaces = (NetworkInterface[]) config.getEntry(
    COMPONENT, "multicastInterfaces", NetworkInterface[].class);
      multicastInterfacesSpecified = true;
  } catch (NoSuchEntryException e) {
      Enumeration en = NetworkInterface.getNetworkInterfaces();
      List l = (en != null) ?
    Collections.list(en) : Collections.EMPTY_LIST;
      multicastInterfaces = (NetworkInterface[])
    l.toArray(new NetworkInterface[l.size()]);
      multicastInterfacesSpecified = false;
  }
  if (multicastInterfaces == null) {
      logger.config("using system default interface for multicast");
  } else if (multicastInterfaces.length == 0) {
      if (multicastInterfacesSpecified) {
    logger.config("multicast disabled");
      } else {
    logger.severe("no network interfaces detected");
      }
  } else if (logger.isLoggable(Level.CONFIG)) {
      logger.log(Level.CONFIG, "multicasting on interfaces {0}",
           new Object[]{ Arrays.asList(multicastInterfaces) });
  }

  try {
      multicastRequestSubjectChecker =
    (ClientSubjectChecker) Config.getNonNullEntry(
        config, COMPONENT, "multicastRequestSubjectChecker",
        ClientSubjectChecker.class);
  } catch (NoSuchEntryException e) {
      // leave null
  }
  resourceIdGenerator = (UuidGenerator) Config.getNonNullEntry(
      config, COMPONENT, "resourceIdGenerator", UuidGenerator.class,
      resourceIdGenerator);
  serviceIdGenerator = (UuidGenerator) Config.getNonNullEntry(
      config, COMPONENT, "serviceIdGenerator", UuidGenerator.class,
      serviceIdGenerator);
  tasker = (TaskManager) Config.getNonNullEntry(
      config, COMPONENT, "taskManager", TaskManager.class,
      new TaskManager(50, 1000 * 15, 1.0F));
  unexportTimeout = Config.getLongEntry(
         config, COMPONENT, "unexportTimeout", unexportTimeout,
         0, Long.MAX_VALUE);
  unexportWait = Config.getLongEntry(
         config, COMPONENT, "unexportWait", unexportWait,
         0, Long.MAX_VALUE);
  String unicastDiscoveryHost;
  try {
      unicastDiscoveryHost = (String) Config.getNonNullEntry(
    config, COMPONENT, "unicastDiscoveryHost", String.class);
  } catch (NoSuchEntryException e) {
      // fix for 4906732: only invoke getCanonicalHostName if needed
      unicastDiscoveryHost =
    InetAddress.getLocalHost().getCanonicalHostName();
  }
  try {
      unicastDiscoverySubjectChecker =
    (ClientSubjectChecker) Config.getNonNullEntry(
        config, COMPONENT, "unicastDiscoverySubjectChecker",
        ClientSubjectChecker.class);
  } catch (NoSuchEntryException e) {
      // leave null
  }

  /* initialize state based on recovered/configured values */
  objectServiceType = new ServiceType(Object.class, null, null);
  computeMaxLeases();
  protocol2 = Discovery.getProtocol2(null);
  /* cache unprocessed unicastDiscovery constraints to handle
           reprocessing of time constraints associated with that method */
  rawUnicastDiscoveryConstraints = discoveryConstraints.getConstraints(
         DiscoveryConstraints.unicastDiscoveryMethod);   
  multicastRequestConstraints = DiscoveryConstraints.process(
      discoveryConstraints.getConstraints(
    DiscoveryConstraints.multicastRequestMethod));
  multicastAnnouncementConstraints = DiscoveryConstraints.process(
      discoveryConstraints.getConstraints(
    DiscoveryConstraints.multicastAnnouncementMethod));
  unicastDiscoveryConstraints = DiscoveryConstraints.process(
      rawUnicastDiscoveryConstraints);
  serviceExpirer = new ServiceExpireThread();
  eventExpirer = new EventExpireThread();
View Full Code Here

  throws RemoteException
    {
  if (obj == null || ctx == null) {
      throw new NullPointerException();
  }
  MethodConstraints mc = null;
  UntrustedObjectSecurityContext uosc = null;
  for (Iterator iter = ctx.getCallerContext().iterator();
       (mc == null || uosc == null) && iter.hasNext(); )
  {
      Object elt = iter.next();
      if (mc == null && elt instanceof MethodConstraints) {
    MethodConstraints emc = (MethodConstraints) elt;
    if (!emc.getConstraints(gpvMethod).isEmpty()) {
        mc = emc;
    }
      } else if (uosc == null &&
           elt instanceof UntrustedObjectSecurityContext)
      {
View Full Code Here

     *         does not implement <code>RemoteMethodControl</code>.
     */
    private static OutriggerAdmin constrainServer(OutriggerAdmin server,
        MethodConstraints constraints)
    {
  final MethodConstraints serverRefConstraints
      = ConstrainableProxyUtil.translateConstraints(constraints,
                methodMapArray);
  final RemoteMethodControl constrainedServer =
      ((RemoteMethodControl)server).
      setConstraints(serverRefConstraints);
View Full Code Here

      logger.log(Level.FINEST, "Object {0} is not a supported type",
    obj);
      return false;
  }

  MethodConstraints mc = otherServerProxy.getConstraints();
  TrustEquivalence trusted =
      (TrustEquivalence) serverProxy.setConstraints(mc);
  boolean result = trusted.checkTrustEquivalence(otherServerProxy);
  logger.exiting(ProxyVerifier.class.getName(), "isTrustedObject",
      Boolean.valueOf(result));
View Full Code Here

  if ((inputProxyID != null) &&
      !(proxyID.equals(inputProxyID))) {
      return false;
  }

  MethodConstraints mc = otherServerProxy.getConstraints();
  TrustEquivalence trusted =
      (TrustEquivalence) serverProxy.setConstraints(mc);
  boolean result = trusted.checkTrustEquivalence(otherServerProxy);
  if (logger.isLoggable(Level.FINER)) {
      logger.exiting(proxyVerifierSourceClass, "isTrustedObject",
View Full Code Here

       
        // 1 returns the value of methodConstraints
        boolean verify = true;
        Permission[] perm = new Permission[] {
                    new RuntimePermission("setClassLoader")};
        MethodConstraints mc = new FakeMethodConstraints(
                    new InvocationConstraint[] {Integrity.YES});
        FakeBasicProxyPreparer fbpp = callFakeConstructor(
                3, verify, mc, perm);
        Object proxy = new Object();
        if (fbpp.getMethodConstraints(proxy) != mc) {
            throw new TestException(
                    "getMethodConstraints method returns invalid value");
        }

        // 2 returns the value of proxy.getConstraints
        MethodConstraints mc2 = new FakeMethodConstraints(
                    new InvocationConstraint[] {Integrity.NO});
        FakeRemoteMethodControl frmc = new FakeRemoteMethodControl();
        proxy = frmc.setConstraints(mc2);
        fbpp = callFakeConstructor(
                2, verify, mc, perm);
        logger.log(Level.INFO, fbpp.toString());
        MethodConstraints mc3 = fbpp.getMethodConstraints(proxy);
        logger.log(Level.INFO, mc3.toString());
        if (fbpp.getMethodConstraints(proxy) != mc2) {
            throw new TestException(
                    "getMethodConstraints method returns invalid value");
        }
View Full Code Here

        // 1 If proxy is null, throws a NullPointerException
        boolean verify = true;
        Permission[] perm = new Permission[] {
                    new RuntimePermission("setClassLoader")};
        MethodConstraints mc = new FakeMethodConstraints(
                    new InvocationConstraint[] {Integrity.YES});
        FakeBasicProxyPreparer fbpp = callFakeConstructor(
                3, verify, mc, perm);
        try {
            fbpp.verify(null);
View Full Code Here

                ++exIndex;
            }

            // check that parameters for checked method are ok
            if (expResults.objs[i] instanceof BaseProxyTrust) {
                MethodConstraints mc = ((BaseProxyTrust)
                        expResults.objs[i]).getConstraints();

                if (expResults.mc != mc) {
                    // FAIL
                    return "'" + expResults.objs[i].getMethodName()
View Full Code Here

TOP

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

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.