Examples of InvocationConstraints


Examples of net.jini.core.constraint.InvocationConstraints

     */
    private static void checkConstraints(ServerCapabilities serverCapabilities,
           InvocationConstraints constraints)
  throws UnsupportedConstraintException
    {
  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);
View Full Code Here

Examples of net.jini.core.constraint.InvocationConstraints

      /*
       * Unmarshal method and check security constraints.
       */
      in = createMarshalInputStream(impl, request, integrity, context);
      method = unmarshalMethod(impl, in, context);
      InvocationConstraints sc =
    (serverConstraints == null ?
     InvocationConstraints.EMPTY :
     serverConstraints.getConstraints(method));
      if (integrity && !sc.requirements().contains(Integrity.YES)) {
    Collection requirements = new ArrayList(sc.requirements());
    requirements.add(Integrity.YES);
    sc = new InvocationConstraints(requirements, sc.preferences());
      }
     
      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))
View Full Code Here

Examples of net.jini.core.constraint.InvocationConstraints

                    if ((flags & 1) != 0) {
                        prefList.add(preferencesArray[i]);
                    }
                    flags >>= 1;
                }
                clientConstraints = new InvocationConstraints(reqList, prefList);
                ui.setClientProxyConstraints(clientConstraints);
                BasicMethodConstraints mc =
                    new BasicMethodConstraints(clientConstraints);
                try {
                    currentMethod =
View Full Code Here

Examples of net.jini.core.constraint.InvocationConstraints

     *
     * @param method the method to use to compute the combined constraints
     * @return the computed combined constraints
     */
    private InvocationConstraints getConstraints(TestMethod testMethod) {
        InvocationConstraints sc = testMethod.parseConstraints();
        return InvocationConstraints.combine(clientConstraints, sc);
    }
View Full Code Here

Examples of net.jini.core.constraint.InvocationConstraints

     * which were passed to the proxy when it's trust validator was called.
     *
     * @param method the <code>TestMethod</code> which was called.
     */
    private void checkClientConstraints(TestMethod testMethod) {
        InvocationConstraints c = null;
        c = iface.getConstraints().getConstraints(testMethod.getMethod());
        logger.log(CLIENTCONSTRAINTS, "client constraints from proxy: " + c);
        Collection imposedRequirements = new ArrayList(    // need mutable set
            clientConstraints.requirements());
        Set observedRequirements = c.requirements();
        Iterator it = observedRequirements.iterator();
        while (it.hasNext()) {
            Object obj = it.next();
            if (!imposedRequirements.contains(obj)) {
                logFailure("unexpected client constraint " + obj + " "
View Full Code Here

Examples of net.jini.core.constraint.InvocationConstraints

        InvocationConstraints combinedConstraints) {
        logger.log(INTERNALCALLS,
            "Entering checkCombinedConstraints(method, context)");
        logger.log(COMBINEDCONSTRAINTS,
            "combined constraints: " + combinedConstraints);
        InvocationConstraints sc = method.parseConstraints();
        sc = InvocationConstraints.combine(sc, clientConstraints);
        Set imposedRequirements = sc.requirements();
        /* combined requirements must be mutable */
        Set combinedRequirements =
        new HashSet(combinedConstraints.requirements());
        Iterator it = imposedRequirements.iterator();
        while (it.hasNext()) {
            InvocationConstraint c = (InvocationConstraint)it.next();
            if (!combinedRequirements.contains(c)) {
                logFailure("Combined constraint is missing constraint " + c);
            }
            combinedRequirements.remove(c);
        }
        if (!combinedRequirements.isEmpty()) {
            InvocationConstraints residual =
                new InvocationConstraints(combinedRequirements, null);
            logFailure("Combined constraints contains extra "
                + "constraints: " + residual);
        }
        logger.log(INTERNALCALLS, "Leaving checkCombinedConstraints"
            +"(method, context)");
View Full Code Here

Examples of net.jini.core.constraint.InvocationConstraints

        ArrayList mcArray = new ArrayList();
        TestMethod[] methods =
                    TestMethod.getDeclaredMethods(ConstraintsInterface.class);
        BasicMethodConstraints.MethodDesc desc = null;
        TestMethod multiMethod = null;
        InvocationConstraints constraints;
        for (int i=0; i<methods.length; i++) {
        if (methods[i].getName().equals("vAuthConf")) {
            continue;
        }
        if (methods[i].getName().equals("multi")) {
            multiMethod = methods[i];
            continue;
        }
        constraints = methods[i].parseConstraints();
        Class[] types = methods[i].getParameterTypes();
        desc = new BasicMethodConstraints.MethodDesc(
                            methods[i].getName(),
                            types,
                            constraints);
        mcArray.add(desc);
        }

        /*
             * no constraints for the getProxyVerifier, unexport, or
         * callAfterUnexport methods. This is done to ensure that
         * these calls will be performed regardless of client
         * constraints (assuming the client's constraints don't conflict)
         */
        mcArray.add(
            new BasicMethodConstraints.MethodDesc(
                                      "getProxyVerifier",
                       new Class[]{},
                       InvocationConstraints.EMPTY));
        mcArray.add(
            new BasicMethodConstraints.MethodDesc(
                                      "unexport",
                       new Class[]{},
                       InvocationConstraints.EMPTY));
        mcArray.add(
            new BasicMethodConstraints.MethodDesc(
                                      "callAfterUnexport",
                       new Class[]{},
                       InvocationConstraints.EMPTY));

        /*
         * The multi descriptor must follow all of the more qualified
         * entries. Need to test for null because sometimes when
         * debugging the multi methods are removed from the interface
         */
        if (multiMethod != null) {
        constraints = multiMethod.parseConstraints();
        mcArray.add(
            new BasicMethodConstraints.MethodDesc("multi",
                                   constraints));
        }

        /* default constraints must be dead last */
        InvocationConstraints defaultConstraints = new InvocationConstraints(
                              new InvocationConstraint[]{ClientAuthentication.YES,
                                               Confidentiality.YES},
                              null);
        mcArray.add(
            new BasicMethodConstraints.MethodDesc(defaultConstraints));
View Full Code Here

Examples of net.jini.core.constraint.InvocationConstraints

    /**
     * Implementation of interface method.
     */
    public InvocationConstraints getConstraints(Method method) {
        return new InvocationConstraints(required_ic,null);
    }
View Full Code Here

Examples of net.jini.core.constraint.InvocationConstraints

      public boolean hasNext() {
    return i > 0;
      }
      public Object next() {
    if (i > 0) {
        return new InvocationConstraints(
                        new InvocationConstraint[] { required_ic[--i] },
                        null);
    } else if (i == 0) {
                    --i;
        return InvocationConstraints.EMPTY;
View Full Code Here

Examples of net.jini.core.constraint.InvocationConstraints

           
            // 1
            String name = "someMethod";
            Class[] types = new Class[] {int.class, Object.class};
            InvocationConstraint ic = Delegation.YES;
            InvocationConstraints constraints = new InvocationConstraints(
                    ic, null);
            callConstructor(testCase, name, types, constraints);
           
            // 2
            if (testCase == case2arg) {
                name = "*someMethod";
                callConstructor(testCase, name, types, constraints);

                name = "*5someMethod";
                callConstructor(testCase, name, types, constraints);
            }
           
            // 3
            if (testCase == case2arg) {
                name = "someMethod*";
                callConstructor(testCase, name, types, constraints);
            }
           
            // 4
            if (testCase == case3arg) {
                name = "someMethod";
                Class[] storedTypes = new Class[types.length];
                for (int j = 0; j < types.length; ++j) {
                    storedTypes[j] = types[j];
                }
                callConstructor(testCase, name, types, constraints);
                if (storedTypes.length != types.length) {
                    throw new TestException(
                            "types array length was modified");
                }
                for (int j = 0; j < types.length; ++j) {
                    if (storedTypes[j] != types[j]) {
                        throw new TestException(
                                "types array was modified");
                    }
                }
               
            }
           
            // 5
            if (testCase == case3arg) {
                name = "someMethod";
                Class[] types2 = new Class[types.length];
                for (int j = 0; j < types.length; ++j) {
                    types2[j] = types[j];
                }
                MethodDesc md1 =
                    callConstructor(testCase, name, types, constraints);
                MethodDesc md2 =
                    callConstructor(testCase, name, types2, constraints);
                if (!md1.equals(md2)) {
                    throw new TestException(
                            "MethodDesc objects should be equal");
                }
                types2[0] = long.class;
                if (!md1.equals(md2)) {
                    throw new TestException(
                            "MethodDesc objects should be equal");
                }
            }
           
            // 6
            name = "someMethod";
            InvocationConstraints emptyConstraints = new InvocationConstraints(
                    (InvocationConstraint) null, null);
            MethodDesc md1 =
                callConstructor(testCase, name, types, emptyConstraints);
            MethodDesc md2 =
                callConstructor(testCase, name, types, null);
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.