Examples of MethodConstraints


Examples of net.jini.core.constraint.MethodConstraints

                                                    (COMPONENT_NAME,
                                                     "registrarPreparer",
                                                     ProxyPreparer.class,
                                                     new BasicProxyPreparer());
  /* constraints */
  MethodConstraints constraints = (MethodConstraints)config.getEntry
                (COMPONENT_NAME,
                 "discoveryConstraints",
                 MethodConstraints.class,
                 null);
  if (constraints == null) {
      constraints =
    new BasicMethodConstraints(InvocationConstraints.EMPTY);
  }
  multicastRequestConstraints = DiscoveryConstraints.process(
      constraints.getConstraints(
    DiscoveryConstraints.multicastRequestMethod));
  multicastAnnouncementConstraints = DiscoveryConstraints.process(
      constraints.getConstraints(
    DiscoveryConstraints.multicastAnnouncementMethod));
  rawUnicastDiscoveryConstraints =
      constraints.getConstraints(
    DiscoveryConstraints.unicastDiscoveryMethod);

        /* Task manager */
        try {
            taskManager = (TaskManager)config.getEntry(COMPONENT_NAME,
View Full Code Here

Examples of net.jini.core.constraint.MethodConstraints

    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

Examples of net.jini.core.constraint.MethodConstraints

    throw new IllegalArgumentException
                                 ("LookupLocator has been discovered already");
      }
      InvocationConstraints ic = InvocationConstraints.EMPTY;
      if (l instanceof RemoteMethodControl) {
    MethodConstraints mc =
        ((RemoteMethodControl) l).getConstraints();
    if (mc != null) {
        ic = mc.getConstraints(getRegistrarMethod);
    }
      }
      try {
                doUnicastDiscovery(l, ic);
    time = System.currentTimeMillis();//mark the time of discovery
View Full Code Here

Examples of net.jini.core.constraint.MethodConstraints

      }
  }

  protected MethodConstraints getMethodConstraints(Object proxy) {
      try {
    MethodConstraints result = super.getMethodConstraints(proxy);
    if (methodConstraintsSpecified) {
        if (!safeEquals(result, methodConstraints)) {
      throw new Test.FailedException(
          "Wrong methodConstraints: " + result);
        }
    } else if (proxy instanceof RemoteMethodControl) {
        MethodConstraints proxyConstraints =
      ((RemoteMethodControl) proxy).getConstraints();
        if (!safeEquals(result, proxyConstraints)) {
      throw new Test.FailedException(
          "Wrong methodConstraints: " + result);
        }
View Full Code Here

Examples of net.jini.core.constraint.MethodConstraints

    protected void verify(Object proxy) throws RemoteException {
  if (proxy == null) {
      throw new NullPointerException("Proxy cannot be null");
  } else if (verify) {
      MethodConstraints mc = getMethodConstraints(proxy);
      Security.verifyObjectTrust(
    proxy, getClass().getClassLoader(),
    mc == null ? Collections.EMPTY_SET : Collections.singleton(mc));
  }
    }
View Full Code Here

Examples of net.jini.core.constraint.MethodConstraints

      return false;

        /* Get the client constraints currently set on the server reference
   * of contained in the input proxy
   */
        final MethodConstraints mConstraints =
      inputProxyServer.getConstraints();

        /* Create a copy of the canonical server reference with its method
   * constraints replaced with the method constraints on
   * server reference of the input proxy.
View Full Code Here

Examples of net.jini.core.constraint.MethodConstraints

         *  applied to the given client method constraints.
         */
        private static Fiddler constrainServer( Fiddler server,
                                                MethodConstraints constraints )
        {
            MethodConstraints newConstraints
               = ConstrainableProxyUtil.translateConstraints(constraints,
                                                             methodMapArray);
            RemoteMethodControl constrainedServer =
                ((RemoteMethodControl)server).setConstraints(newConstraints);

View Full Code Here

Examples of net.jini.core.constraint.MethodConstraints

      new Subject(true,
      Collections.singleton(new X500Principal("CN=bob")),
      Collections.EMPTY_SET, Collections.EMPTY_SET);
  final SslServerEndpoint se =
      SslServerEndpoint.getInstance(s, null, null, 0);
  final MethodConstraints nomc =
      new BasicMethodConstraints(InvocationConstraints.EMPTY);
  final InvocationLayerFactory uilf =
      new BasicILFactory(nomc, null);
  // check that null server endpoint throws NPE
  try {
      new BasicJeriExporter(null, uilf);
      throw new RuntimeException("null endpoint did not cause NPE");
  } catch (NullPointerException e) {
  }
  // check that null il factory throws NPE
  try {
      new BasicJeriExporter(se, null);
      throw new RuntimeException("null il factory did not cause NPE");
  } catch (NullPointerException e) {
  }
  InvocationConstraints sauth =
      new InvocationConstraints(ServerAuthentication.YES, null);
  MethodConstraints samc = new BasicMethodConstraints(sauth);
  final InvocationLayerFactory ailf =
      new BasicILFactory(samc, null);
  // check that subject cannot satisfy server authentication
  BasicJeriExporter exp = new BasicJeriExporter(se, ailf);
  try {
View Full Code Here

Examples of net.jini.core.constraint.MethodConstraints

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

Examples of net.jini.core.constraint.MethodConstraints

  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(ProxyVerifier.class.getName(), "isTrustedObject",
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.