feat(jdk8): move files to new folder to avoid resources compiled.

This commit is contained in:
2025-09-07 15:25:52 +08:00
parent 3f0047bf6f
commit 8c35cfb1c0
17415 changed files with 217 additions and 213 deletions

View File

@@ -0,0 +1,50 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.ws.api.wsdl.parser;
import com.sun.istack.internal.NotNull;
import com.sun.istack.internal.Nullable;
import java.net.URI;
/**
* Resolves metadata such as WSDL/schema. This serves as extensibile plugin point which a wsdl parser can use to
* get the metadata from an endpoint.
*
* @author Vivek Pandey
*/
public abstract class MetaDataResolver {
/**
* Gives {@link com.sun.xml.internal.ws.api.wsdl.parser.ServiceDescriptor} resolved from the given location.
*
* TODO: Does this method need to propogate errors?
*
* @param location metadata location
* @return {@link com.sun.xml.internal.ws.api.wsdl.parser.ServiceDescriptor} resolved from the location. It may be null in the cases when MetadataResolver
* can get the metada associated with the metadata loction.
*/
public abstract @Nullable ServiceDescriptor resolve(@NotNull URI location);
}

View File

@@ -0,0 +1,53 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.ws.api.wsdl.parser;
import com.sun.istack.internal.NotNull;
import com.sun.istack.internal.Nullable;
import org.xml.sax.EntityResolver;
/**
* Extension point for resolving metadata using wsimport.
* <p/>
* wsimport would get a {@link MetaDataResolver} using this factory and from it will resolve all the wsdl/schema
* metadata.
*
* Implementor of this class must provide a zero argument constructor so that
* it can be loaded during service lookup mechanism.
*
* @author Vivek Pandey
* @see com.sun.xml.internal.ws.api.wsdl.parser.MetaDataResolver#resolve(java.net.URI)
*/
public abstract class MetadataResolverFactory {
/**
* Gets a {@link com.sun.xml.internal.ws.api.wsdl.parser.MetaDataResolver}
*
* @param resolver
*/
public abstract
@NotNull
MetaDataResolver metadataResolver(@Nullable EntityResolver resolver);
}

View File

@@ -0,0 +1,35 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.ws.api.wsdl.parser;
/**
* Marker interface for WSDLParserExtension implementations that can replace the default implementation
*
* @since 2.2.6
*/
public interface PolicyWSDLParserExtension {
}

View File

@@ -0,0 +1,52 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.ws.api.wsdl.parser;
import com.sun.istack.internal.NotNull;
import javax.xml.transform.Source;
import java.util.List;
/**
* Abstraction over WSDL and Schema metadata
*
* @author Vivek Pandey
*/
public abstract class ServiceDescriptor {
/**
* Gives list of wsdls
* @return List of WSDL documents as {@link Source}.
* {@link javax.xml.transform.Source#getSystemId()} must be Non-null
*/
public abstract @NotNull List<? extends Source> getWSDLs();
/**
* Gives list of schemas.
* @return List of XML schema documents as {@link Source}. {@link javax.xml.transform.Source#getSystemId()} must be Non-null.
*
*/
public abstract @NotNull List<? extends Source> getSchemas();
}

View File

