src/share/jaxws_classes/com/sun/xml/internal/ws/api/server/SDDocument.java

Tue, 09 Apr 2013 14:51:13 +0100

author
alanb
date
Tue, 09 Apr 2013 14:51:13 +0100
changeset 368
0989ad8c0860
parent 286
f50545b5e2f1
child 637
9c07ef4934dd
permissions
-rw-r--r--

8010393: Update JAX-WS RI to 2.2.9-b12941
Reviewed-by: alanb, erikj
Contributed-by: miroslav.kos@oracle.com, martin.grebac@oracle.com

ohair@286 1 /*
alanb@368 2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
ohair@286 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ohair@286 4 *
ohair@286 5 * This code is free software; you can redistribute it and/or modify it
ohair@286 6 * under the terms of the GNU General Public License version 2 only, as
ohair@286 7 * published by the Free Software Foundation. Oracle designates this
ohair@286 8 * particular file as subject to the "Classpath" exception as provided
ohair@286 9 * by Oracle in the LICENSE file that accompanied this code.
ohair@286 10 *
ohair@286 11 * This code is distributed in the hope that it will be useful, but WITHOUT
ohair@286 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ohair@286 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ohair@286 14 * version 2 for more details (a copy is included in the LICENSE file that
ohair@286 15 * accompanied this code).
ohair@286 16 *
ohair@286 17 * You should have received a copy of the GNU General Public License version
ohair@286 18 * 2 along with this work; if not, write to the Free Software Foundation,
ohair@286 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ohair@286 20 *
ohair@286 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@286 22 * or visit www.oracle.com if you need additional information or have any
ohair@286 23 * questions.
ohair@286 24 */
ohair@286 25
ohair@286 26 package com.sun.xml.internal.ws.api.server;
ohair@286 27
ohair@286 28 import com.sun.istack.internal.Nullable;
ohair@286 29 import javax.xml.stream.XMLStreamWriter;
ohair@286 30 import javax.xml.stream.XMLStreamException;
ohair@286 31 import javax.xml.namespace.QName;
ohair@286 32 import java.io.OutputStream;
ohair@286 33 import java.io.IOException;
ohair@286 34 import java.net.URL;
ohair@286 35 import java.util.Set;
ohair@286 36
ohair@286 37 import com.sun.org.glassfish.gmbal.ManagedAttribute;
ohair@286 38 import com.sun.org.glassfish.gmbal.ManagedData;
ohair@286 39
ohair@286 40 /**
ohair@286 41 * Represents an individual document that forms a {@link ServiceDefinition}.
ohair@286 42 *
ohair@286 43 * <pre>
ohair@286 44 * TODO:
ohair@286 45 * how does those documents refer to each other?
ohair@286 46 *
ohair@286 47 * </pre>
ohair@286 48 *
ohair@286 49 * @author Jitendra Kotamraju
ohair@286 50 */
ohair@286 51 @ManagedData
ohair@286 52 public interface SDDocument {
ohair@286 53
ohair@286 54 /**
ohair@286 55 * Gets the root tag name of this document.
ohair@286 56 *
ohair@286 57 * <p>
ohair@286 58 * This can be used to identify a kind of document quickly
ohair@286 59 * (such as schema, WSDL, ...)
ohair@286 60 *
ohair@286 61 * @return
ohair@286 62 * always non-null.
ohair@286 63 */
ohair@286 64 @ManagedAttribute
ohair@286 65 QName getRootName();
ohair@286 66
ohair@286 67 /**
ohair@286 68 * Returns true if this document is WSDL.
ohair@286 69 */
ohair@286 70 @ManagedAttribute
ohair@286 71 boolean isWSDL();
ohair@286 72
ohair@286 73 /**
ohair@286 74 * Returns true if this document is schema.
ohair@286 75 */
ohair@286 76 @ManagedAttribute
ohair@286 77 boolean isSchema();
ohair@286 78
ohair@286 79 /**
ohair@286 80 * returns the referenced documents
ohair@286 81 */
ohair@286 82 @ManagedAttribute
ohair@286 83 Set<String> getImports();
ohair@286 84
ohair@286 85 /**
ohair@286 86 * Gets the system ID of the document where it's taken from. Generated documents
ohair@286 87 * use a fake URL that can be used to resolve relative URLs. So donot use this URL
ohair@286 88 * for reading or writing.
ohair@286 89 */
ohair@286 90 @ManagedAttribute
ohair@286 91 URL getURL();
ohair@286 92
ohair@286 93 /**
ohair@286 94 * Writes the document to the given {@link OutputStream}.
ohair@286 95 *
ohair@286 96 * <p>
ohair@286 97 * Since {@link ServiceDefinition} doesn't know which endpoint address
ohair@286 98 * {@link Adapter} is serving to, (and often it serves multiple URLs
ohair@286 99 * simultaneously), this method takes the PortAddressResolver as a parameter,
ohair@286 100 * so that it can produce the corret address information in the generated WSDL.
ohair@286 101 *
ohair@286 102 * @param portAddressResolver
ohair@286 103 * An endpoint address resolver that gives endpoint address for a WSDL
ohair@286 104 * port. Can be null.
ohair@286 105 * @param resolver
ohair@286 106 * Used to resolve relative references among documents.
ohair@286 107 * @param os
ohair@286 108 * The {@link OutputStream} that receives the generated document.
ohair@286 109 *
ohair@286 110 * @throws IOException
ohair@286 111 * if there was a failure reported from the {@link OutputStream}.
ohair@286 112 */
ohair@286 113 void writeTo(@Nullable PortAddressResolver portAddressResolver,
ohair@286 114 DocumentAddressResolver resolver, OutputStream os) throws IOException;
ohair@286 115
ohair@286 116 /**
ohair@286 117 * Writes the document to the given {@link XMLStreamWriter}.
ohair@286 118 *
ohair@286 119 * <p>
ohair@286 120 * The same as {@link #writeTo(PortAddressResolver,DocumentAddressResolver,OutputStream)} except
ohair@286 121 * it writes to an {@link XMLStreamWriter}.
ohair@286 122 *
ohair@286 123 * <p>
ohair@286 124 * The implementation must not call {@link XMLStreamWriter#writeStartDocument()}
ohair@286 125 * nor {@link XMLStreamWriter#writeEndDocument()}. Those are the caller's
ohair@286 126 * responsibility.
ohair@286 127 *
ohair@286 128 * @throws XMLStreamException
ohair@286 129 * if the {@link XMLStreamWriter} reports an error.
ohair@286 130 */
ohair@286 131 void writeTo(PortAddressResolver portAddressResolver,
ohair@286 132 DocumentAddressResolver resolver, XMLStreamWriter out) throws XMLStreamException, IOException;
ohair@286 133
ohair@286 134 /**
ohair@286 135 * {@link SDDocument} that represents an XML Schema.
ohair@286 136 */
ohair@286 137 interface Schema extends SDDocument {
ohair@286 138 /**
ohair@286 139 * Gets the target namepsace of this schema.
ohair@286 140 */
ohair@286 141 @ManagedAttribute
ohair@286 142 String getTargetNamespace();
ohair@286 143 }
ohair@286 144
ohair@286 145 /**
ohair@286 146 * {@link SDDocument} that represents a WSDL.
ohair@286 147 */
ohair@286 148 interface WSDL extends SDDocument {
ohair@286 149 /**
ohair@286 150 * Gets the target namepsace of this schema.
ohair@286 151 */
ohair@286 152 @ManagedAttribute
ohair@286 153 String getTargetNamespace();
ohair@286 154
ohair@286 155 /**
ohair@286 156 * This WSDL has a portType definition
ohair@286 157 * that matches what {@link WSEndpoint} is serving.
ohair@286 158 *
ohair@286 159 * TODO: does this info needs to be exposed?
ohair@286 160 */
ohair@286 161 @ManagedAttribute
ohair@286 162 boolean hasPortType();
ohair@286 163
ohair@286 164 /**
ohair@286 165 * This WSDL has a service definition
ohair@286 166 * that matches the {@link WSEndpoint}.
ohair@286 167 *
ohair@286 168 * TODO: does this info need to be exposed?
ohair@286 169 */
ohair@286 170 @ManagedAttribute
ohair@286 171 boolean hasService();
ohair@286 172
ohair@286 173 /**
ohair@286 174 * All &lt;service> names that were in this WSDL, or empty set if there was none.
ohair@286 175 * Used for error diagnostics.
ohair@286 176 */
ohair@286 177 @ManagedAttribute
ohair@286 178 Set<QName> getAllServices();
ohair@286 179 }
ohair@286 180 }

mercurial