Examples of InvocationConstraint


Examples of net.jini.core.constraint.InvocationConstraint

  if (c instanceof ConstraintAlternatives) {
      Set alts = ((ConstraintAlternatives) c).elements();
      Class type = null;
      for (Iterator iter = alts.iterator(); iter.hasNext(); ) {
    InvocationConstraint alt= (InvocationConstraint) iter.next();
    if (type == null) {
        type = alt.getClass();
    } else if (type != alt.getClass()) {
        return false; // does not support heterogenous alternatives
    }
    if (isSupportableConstraint(alt))
        return true;
      }
View Full Code Here

Examples of net.jini.core.constraint.InvocationConstraint

     repeated here to support ConstraintAlternatives. */

  if (c instanceof ConstraintAlternatives) {
      Set elems = ((ConstraintAlternatives) c).elements();
      for (Iterator iter = elems.iterator(); iter.hasNext(); ) {
    InvocationConstraint elem =
        (InvocationConstraint) iter.next();
    if (isSatisfiable(config, elem))
        return true;
      }
      return false;
View Full Code Here

Examples of net.jini.core.constraint.InvocationConstraint

     */
    static boolean containsConstraint(
  Set constraints, InvocationConstraint candidate)
    {
  for (Iterator iter = constraints.iterator(); iter.hasNext(); ) {
      InvocationConstraint c = (InvocationConstraint) iter.next();
      if (c instanceof ConstraintAlternatives) {
    Set elems = ((ConstraintAlternatives) c).elements();
    return elems.contains(candidate);
      } else if (c.equals(candidate)) {
    return true;
      }
  }
  return false;
    }
View Full Code Here

Examples of net.jini.core.constraint.InvocationConstraint

    }

    private static Set getUnfulfilled(Set constraints) {
  Set unfulfilled = new HashSet(constraints.size());
  for (Iterator i = constraints.iterator(); i.hasNext(); ) {
      InvocationConstraint c = (InvocationConstraint) i.next();
      if (c instanceof ConstraintAlternatives) {
    Set s = ((ConstraintAlternatives) c).elements();
    Set u = getUnfulfilled(s);
    if (u.size() == s.size()) {
        unfulfilled.add(c);
View Full Code Here

Examples of net.jini.core.constraint.InvocationConstraint

  private Set reduce(Set reduced, Set constraints, boolean required)
      throws UnsupportedConstraintException
  {
      for (Iterator i = constraints.iterator(); i.hasNext(); ) {
    InvocationConstraint c = (InvocationConstraint) i.next();

    Set toReduce = Collections.EMPTY_SET;
    if (targetClass.isInstance(c)) {
        toReduce = Collections.singleton(c);
    } else if (c instanceof ConstraintAlternatives) {
View Full Code Here

Examples of net.jini.core.constraint.InvocationConstraint

      throws UnsupportedConstraintException
  {
      KerberosPrincipal principal = null;
      for (Iterator i = constraints.requirements().iterator(); i.hasNext(); )
      {
    InvocationConstraint c = (InvocationConstraint) i.next();
    if (c instanceof ServerMinPrincipal) {
        Set s = ((ServerMinPrincipal) c).elements();
        if (s.size() > 1) {
      throw new UnsupportedConstraintException(
          "multiple server principals");
        }
        Principal p = (Principal) s.iterator().next();
        if (!(p instanceof KerberosPrincipal)) {
      throw new UnsupportedConstraintException(
          "non-kerberos server principal");
        }
        if (principal == null) {
      principal = (KerberosPrincipal) p;
        } else if (!principal.equals(p)) {
      throw new UnsupportedConstraintException(
          "multiple server principals");
        }
    }
    // NYI: support ConstraintAlternatives with ServerMinPrincipals
      }
      if (principal != null) {
    return principal;
      }
      for (Iterator i = constraints.preferences().iterator(); i.hasNext(); )
      {
    InvocationConstraint c = (InvocationConstraint) i.next();
    if (c instanceof ServerMinPrincipal) {
        Set s = ((ServerMinPrincipal) c).elements();
        for (Iterator j = s.iterator(); j.hasNext(); ) {
      Principal p = (Principal) j.next();
      if (p instanceof KerberosPrincipal) {
View Full Code Here

Examples of net.jini.core.constraint.InvocationConstraint

    {
  InvocationConstraints unfulfilled =
      serverCapabilities.checkConstraints(constraints);
  for (Iterator i = unfulfilled.requirements().iterator(); i.hasNext();)
  {
      InvocationConstraint c = (InvocationConstraint) i.next();
      if (!(c instanceof Integrity)) {
    throw new UnsupportedConstraintException(
        "cannot satisfy unfulfilled constraint: " + c);
      }
      // REMIND: support ConstraintAlternatives containing Integrity?
View Full Code Here

Examples of net.jini.core.constraint.InvocationConstraint

     
      InvocationConstraints unfulfilled = request.checkConstraints(sc);
      for (Iterator i = unfulfilled.requirements().iterator();
     i.hasNext();)
      {
    InvocationConstraint c = (InvocationConstraint) i.next();
    if (!(c instanceof Integrity) ||
        (!integrity && c == Integrity.YES))
    {
        throw new UnsupportedConstraintException(
            "cannot satisfy unfulfilled constraint: " + c);
View Full Code Here

Examples of net.jini.core.constraint.InvocationConstraint

            logger.log(Level.INFO, "--> " + testCase);
           
            // 1
            String name = "someMethod";
            Class[] types = new Class[] {int.class, Object.class};
            InvocationConstraint ic = Delegation.YES;
            InvocationConstraints constraints = new InvocationConstraints(
                    ic, null);
            MethodDesc md = callConstructor(testCase, name, types, constraints);
            String result = md.toString();
            if (result.length() == 0) {
View Full Code Here

Examples of net.jini.core.constraint.InvocationConstraint

      InvocationConstraints unfulfilled =
    request.getUnfulfilledConstraints();
      for (Iterator i = unfulfilled.requirements().iterator();
     i.hasNext();)
      {
    InvocationConstraint c = (InvocationConstraint) i.next();
    if (c == Integrity.YES) {
        integrity = true;
    } else if (!(c instanceof Integrity)) {
        throw new UnsupportedConstraintException(
      "cannot satisfy unfulfilled constraint: " + c);
    }
    // REMIND: support ConstraintAlternatives containing Integrity?
      }

      /*
       * Even if Integrity.YES wasn't a requirement, we will
       * satisfy a preference for it.
       */
      if (!integrity) {
    for (Iterator i = unfulfilled.preferences().iterator();
         i.hasNext();)
    {
        InvocationConstraint c = (InvocationConstraint) i.next();
        if (c == Integrity.YES) {
      integrity = true;
      break// no need to examine preferences further
        }
        // NYI: support ConstraintAlternatives containing Integrity
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.