@@ -0,0 +1,282 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.ws.api.wsdl.parser;
import com.sun.xml.internal.ws.api.WSService;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLBoundFault;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLBoundOperation;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLBoundPortType;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLFault;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLInput;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLMessage;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLOperation;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLOutput;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLPort;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLPortType;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLService;
import com.sun.xml.internal.ws.api.pipe.Tube;
import com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamReader;
import javax.xml.ws.WebServiceException;
/**
* Extends the WSDL parsing process.
*
* <p>
* This interface is implemented by components that build on top of the JAX-WS RI,
* to participate in the WSDL parsing process that happens in the runtime.
* This allows such components to retrieve information from WSDL extension elements,
* and use that later to, for example, configure {@link Tube}s.
*
*
*
* <h2>How it works?</h2>
* <p>
* Each method on this interface denotes one extension point in WSDL
* (the place where foreign elements/attributes can be added.) A {@link RuntimeWSDLParser}
* starts parsing WSDL with a fixed set of {@link WSDLParserExtension}s, and
* as it finds extension elements/attributes, it calls appropriate callback methods
* to provide a chance for {@link WSDLParserExtension} to parse such
* an extension element.
*
* <p>
* There are two kinds of callbacks.
*
* <h3>Attribute callbacks</h3>
* <p>
* One is for attributes, which ends with the name {@code Attributes}.
* This callback is invoked with {@link XMLStreamReader} that points
* to the start tag of the WSDL element.
*
* <p>
* The callback method can read interesting attributes on it.
* The method must return without advancing the parser to the next token.
*
* <h3>Element callbacks</h3>
* <p>
* The other callback is for extension elements, which ends with the name
* {@code Elements}.
* When a callback is invoked, {@link XMLStreamReader} points to the
* start tag of the extension element. The callback method can do
* one of the following:
*
* <ol>
* <li>Return {@code false} without moving {@link XMLStreamReader},
* to indicate that the extension element isn't recognized.
* This allows the next {@link WSDLParserExtension} to see this
* extension element.
* <li>Parse the whole subtree rooted at the element,
* move the cursor to the {@link XMLStreamConstants#END_ELEMENT} state,
* and return {@code true}, indicating that the extension
* element is consumed.
* No other {@link WSDLParserExtension}s are notified of this extension.
* </ol>
*
* <h3>Parsing in callback</h3>
* <p>
* For each callback, the corresponding WSDL model object is passed in,
* so that {@link WSDLParserExtension} can relate what it's parsing
* to the {@link WSDLModel}. Most likely, extensions can parse
* their data into an {@link WSDLExtension}-derived classes, then
* use {@link WSDLExtensible} interface to hook them into {@link WSDLModel}.
*
* <p>
* Note that since the {@link WSDLModel} itself
* is being built, {@link WSDLParserExtension} may not invoke any of
* the query methods on the WSDL model. Those references are passed just so that
* {@link WSDLParserExtension} can hold on to those references, or put
* {@link WSDLExtensible} objects into the model, not to query it.
*
* <p>
* If {@link WSDLParserExtension} needs to query {@link WSDLModel},
* defer that processing until {@link #finished(WSDLParserExtensionContext)}, when it's
* safe to use {@link WSDLModel} can be used safely.
*
* <p>
* Also note that {@link WSDLParserExtension}s are called in no particular order.
* This interface is not designed for having multiple {@link WSDLParserExtension}s
* parse the same extension element.
*
*
* <h2>Error Handling</h2>
* <p>
* For usability, {@link WSDLParserExtension}s are expected to check possible
* errors in the extension elements that it parses. When an error is found,
* it may throw a {@link WebServiceException} to abort the parsing of the WSDL.
* This exception will be propagated to the user, so it should have
* detailed error messages pointing at the problem.
*
* <h2>Discovery</h2>
* <p>
* The JAX-WS RI locates the implementation of {@link WSDLParserExtension}s
* by using the standard service look up mechanism, in particular looking for
* <tt>META-INF/services/com.sun.xml.internal.ws.api.wsdl.parser.WSDLParserExtension</tt>
*
*
* <h2>TODO</h2>
* <p>
* As it's designed today, extensions cannot access to any of the environmental
* information before the parsing begins (such as what {@link WSService} this
* WSDL is being parsed for, etc.) We might need to reconsider this aspect.
* The JAX-WS team waits for feedback on this topic.
*
* @author Kohsuke Kawaguchi
*/
public abstract class WSDLParserExtension {
public void start(WSDLParserExtensionContext context){
// noop
}
public void serviceAttributes(EditableWSDLService service, XMLStreamReader reader) {
// noop
}
public boolean serviceElements(EditableWSDLService service, XMLStreamReader reader) {
return false;
}
public void portAttributes(EditableWSDLPort port, XMLStreamReader reader) {
// noop
}
public boolean portElements(EditableWSDLPort port, XMLStreamReader reader) {
return false;
}
public boolean portTypeOperationInput(EditableWSDLOperation op, XMLStreamReader reader) {
return false;
}
public boolean portTypeOperationOutput(EditableWSDLOperation op, XMLStreamReader reader) {
return false;
}
public boolean portTypeOperationFault(EditableWSDLOperation op, XMLStreamReader reader) {
return false;
}
public boolean definitionsElements(XMLStreamReader reader) {
return false;
}
public boolean bindingElements(EditableWSDLBoundPortType binding, XMLStreamReader reader) {
return false;
}
public void bindingAttributes(EditableWSDLBoundPortType binding, XMLStreamReader reader) {
}
public boolean portTypeElements(EditableWSDLPortType portType, XMLStreamReader reader) {
return false;
}
public void portTypeAttributes(EditableWSDLPortType portType, XMLStreamReader reader) {
}
public boolean portTypeOperationElements(EditableWSDLOperation operation, XMLStreamReader reader) {
return false;
}
public void portTypeOperationAttributes(EditableWSDLOperation operation, XMLStreamReader reader) {
}
public boolean bindingOperationElements(EditableWSDLBoundOperation operation, XMLStreamReader reader) {
return false;
}
public void bindingOperationAttributes(EditableWSDLBoundOperation operation, XMLStreamReader reader) {
}
public boolean messageElements(EditableWSDLMessage msg, XMLStreamReader reader) {
return false;
}
public void messageAttributes(EditableWSDLMessage msg, XMLStreamReader reader) {
}
public boolean portTypeOperationInputElements(EditableWSDLInput input, XMLStreamReader reader) {
return false;
}
public void portTypeOperationInputAttributes(EditableWSDLInput input, XMLStreamReader reader) {
}
public boolean portTypeOperationOutputElements(EditableWSDLOutput output, XMLStreamReader reader) {
return false;
}
public void portTypeOperationOutputAttributes(EditableWSDLOutput output, XMLStreamReader reader) {
}
public boolean portTypeOperationFaultElements(EditableWSDLFault fault, XMLStreamReader reader) {
return false;
}
public void portTypeOperationFaultAttributes(EditableWSDLFault fault, XMLStreamReader reader) {
}
public boolean bindingOperationInputElements(EditableWSDLBoundOperation operation, XMLStreamReader reader) {
return false;
}
public void bindingOperationInputAttributes(EditableWSDLBoundOperation operation, XMLStreamReader reader) {
}
public boolean bindingOperationOutputElements(EditableWSDLBoundOperation operation, XMLStreamReader reader) {
return false;
}
public void bindingOperationOutputAttributes(EditableWSDLBoundOperation operation, XMLStreamReader reader) {
}
public boolean bindingOperationFaultElements(EditableWSDLBoundFault fault, XMLStreamReader reader) {
return false;
}
public void bindingOperationFaultAttributes(EditableWSDLBoundFault fault, XMLStreamReader reader) {
}
// TODO: complete the rest of the callback
/**
* Called when the parsing of a set of WSDL documents are all done.
* <p>
* This is the opportunity to do any post-processing of the parsing
* you've done.
*
* @param context {@link WSDLParserExtensionContext} gives fully parsed {@link WSDLModel}.
*/
public void finished(WSDLParserExtensionContext context) {
// noop
}
public void postFinished(WSDLParserExtensionContext context) {
// noop
}
}

