src/share/jaxws_classes/com/sun/xml/internal/ws/policy/spi/PolicyAssertionValidator.java

Thu, 12 Oct 2017 19:44:07 +0800

author
aoqi
date
Thu, 12 Oct 2017 19:44:07 +0800
changeset 760
e530533619ec
parent 0
373ffda63c9a
permissions
-rw-r--r--

merge

     1 /*
     2  * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     8  * particular file as subject to the "Classpath" exception as provided
     9  * by Oracle in the LICENSE file that accompanied this code.
    10  *
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    14  * version 2 for more details (a copy is included in the LICENSE file that
    15  * accompanied this code).
    16  *
    17  * You should have received a copy of the GNU General Public License version
    18  * 2 along with this work; if not, write to the Free Software Foundation,
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    20  *
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    22  * or visit www.oracle.com if you need additional information or have any
    23  * questions.
    24  */
    26 package com.sun.xml.internal.ws.policy.spi;
    28 import com.sun.xml.internal.ws.policy.PolicyAssertion;
    30 /**
    31  *
    32  *
    33  * @author Marek Potociar (marek.potociar at sun.com)
    34  */
    35 public interface PolicyAssertionValidator {
    37     public static enum Fitness {
    38         UNKNOWN,
    39         INVALID,
    40         UNSUPPORTED,
    41         SUPPORTED;
    43         public Fitness combine(Fitness other) {
    44             if (this.compareTo(other) < 0) {
    45                 return other;
    46             } else {
    47                 return this;
    48             }
    49         }
    50     }
    53     /**
    54      * An implementation of this method must return:
    55      * <ul>
    56      *      <li>
    57      *          {@code Fitness.UNKNOWN} if the policy assertion type is not recognized
    58      *      </li>
    59      *      <li>
    60      *          {@code Fitness.SUPPORTED} if the policy assertion is supported in the
    61      *          client-side context
    62      *      </li>
    63      *      <li>
    64      *          {@code Fitness.UNSUPPORTED} if the policy assertion is recognized however
    65      *          it's content is not supported. For each assetion that will be eventually marked with
    66      *          this validation value, the policy processor will log a WARNING message however
    67      *          an attempt to call the web service will be made.
    68      *      </li>
    69      *      <li>
    70      *          {@code Fitness.INVALID} if the policy assertion is recognized however
    71      *          its content (value, parameters, nested assertions) is invalid. For each assetion
    72      *          that will be eventually marked with this validation value, the policy processor
    73      *          will log a SEVERE error and throw an exception. No further attempts to call
    74      *          the web service will be made.
    75      *      </li>
    76      * </ul>
    77      *
    78      * @param assertion A policy asssertion (See {@link com.sun.xml.internal.ws.policy.PolicyAssertion PolicyAssertion}).
    79      * May contain nested policies and assertions.
    80      * @return fitness of the {@code assertion} on in the client-side context. Must not be {@code null}.
    81      */
    82     public Fitness validateClientSide(PolicyAssertion assertion);
    84     /**
    85      * An implementation of this method must return:
    86      * <ul>
    87      *      <li>
    88      *          {@code Fitness.UNKNOWN} if the policy assertion type is not recognized
    89      *      </li>
    90      *      <li>
    91      *          {@code Fitness.SUPPORTED} if the policy assertion is supported in the
    92      *          server-side context
    93      *      </li>
    94      *      <li>
    95      *          {@code Fitness.UNSUPPORTED} if the policy assertion is recognized however
    96      *          it's content is not supported.
    97      *      </li>
    98      *      <li>
    99      *          {@code Fitness.INVALID} if the policy assertion is recognized however
   100      *          its content (value, parameters, nested assertions) is invalid.
   101      *      </li>
   102      * </ul>
   103      *
   104      * For each assetion that will be eventually marked with validation value of
   105      * UNKNOWN, UNSUPPORTED or INVALID, the policy processor will log a SEVERE error
   106      * and throw an exception.
   107      *
   108      * @param assertion A policy asssertion (See {@link com.sun.xml.internal.ws.policy.PolicyAssertion PolicyAssertion}).
   109      * May contain nested policies and assertions.
   110      * @return fitness of the {@code assertion} on in the server-side context. Must not be {@code null}.
   111      */
   112     public Fitness validateServerSide(PolicyAssertion assertion);
   114     /**
   115      * Each service provider that implements this SPI must make sure to identify all possible domains it supports.
   116      * This operation must be implemented as idempotent (must return same values on multiple calls).
   117      * <p/>
   118      * It is legal for two or more {@code PolicyAssertionValidator}s to support the same domain. In such case,
   119      * the most significant result returned from validation methods will be eventually assigned to the assertion.
   120      * The significance of validation results is as follows (from most to least significant):
   121      * <ol>
   122      *      <li>SUPPORTED</li>
   123      *      <li>UNSUPPORTED</li>
   124      *      <li>INVALID</li>
   125      *      <li>UNKNOWN</li>
   126      * </ol>
   127      *
   128      *
   129      * @return {@code String} array holding {@code String} representations of identifiers of all supported domains.
   130      * Usually a domain identifier is represented by a namespace.
   131      */
   132     public String[] declareSupportedDomains();
   133 }

mercurial