1/*
2 * Copyright (c) 1997, 2013, 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 */
25
26package com.sun.xml.internal.ws.developer;
27
28import com.sun.xml.internal.ws.server.DraconianValidationErrorHandler;
29
30import javax.jws.WebService;
31import javax.xml.ws.spi.WebServiceFeatureAnnotation;
32import java.lang.annotation.Documented;
33import static java.lang.annotation.ElementType.TYPE;
34import java.lang.annotation.Retention;
35import static java.lang.annotation.RetentionPolicy.RUNTIME;
36import java.lang.annotation.Target;
37import java.lang.annotation.ElementType;
38
39/**
40 * Validates all request and response messages payload(SOAP:Body) for a {@link WebService}
41 * against the XML schema. To use this feature, annotate the endpoint class with
42 * this annotation.
43 *
44 * <pre>
45 * for e.g.:
46 *
47 * &#64;WebService
48 * &#64;SchemaValidation
49 * public class HelloImpl {
50 *   ...
51 * }
52 * </pre>
53 *
54 * At present, schema validation works for doc/lit web services only.
55 *
56 * @since JAX-WS 2.1.3
57 * @author Jitendra Kotamraju
58 * @see SchemaValidationFeature
59 */
60@Retention(RUNTIME)
61@Target({TYPE, ElementType.METHOD, ElementType.FIELD})
62@Documented
63@WebServiceFeatureAnnotation(id = SchemaValidationFeature.ID, bean = SchemaValidationFeature.class)
64public @interface SchemaValidation {
65
66    /**
67     * Configure the validation behaviour w.r.t error handling. The default handler
68     * just rejects any invalid schema intances. If the application want to change
69     * this default behaviour(say just log the errors), it can do so by providing
70     * a custom implementation of {@link ValidationErrorHandler}.
71     */
72    Class<? extends ValidationErrorHandler> handler() default DraconianValidationErrorHandler.class;
73
74    /**
75     * Turns validation on/off for inbound messages
76     *
77     * @since JAX-WS RI 2.2.2
78     */
79    boolean inbound() default true;
80
81
82    /**
83     * Turns validation on/off for outbound messages
84     *
85     * @since JAX-WS RI 2.2.2
86     */
87    boolean outbound() default true;
88
89    /**
90     * Does validation for bound headers in a SOAP message.
91     *
92    boolean headers() default false;
93     */
94
95    /**
96     * Additional schema documents that are used to create {@link Schema} object. Useful
97     * when the application adds additional SOAP headers to the message. This is a list
98     * of system-ids, that are used to create {@link Source} objects and used in creation
99     * of {@link Schema} object
100     *
101     * for e.g.:
102     * @SchemaValidation(schemaLocations={"http://bar.foo/b.xsd", "http://foo.bar/a.xsd"}
103     *
104    String[] schemaLocations() default {};
105     */
106
107}
108