aoqi@0: /* aoqi@0: * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. aoqi@0: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. aoqi@0: * aoqi@0: * This code is free software; you can redistribute it and/or modify it aoqi@0: * under the terms of the GNU General Public License version 2 only, as aoqi@0: * published by the Free Software Foundation. Oracle designates this aoqi@0: * particular file as subject to the "Classpath" exception as provided aoqi@0: * by Oracle in the LICENSE file that accompanied this code. aoqi@0: * aoqi@0: * This code is distributed in the hope that it will be useful, but WITHOUT aoqi@0: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or aoqi@0: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License aoqi@0: * version 2 for more details (a copy is included in the LICENSE file that aoqi@0: * accompanied this code). aoqi@0: * aoqi@0: * You should have received a copy of the GNU General Public License version aoqi@0: * 2 along with this work; if not, write to the Free Software Foundation, aoqi@0: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. aoqi@0: * aoqi@0: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA aoqi@0: * or visit www.oracle.com if you need additional information or have any aoqi@0: * questions. aoqi@0: */ aoqi@0: aoqi@0: package com.sun.xml.internal.ws.policy.spi; aoqi@0: aoqi@0: import com.sun.xml.internal.ws.policy.PolicyAssertion; aoqi@0: aoqi@0: /** aoqi@0: * aoqi@0: * aoqi@0: * @author Marek Potociar (marek.potociar at sun.com) aoqi@0: */ aoqi@0: public interface PolicyAssertionValidator { aoqi@0: aoqi@0: public static enum Fitness { aoqi@0: UNKNOWN, aoqi@0: INVALID, aoqi@0: UNSUPPORTED, aoqi@0: SUPPORTED; aoqi@0: aoqi@0: public Fitness combine(Fitness other) { aoqi@0: if (this.compareTo(other) < 0) { aoqi@0: return other; aoqi@0: } else { aoqi@0: return this; aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: aoqi@0: /** aoqi@0: * An implementation of this method must return: aoqi@0: * aoqi@0: * aoqi@0: * @param assertion A policy asssertion (See {@link com.sun.xml.internal.ws.policy.PolicyAssertion PolicyAssertion}). aoqi@0: * May contain nested policies and assertions. aoqi@0: * @return fitness of the {@code assertion} on in the client-side context. Must not be {@code null}. aoqi@0: */ aoqi@0: public Fitness validateClientSide(PolicyAssertion assertion); aoqi@0: aoqi@0: /** aoqi@0: * An implementation of this method must return: aoqi@0: * aoqi@0: * aoqi@0: * For each assetion that will be eventually marked with validation value of aoqi@0: * UNKNOWN, UNSUPPORTED or INVALID, the policy processor will log a SEVERE error aoqi@0: * and throw an exception. aoqi@0: * aoqi@0: * @param assertion A policy asssertion (See {@link com.sun.xml.internal.ws.policy.PolicyAssertion PolicyAssertion}). aoqi@0: * May contain nested policies and assertions. aoqi@0: * @return fitness of the {@code assertion} on in the server-side context. Must not be {@code null}. aoqi@0: */ aoqi@0: public Fitness validateServerSide(PolicyAssertion assertion); aoqi@0: aoqi@0: /** aoqi@0: * Each service provider that implements this SPI must make sure to identify all possible domains it supports. aoqi@0: * This operation must be implemented as idempotent (must return same values on multiple calls). aoqi@0: *

aoqi@0: * It is legal for two or more {@code PolicyAssertionValidator}s to support the same domain. In such case, aoqi@0: * the most significant result returned from validation methods will be eventually assigned to the assertion. aoqi@0: * The significance of validation results is as follows (from most to least significant): aoqi@0: *

    aoqi@0: *
  1. SUPPORTED
  2. aoqi@0: *
  3. UNSUPPORTED
  4. aoqi@0: *
  5. INVALID
  6. aoqi@0: *
  7. UNKNOWN
  8. aoqi@0: *
aoqi@0: * aoqi@0: * aoqi@0: * @return {@code String} array holding {@code String} representations of identifiers of all supported domains. aoqi@0: * Usually a domain identifier is represented by a namespace. aoqi@0: */ aoqi@0: public String[] declareSupportedDomains(); aoqi@0: }