/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* 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.
*/
/**
* Parses {@code sun-jaxws.xml} into {@link WSEndpoint}.
*
* <p>
* Since {@code sun-jaxws.xml} captures more information than what {@link WSEndpoint}
* represents (in particular URL pattern and name), this class
* takes a parameterization 'A' so that the user of this parser can choose to
* create another type that wraps {@link WSEndpoint}.
*
* {@link HttpAdapter} and its derived type is used for this often,
* but it can be anything.
*
* @author WS Development Team
* @author Kohsuke Kawaguchi
*/
public class DeploymentDescriptorParser<A> {
/**
* Endpoint names that are declared.
* Used to catch double definitions.
*/
/**
*/
/**
*
* @param cl
* Used to load service implementations.
* @param loader
* Used to locate resources, in particular WSDL.
* @param container
* Optional {@link Container} that {@link WSEndpoint}s receive.
* @param adapterFactory
* Creates {@link HttpAdapter} (or its derived class.)
*/
public DeploymentDescriptorParser(ClassLoader cl, ResourceLoader loader, Container container, AdapterFactory<A> adapterFactory) throws MalformedURLException {
classLoader = cl;
this.adapterFactory = adapterFactory;
collectDocs("/WEB-INF/wsdl/");
}
/**
* Parses the {@code sun-jaxws.xml} file and configures
* a set of {@link HttpAdapter}s.
*/
try {
reader = new TidyXMLStreamReader(
return parseAdapters(reader);
} finally {
try {
} catch (XMLStreamException e) {
throw new ServerRtException("runtime.parser.xmlReader",e);
}
}
try {
} catch (IOException e) {
// ignore
}
}
}
/**
* Parses the {@code sun-jaxws.xml} file and configures
* a set of {@link HttpAdapter}s.
*/
try {
} finally {
}
}
/**
* Get all the WSDL & schema documents recursively.
*/
continue;
} else {
}
}
}
}
}
failWithLocalName("runtime.parser.invalidVersionNumber",
}
}
if (serviceName == null)
//get enable-mtom attribute value
// Convert short-form tokens to API's binding ids
// TODO use 'docs' as the metadata. If wsdl is non-null it's the primary.
null,
);
} else {
}
return adapters;
}
/**
* @param ddBindingId
* binding id explicitlyspecified in the DeploymentDescriptor or parameter
* @param implClass
* Endpoint Implementation class
* @param mtomEnabled
* represents mtom-enabled attribute in DD
* @param mtomThreshold
* threshold value specified in DD
* @return
* is returned with only MTOMFeature set resolving the various precendece rules
*/
// Features specified through DD
if (mtomEnabled != null) {
if (mtomThreshold != null)
else
}
if (ddBindingId != null) {
}
} else {
// Since bindingID is coming from implclass,
// mtom through Feature annotation or DD takes precendece
features = new WebServiceFeatureList();
if(mtomfeature != null)
}
}
}
/**
* JSR-109 defines short-form tokens for standard binding Ids. These are
* used only in DD. So stand alone deployment descirptor should also honor
* these tokens. This method converts the tokens to API's standard
* binding ids
*
* @param lexical binding attribute value from DD. Always not null
*
* @return returns corresponding API's binding ID or the same lexical
*/
return SOAPBinding.SOAP11HTTP_BINDING;
return SOAPBinding.SOAP11HTTP_MTOM_BINDING;
return SOAPBinding.SOAP12HTTP_BINDING;
return SOAPBinding.SOAP12HTTP_MTOM_BINDING;
return HTTPBinding.HTTP_BINDING;
}
return lexical;
}
/**
* Creates a new "Adapter".
*
* <P>
* Normally 'A' would be {@link HttpAdapter} or some derived class.
* But the parser doesn't require that to be of any particular type.
*/
public static interface AdapterFactory<A> {
}
/**
* Checks the deployment descriptor or {@link @WebServiceProvider} annotation
* to see if it points to any WSDL. If so, returns the {@link SDDocumentSource}.
*
* @return
* The pointed WSDL, if any. Otherwise null.
*/
private SDDocumentSource getPrimaryWSDL(XMLStreamReader xsr, Attributes attrs, Class<?> implementorClass) {
}
+". Going to generate and publish a new WSDL.");
return null;
}
try {
} catch (MalformedURLException e) {
throw new LocatableWebServiceException(
}
throw new LocatableWebServiceException(
}
return docInfo;
}
return null;
}
/**
* Creates an {@link EntityResolver} that consults {@code /WEB-INF/jax-ws-catalog.xml}.
*/
try {
} catch(MalformedURLException e) {
throw new WebServiceException(e);
}
}
}
return value;
}
return null;
} else {
}
}
"runtime.parser.invalidAttributeValue",
name);
}
return value;
}
}
return value;
}
"runtime.parser.invalidAttributeValue",
name);
}
return value;
}
/**
* Parses the handler and role information and sets it
* on the {@link WSBinding}.
* @return true if <handler-chains> element present in DD
* false otherwise.
*/
protected boolean setHandlersAndRoles(WSBinding binding, XMLStreamReader reader, QName serviceName, QName portName) {
return false;
}
if (binding instanceof SOAPBinding) {
}
// move past </handler-chains>
return true;
}
}
}
throw new ServerRtException(
key,
}
throw new ServerRtException(
key,
}
throw new ServerRtException(
key,
reader.getLocalName());
}
protected static void failWithLocalName(
throw new ServerRtException(
key,
arg);
}
try {
} catch (ClassNotFoundException e) {
throw new ServerRtException(
"runtime.parser.classNotFound",
name);
}
}
/**
* Loads the class of the given name.
*
* @param xsr
* Used to report the source location information if there's any error.
*/
try {
} catch (ClassNotFoundException e) {
throw new LocatableWebServiceException(
}
}
}