View File

@@ -0,0 +1,66 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.ws.api.wsdl.parser;
import com.sun.istack.internal.NotNull;
import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLModel;
import com.sun.xml.internal.ws.api.server.Container;
import com.sun.xml.internal.ws.api.policy.PolicyResolver;
/**
* Provides contextual information for {@link WSDLParserExtension}s.
*
* @author Vivek Pandey
* @author Fabian Ritzmann
*/
public interface WSDLParserExtensionContext {
/**
* Returns true if the WSDL parsing is happening on the client side. Returns false means
* its started on the server side.
*/
boolean isClientSide();
/**
* Gives the {@link EditableWSDLModel}. The WSDLModel may not be complete until
* {@link WSDLParserExtension#finished(WSDLParserExtensionContext)} is called.
*/
EditableWSDLModel getWSDLModel();
/**
* Provides the {@link Container} in which this service or client is running.
* May return null.
*
* @return The container in which this service or client is running.
*/
@NotNull Container getContainer();
/**
* Provides the PolicyResolver
*/
@NotNull
PolicyResolver getPolicyResolver();
}

View File

@@ -0,0 +1,77 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.ws.api.wsdl.parser;
import com.sun.xml.internal.ws.api.server.SDDocumentSource;
import org.xml.sax.EntityResolver;
import org.xml.sax.SAXException;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import java.io.IOException;
import java.net.URL;
/**
* Resolves a reference to {@link XMLStreamReader}.
*
* This is kinda like {@link EntityResolver} but works
* at the XML infoset level.
*
* @author Kohsuke Kawaguchi
*/
public interface XMLEntityResolver {
/**
* See {@link EntityResolver#resolveEntity(String, String)} for the contract.
*/
Parser resolveEntity(String publicId,String systemId)
throws SAXException, IOException, XMLStreamException;
public static final class Parser {
/**
* System ID of the document being parsed.
*/
public final URL systemId;
/**
* The parser instance parsing the infoset.
*/
public final XMLStreamReader parser;
public Parser(URL systemId, XMLStreamReader parser) {
assert parser!=null;
this.systemId = systemId;
this.parser = parser;
}
/**
* Creates a {@link Parser} that reads from {@link SDDocumentSource}.
*/
public Parser(SDDocumentSource doc) throws IOException, XMLStreamException {
this.systemId = doc.getSystemId();
this.parser = doc.read();
}
}
}

View File

@@ -0,0 +1,29 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Extension point for WSDL parsing.
*/
package com.sun.xml.internal.ws.api.wsdl.parser;

View File

@@ -0,0 +1,90 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.ws.api.wsdl.writer;
import com.sun.xml.internal.txw2.TypedXmlWriter;
import com.sun.xml.internal.ws.api.model.SEIModel;
import com.sun.xml.internal.ws.api.WSBinding;
import com.sun.xml.internal.ws.api.server.Container;
import com.sun.istack.internal.NotNull;
import com.sun.istack.internal.Nullable;
/**
* WSDLGeneatorContext provides a context for the WSDLGeneratorExtension and is used in
* {@link WSDLGeneratorExtension#start(WSDLGenExtnContext)}. This context consists of TXW, {@link SEIModel},
* {@link WSBinding}, {@link Container}, and implementation class. WSDL extensions are used to
* extend the generated WSDL by adding implementation specific extensions.
*
* @author Jitendra Kotamraju
*/
public class WSDLGenExtnContext {
private final TypedXmlWriter root;
private final SEIModel model;
private final WSBinding binding;
private final Container container;
private final Class endpointClass;
/**
* Constructs WSDL Generation context for the extensions
*
* @param root This is the root element of the generated WSDL.
* @param model WSDL is being generated from this {@link SEIModel}.
* @param binding The binding for which we generate WSDL. the binding {@link WSBinding} represents a particular
* configuration of JAXWS. This can be typically be overriden by
* @param container The entry point to the external environment.
* If this extension is used at the runtime to generate WSDL, you get a {@link Container}
* that was given to {@link com.sun.xml.internal.ws.api.server.WSEndpoint#create}.
*/
public WSDLGenExtnContext(@NotNull TypedXmlWriter root, @NotNull SEIModel model, @NotNull WSBinding binding,
@Nullable Container container, @NotNull Class endpointClass) {
this.root = root;
this.model = model;
this.binding = binding;
this.container = container;
this.endpointClass = endpointClass;
}
public TypedXmlWriter getRoot() {
return root;
}
public SEIModel getModel() {
return model;
}
public WSBinding getBinding() {
return binding;
}
public Container getContainer() {
return container;
}
public Class getEndpointClass() {
return endpointClass;
}
}

View File

@@ -0,0 +1,271 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.ws.api.wsdl.writer;
import com.sun.istack.internal.NotNull;
import com.sun.xml.internal.txw2.TypedXmlWriter;
import com.sun.xml.internal.ws.api.WSBinding;
import com.sun.xml.internal.ws.api.model.CheckedException;
import com.sun.xml.internal.ws.api.model.JavaMethod;
import com.sun.xml.internal.ws.api.model.SEIModel;
import com.sun.xml.internal.ws.api.server.Container;
import com.sun.xml.internal.ws.api.server.WSEndpoint;
/**
* This is a callback interface used to extend the WSDLGenerator. Implementors
* of this interface can add their own WSDL extensions to the generated WSDL.
* There are a number of methods that will be invoked allowing the extensions
* to be generated on various WSDL elements.
* <p/>
* The JAX-WS WSDLGenerator uses TXW to serialize the WSDL out to XML.
* More information about TXW can be located at
* <a href="http://txw.java.net">http://txw.java.net</a>.
*/
public abstract class WSDLGeneratorExtension {
/**
* Called at the very beginning of the process.
* <p/>
* This method is invoked so that the root element can be manipulated before
* any tags have been written. This allows to set e.g. namespace prefixes.
* <p/>
* Another purpose of this method is to let extensions know what model
* we are generating a WSDL for.
*
* @param root This is the root element of the generated WSDL.
* @param model WSDL is being generated from this {@link SEIModel}.
* @param binding The binding for which we generate WSDL. the binding {@link WSBinding} represents a particular
* configuration of JAXWS. This can be typically be overriden by
* @param container The entry point to the external environment.
* If this extension is used at the runtime to generate WSDL, you get a {@link Container}
* that was given to {@link WSEndpoint#create}.
* TODO: think about tool side
* @deprecated
*/
public void start(@NotNull TypedXmlWriter root, @NotNull SEIModel model, @NotNull WSBinding binding, @NotNull Container container) {
}
/**
* Called before writing </wsdl:defintions>.
*
* @param ctxt
*/
public void end(@NotNull WSDLGenExtnContext ctxt) {
}
/**
* Called at the very beginning of the process.
* <p/>
* This method is invoked so that the root element can be manipulated before
* any tags have been written. This allows to set e.g. namespace prefixes.
* <p/>
* Another purpose of this method is to let extensions know what model
* we are generating a WSDL for.
*
* @param ctxt Provides the context for the generator extensions
*/
public void start(WSDLGenExtnContext ctxt) {
}
/**
* This method is invoked so that extensions to a <code>wsdl:definitions</code>
* element can be generated.
*
* @param definitions This is the <code>wsdl:defintions</code> element that the extension can be added to.
*/
public void addDefinitionsExtension(TypedXmlWriter definitions) {
}
/**
* This method is invoked so that extensions to a <code>wsdl:service</code>
* element can be generated.
*
* @param service This is the <code>wsdl:service</code> element that the extension can be added to.
*/
public void addServiceExtension(TypedXmlWriter service) {
}
/**
* This method is invoked so that extensions to a <code>wsdl:port</code>
* element can be generated.
*
* @param port This is the wsdl:port element that the extension can be added to.
*/
public void addPortExtension(TypedXmlWriter port) {
}
/**
* This method is invoked so that extensions to a <code>wsdl:portType</code>
* element can be generated.
* <p/>
*
* @param portType This is the wsdl:portType element that the extension can be added to.
*/
public void addPortTypeExtension(TypedXmlWriter portType) {
}
/**
* This method is invoked so that extensions to a <code>wsdl:binding</code>
* element can be generated.
* <p/>
* <p/>
* TODO: Some other information may need to be passed
*
* @param binding This is the wsdl:binding element that the extension can be added to.
*/
public void addBindingExtension(TypedXmlWriter binding) {
}
/**
* This method is invoked so that extensions to a <code>wsdl:portType/wsdl:operation</code>
* element can be generated.
*
* @param operation This is the wsdl:portType/wsdl:operation element that the
* extension can be added to.
* @param method {@link JavaMethod} which captures all the information to generate wsdl:portType/wsdl:operation
*/
public void addOperationExtension(TypedXmlWriter operation, JavaMethod method) {
}
/**
* This method is invoked so that extensions to a <code>wsdl:binding/wsdl:operation</code>
* element can be generated.
*
* @param operation This is the wsdl:binding/wsdl:operation element that the
* extension can be added to.
* @param method {@link JavaMethod} which captures all the information to generate wsdl:portType/wsdl:operation
*/
public void addBindingOperationExtension(TypedXmlWriter operation, JavaMethod method) {
}
/**
* This method is invoked so that extensions to an input <code>wsdl:message</code>
* element can be generated.
*
* @param message This is the input wsdl:message element that the
* extension can be added to.
* @param method {@link JavaMethod} which captures all the information to generate wsdl:portType/wsdl:operation
*/
public void addInputMessageExtension(TypedXmlWriter message, JavaMethod method) {
}
/**
* This method is invoked so that extensions to an output <code>wsdl:message</code>
* element can be generated.
*
* @param message This is the output wsdl:message element that the
* extension can be added to.
* @param method {@link JavaMethod} which captures all the information to generate wsdl:portType/wsdl:operation
*/
public void addOutputMessageExtension(TypedXmlWriter message, JavaMethod method) {
}
/**
* This method is invoked so that extensions to a
* <code>wsdl:portType/wsdl:operation/wsdl:input</code>
* element can be generated.
*
* @param input This is the wsdl:portType/wsdl:operation/wsdl:input element that the
* extension can be added to.
* @param method {@link JavaMethod} which captures all the information to generate wsdl:portType/wsdl:operation
*/
public void addOperationInputExtension(TypedXmlWriter input, JavaMethod method) {
}
/**
* This method is invoked so that extensions to a <code>wsdl:portType/wsdl:operation/wsdl:output</code>
* element can be generated.
*
* @param output This is the wsdl:portType/wsdl:operation/wsdl:output element that the
* extension can be added to.
* @param method {@link JavaMethod} which captures all the information to generate wsdl:portType/wsdl:operation
*/
public void addOperationOutputExtension(TypedXmlWriter output, JavaMethod method) {
}
/**
* This method is invoked so that extensions to a
* <code>wsdl:binding/wsdl:operation/wsdl:input</code>
* element can be generated.
*
* @param input This is the wsdl:binding/wsdl:operation/wsdl:input element that the
* extension can be added to.
* @param method {@link JavaMethod} which captures all the information to generate wsdl:portType/wsdl:operation
*/
public void addBindingOperationInputExtension(TypedXmlWriter input, JavaMethod method) {
}
/**
* This method is invoked so that extensions to a <code>wsdl:binding/wsdl:operation/wsdl:output</code>
* element can be generated.
*
* @param output This is the wsdl:binding/wsdl:operation/wsdl:output element that the
* extension can be added to.
* @param method {@link JavaMethod} which captures all the information to generate wsdl:portType/wsdl:operation
*/
public void addBindingOperationOutputExtension(TypedXmlWriter output, JavaMethod method) {
}
/**
* This method is invoked so that extensions to a <code>wsdl:binding/wsdl:operation/wsdl:fault</code>
* element can be generated.
*
* @param fault This is the wsdl:binding/wsdl:operation/wsdl:fault or wsdl:portType/wsdl:output/wsdl:operation/wsdl:fault
* element that the extension can be added to.
* @param method {@link JavaMethod} which captures all the information to generate wsdl:portType/wsdl:operation
*/
public void addBindingOperationFaultExtension(TypedXmlWriter fault, JavaMethod method, CheckedException ce) {
}
/**
* This method is invoked so that extensions to a <code>wsdl:portType/wsdl:operation/wsdl:fault</code>
* element can be generated.
*
* @param message This is the fault wsdl:message element that the
* extension can be added to.
* @param method {@link JavaMethod} which captures all the information to generate wsdl:portType/wsdl:operation
*
* @param ce {@link CheckedException} that abstracts wsdl:fault
*/
public void addFaultMessageExtension(TypedXmlWriter message, JavaMethod method, CheckedException ce) {
}
/**
* This method is invoked so that extensions to a <code>wsdl:portType/wsdl:operation/wsdl:fault</code>
* element can be generated.
*
* @param fault This is the wsdl:portType/wsdl:operation/wsdl:fault element that the
* extension can be added to.
* @param method {@link JavaMethod} which captures all the information to generate wsdl:portType/wsdl:operation
* @param ce {@link CheckedException} that abstracts wsdl:fault
*/
public void addOperationFaultExtension(TypedXmlWriter fault, JavaMethod method, CheckedException ce) {
}
}