[jbossws-commits] JBossWS SVN: r6741 - in stack/metro/branches/tdiesler/trunk: modules/client and 5 other directories.
jbossws-commits at lists.jboss.org
jbossws-commits at lists.jboss.org
Tue Apr 29 05:51:21 EDT 2008
Author: thomas.diesler at jboss.com
Date: 2008-04-29 05:51:21 -0400 (Tue, 29 Apr 2008)
New Revision: 6741
Added:
stack/metro/branches/tdiesler/trunk/modules/client/src/
stack/metro/branches/tdiesler/trunk/modules/server/src/main/resources/
stack/metro/branches/tdiesler/trunk/modules/server/src/main/scripts/
Removed:
stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/DeploymentDescriptorParserExt.java
stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/DeploymentDescriptorParserJBWS.java
stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/EndpointRegistryFactoryImpl.java
stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/EndpointServlet.java
stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/InvokerEJB3.java
stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/InvokerJSE.java
stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/MessageStreamAdapter.java
stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/MessageStreamConnectionImpl.java
stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/MessageStreamContext.java
stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/MetroServerConfig.java
stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/MetroServerConfigMBean.java
stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/RequestHandlerFactoryImpl.java
stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/RequestHandlerImpl.java
stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/ServletResourceLoader.java
stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/SunJaxwsDeploymentAspect.java
stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/WebAppResolver.java
stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/log/
stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/metadata/
stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/tools/
stack/metro/branches/tdiesler/trunk/modules/server/src/main/java/org/jboss/wsf/stack/metro/client/
stack/metro/branches/tdiesler/trunk/modules/server/src/main/resources/jbossws-context.war/
Modified:
stack/metro/branches/tdiesler/trunk/modules/client/pom.xml
stack/metro/branches/tdiesler/trunk/modules/server/pom.xml
stack/metro/branches/tdiesler/trunk/pom.xml
Log:
Modified: stack/metro/branches/tdiesler/trunk/modules/client/pom.xml
===================================================================
--- stack/metro/branches/tdiesler/trunk/modules/client/pom.xml 2008-04-29 08:42:23 UTC (rev 6740)
+++ stack/metro/branches/tdiesler/trunk/modules/client/pom.xml 2008-04-29 09:51:21 UTC (rev 6741)
@@ -30,15 +30,18 @@
</dependency>
<!-- Metro dependencies -->
-
- <!--
- useStrictFiltering requires dependency in all included modules
- http://jira.codehaus.org/browse/MASSEMBLY-317
- -->
<dependency>
- <groupId>javax.xml</groupId>
- <artifactId>jaxrpc-api</artifactId>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
</dependency>
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-tools</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.jws</groupId>
+ <artifactId>jsr181-api</artifactId>
+ </dependency>
<!-- jboss provided -->
<dependency>
Copied: stack/metro/branches/tdiesler/trunk/modules/client/src (from rev 6739, stack/metro/branches/tdiesler/trunk/modules/server/src)
Deleted: stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/DeploymentDescriptorParserExt.java
===================================================================
--- stack/metro/branches/tdiesler/trunk/modules/server/src/main/java/org/jboss/wsf/stack/metro/DeploymentDescriptorParserExt.java 2008-04-29 08:40:46 UTC (rev 6739)
+++ stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/DeploymentDescriptorParserExt.java 2008-04-29 09:51:21 UTC (rev 6741)
@@ -1,596 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.wsf.stack.metro;
-
-// $Id$
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.ws.WebServiceException;
-import javax.xml.ws.http.HTTPBinding;
-import javax.xml.ws.soap.MTOMFeature;
-import javax.xml.ws.soap.SOAPBinding;
-
-import org.xml.sax.EntityResolver;
-
-import com.sun.xml.ws.api.BindingID;
-import com.sun.xml.ws.api.WSBinding;
-import com.sun.xml.ws.api.server.Container;
-import com.sun.xml.ws.api.server.InstanceResolver;
-import com.sun.xml.ws.api.server.Invoker;
-import com.sun.xml.ws.api.server.SDDocumentSource;
-import com.sun.xml.ws.api.server.WSEndpoint;
-import com.sun.xml.ws.api.streaming.XMLStreamReaderFactory;
-import com.sun.xml.ws.binding.WebServiceFeatureList;
-import com.sun.xml.ws.handler.HandlerChainsModel;
-import com.sun.xml.ws.resources.ServerMessages;
-import com.sun.xml.ws.resources.WsservletMessages;
-import com.sun.xml.ws.server.EndpointFactory;
-import com.sun.xml.ws.server.ServerRtException;
-import com.sun.xml.ws.streaming.Attributes;
-import com.sun.xml.ws.streaming.TidyXMLStreamReader;
-import com.sun.xml.ws.streaming.XMLStreamReaderUtil;
-import com.sun.xml.ws.transport.http.HttpAdapter;
-import com.sun.xml.ws.transport.http.ResourceLoader;
-import com.sun.xml.ws.transport.http.DeploymentDescriptorParser.AdapterFactory;
-import com.sun.xml.ws.util.HandlerAnnotationInfo;
-import com.sun.xml.ws.util.exception.LocatableWebServiceException;
-import com.sun.xml.ws.util.xml.XmlUtil;
-
-/**
- * A copy of DeploymentDescriptorParser
- * @see com.sun.xml.ws.transport.http.servlet.WSServletContextListener
- * @author WS Development Team
- * @author Kohsuke Kawaguchi
- * @author Thomas.Diesler at jboss.org
- * @since 10-May-2007
- */
-public class DeploymentDescriptorParserExt<A>
-{
- private static final Logger logger = Logger.getLogger(com.sun.xml.ws.util.Constants.LoggingDomain + ".server.http");
-
- public static final String NS_RUNTIME = "http://java.sun.com/xml/ns/jax-ws/ri/runtime";
- public static final String JAXWS_WSDL_DD_DIR = "WEB-INF/wsdl";
- public static final QName QNAME_ENDPOINTS = new QName(NS_RUNTIME, "endpoints");
- public static final QName QNAME_ENDPOINT = new QName(NS_RUNTIME, "endpoint");
- public static final String ATTR_VERSION = "version";
- public static final String ATTR_NAME = "name";
- public static final String ATTR_IMPLEMENTATION = "implementation";
- public static final String ATTR_WSDL = "wsdl";
- public static final String ATTR_SERVICE = "service";
- public static final String ATTR_PORT = "port";
- public static final String ATTR_URL_PATTERN = "url-pattern";
- public static final String ATTR_ENABLE_MTOM = "enable-mtom";
- public static final String ATTR_MTOM_THRESHOLD_VALUE = "mtom-threshold-value";
- public static final String ATTR_BINDING = "binding";
- public static final String ATTRVALUE_VERSION_1_0 = "2.0";
-
- private final Container container;
- private final ClassLoader classLoader;
- private final ResourceLoader loader;
- private final AdapterFactory<A> adapterFactory;
-
- private static final org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(DeploymentDescriptorParserExt.class);
-
- /**
- * Endpoint names that are declared.
- * Used to catch double definitions.
- */
- private final Set<String> names = new HashSet<String>();
-
- /**
- * WSDL/schema documents collected from /WEB-INF/wsdl. Keyed by the system ID.
- */
- private final Map<String, SDDocumentSource> docs = new HashMap<String, SDDocumentSource>();
-
- /**
- *
- * @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 DeploymentDescriptorParserExt(ClassLoader cl, ResourceLoader loader, Container container, AdapterFactory<A> adapterFactory) throws MalformedURLException
- {
- classLoader = cl;
- this.loader = loader;
- this.container = container;
- this.adapterFactory = adapterFactory;
-
- // toggle EJB and WEB deployments
- String resourcePath = "/META-INF/";
- try
- {
- URL resource = loader.getResource(resourcePath);
- InputStream inputStream = null;
- try
- {
- inputStream = resource.openStream();
- }
- finally
- {
- if(inputStream!=null)
- inputStream.close();
- }
-
- log.warn("bypass collectDocs(), it doesnt work for EJB endpoints");
- }
- catch (Exception e)
- {
- resourcePath = "/WEB-INF/";
- log.debug("Collecting docs from " + resourcePath);
-
- collectDocs(resourcePath+"wsdl/");
- logger.fine("metadata=" + docs);
- }
-
- }
-
- /**
- * Parses the {@code sun-jaxws.xml} file and configures
- * a set of {@link HttpAdapter}s.
- */
- public List<A> parse(String systemId, InputStream is)
- {
- XMLStreamReader reader = null;
- try
- {
- reader = new TidyXMLStreamReader(XMLStreamReaderFactory.create(systemId, is, true), is);
- XMLStreamReaderUtil.nextElementContent(reader);
- return parseAdapters(reader);
- }
- finally
- {
- if (reader != null)
- {
- try
- {
- reader.close();
- }
- catch (XMLStreamException e)
- {
- throw new ServerRtException("runtime.parser.xmlReader", e);
- }
- }
- try
- {
- is.close();
- }
- catch (IOException e)
- {
- // ignore
- }
- }
- }
-
- /**
- * Parses the {@code sun-jaxws.xml} file and configures
- * a set of {@link HttpAdapter}s.
- */
- public List<A> parse(File f) throws IOException
- {
- FileInputStream in = new FileInputStream(f);
- try
- {
- return parse(f.getPath(), in);
- }
- finally
- {
- in.close();
- }
- }
-
- /**
- * Get all the WSDL & schema documents recursively.
- */
- private void collectDocs(String dirPath) throws MalformedURLException
- {
- Set<String> paths = loader.getResourcePaths(dirPath);
- if (paths != null)
- {
- for (String path : paths)
- {
- if (path.endsWith("/"))
- {
- collectDocs(path);
- }
- else
- {
- URL res = loader.getResource(path);
- docs.put(res.toString(), SDDocumentSource.create(res));
- }
- }
- }
- }
-
- private List<A> parseAdapters(XMLStreamReader reader)
- {
- if (!reader.getName().equals(QNAME_ENDPOINTS))
- {
- failWithFullName("runtime.parser.invalidElement", reader);
- }
-
- List<A> adapters = new ArrayList<A>();
-
- Attributes attrs = XMLStreamReaderUtil.getAttributes(reader);
- String version = getMandatoryNonEmptyAttribute(reader, attrs, ATTR_VERSION);
- if (!version.equals(ATTRVALUE_VERSION_1_0))
- {
- failWithLocalName("runtime.parser.invalidVersionNumber", reader, version);
- }
-
- while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT)
- if (reader.getName().equals(QNAME_ENDPOINT))
- {
-
- attrs = XMLStreamReaderUtil.getAttributes(reader);
- String name = getMandatoryNonEmptyAttribute(reader, attrs, ATTR_NAME);
- if (!names.add(name))
- {
- logger.warning(WsservletMessages.SERVLET_WARNING_DUPLICATE_ENDPOINT_NAME(/*name*/));
- }
-
- String implementationName = getMandatoryNonEmptyAttribute(reader, attrs, ATTR_IMPLEMENTATION);
- Class<?> implementorClass = getImplementorClass(implementationName, reader, this.classLoader);
- EndpointFactory.verifyImplementorClass(implementorClass);
-
- SDDocumentSource primaryWSDL = getPrimaryWSDL(reader, attrs, implementorClass, this.classLoader, this.docs);
-
- QName serviceName = getQNameAttribute(attrs, ATTR_SERVICE);
- if (serviceName == null)
- serviceName = EndpointFactory.getDefaultServiceName(implementorClass);
-
- QName portName = getQNameAttribute(attrs, ATTR_PORT);
- if (portName == null)
- portName = EndpointFactory.getDefaultPortName(serviceName, implementorClass);
-
- //get enable-mtom attribute value
- String enable_mtom = getAttribute(attrs, ATTR_ENABLE_MTOM);
- String mtomThreshold = getAttribute(attrs, ATTR_MTOM_THRESHOLD_VALUE);
- String bindingId = getAttribute(attrs, ATTR_BINDING);
- if (bindingId != null)
- // Convert short-form tokens to API's binding ids
- bindingId = getBindingIdForToken(bindingId);
- WSBinding binding = createBinding(bindingId, implementorClass, enable_mtom, mtomThreshold);
- String urlPattern = getMandatoryNonEmptyAttribute(reader, attrs, ATTR_URL_PATTERN);
-
- // TODO use 'docs' as the metadata. If wsdl is non-null it's the primary.
-
- boolean handlersSetInDD = setHandlersAndRoles(binding, reader, serviceName, portName, this.classLoader);
-
- ensureNoContent(reader);
- Invoker invoker = createInvoker(implementorClass);
- WSEndpoint<?> endpoint = WSEndpoint.create(implementorClass, !handlersSetInDD, invoker,
- serviceName, portName, container, binding, primaryWSDL, docs.values(), createEntityResolver(this.loader), false);
- adapters.add(adapterFactory.createAdapter(name, urlPattern, endpoint));
- }
- else
- {
- failWithLocalName("runtime.parser.invalidElement", reader);
- }
- return adapters;
- }
-
- protected Invoker createInvoker(Class<?> implementorClass)
- {
- Invoker invoker = InstanceResolver.createDefault(implementorClass).createInvoker();
- return invoker;
- }
-
- /**
- * @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
- */
- private static WSBinding createBinding(String ddBindingId, Class<?> implClass, String mtomEnabled, String mtomThreshold)
- {
- // Features specified through DD
- WebServiceFeatureList features;
-
- MTOMFeature mtomfeature = null;
- if (mtomEnabled != null)
- {
- if (mtomThreshold != null)
- mtomfeature = new MTOMFeature(Boolean.valueOf(mtomEnabled), Integer.valueOf(mtomThreshold));
- else mtomfeature = new MTOMFeature(Boolean.valueOf(mtomEnabled));
- }
-
- BindingID bindingID;
- if (ddBindingId != null)
- {
- bindingID = BindingID.parse(ddBindingId);
- features = bindingID.createBuiltinFeatureList();
-
- if (checkMtomConflict(features.get(MTOMFeature.class), mtomfeature))
- {
- throw new ServerRtException(ServerMessages.DD_MTOM_CONFLICT(ddBindingId, mtomEnabled));
- }
- }
- else
- {
- bindingID = BindingID.parse(implClass);
- // Since bindingID is coming from implclass,
- // mtom through Feature annotation or DD takes precendece
-
- features = new WebServiceFeatureList();
- if (mtomfeature != null)
- features.add(mtomfeature); // this wins over MTOM setting in bindingID
- features.addAll(bindingID.createBuiltinFeatureList());
- }
-
- return bindingID.createBinding(features.toArray());
- }
-
- private static boolean checkMtomConflict(MTOMFeature lhs, MTOMFeature rhs)
- {
- if (lhs == null || rhs == null)
- return false;
- return lhs.isEnabled() ^ rhs.isEnabled();
- }
-
- /**
- * 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
- */
- private static String getBindingIdForToken(String lexical)
- {
- if (lexical.equals("##SOAP11_HTTP"))
- {
- return SOAPBinding.SOAP11HTTP_BINDING;
- }
- else if (lexical.equals("##SOAP11_HTTP_MTOM"))
- {
- return SOAPBinding.SOAP11HTTP_MTOM_BINDING;
- }
- else if (lexical.equals("##SOAP12_HTTP"))
- {
- return SOAPBinding.SOAP12HTTP_BINDING;
- }
- else if (lexical.equals("##SOAP12_HTTP_MTOM"))
- {
- return SOAPBinding.SOAP12HTTP_MTOM_BINDING;
- }
- else if (lexical.equals("##XML_HTTP"))
- {
- return HTTPBinding.HTTP_BINDING;
- }
- return lexical;
- }
-
- /**
- * 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 static SDDocumentSource getPrimaryWSDL
- (
- XMLStreamReader xsr,
- Attributes attrs,
- Class<?> implementorClass,
- ClassLoader loader,
- Map<String, SDDocumentSource> docs
- )
- {
- String wsdlFile = getAttribute(attrs, ATTR_WSDL);
- if (wsdlFile == null)
- {
- wsdlFile = EndpointFactory.getWsdlLocation(implementorClass);
- }
-
- if (wsdlFile != null)
- {
- URL wsdl = loader.getResource(wsdlFile);
- if (wsdl == null)
- {
- throw new LocatableWebServiceException(ServerMessages.RUNTIME_PARSER_WSDL_NOT_FOUND(wsdlFile), xsr);
- }
-
- // bypass the docs init
- docs.put(wsdl.toExternalForm(), SDDocumentSource.create(wsdl));
-
- SDDocumentSource docInfo = docs.get(wsdl.toExternalForm());
- assert docInfo != null;
- return docInfo;
- }
-
- return null;
- }
-
- /**
- * Creates an {@link EntityResolver} that consults {@code /WEB-INF/jax-ws-catalog.xml}.
- */
- private static EntityResolver createEntityResolver(ResourceLoader loader)
- {
- try
- {
- return XmlUtil.createEntityResolver(loader.getCatalogFile());
- }
- catch (MalformedURLException e)
- {
- throw new WebServiceException(e);
- }
- }
-
- private static String getAttribute(Attributes attrs, String name)
- {
- String value = attrs.getValue(name);
- if (value != null)
- {
- value = value.trim();
- }
- return value;
- }
-
- private static QName getQNameAttribute(Attributes attrs, String name)
- {
- String value = getAttribute(attrs, name);
- if (value == null || value.equals(""))
- {
- return null;
- }
- else
- {
- return QName.valueOf(value);
- }
- }
-
- /*
- private static String getNonEmptyAttribute(XMLStreamReader reader, Attributes attrs, String name)
- {
- String value = getAttribute(attrs, name);
- if (value != null && value.equals(""))
- {
- failWithLocalName("runtime.parser.invalidAttributeValue", reader, name);
- }
- return value;
- }
-
- private static String getMandatoryAttribute(XMLStreamReader reader, Attributes attrs, String name)
- {
- String value = getAttribute(attrs, name);
- if (value == null)
- {
- failWithLocalName("runtime.parser.missing.attribute", reader, name);
- }
- return value;
- }*/
-
- private static String getMandatoryNonEmptyAttribute(XMLStreamReader reader, Attributes attributes, String name)
- {
- String value = getAttribute(attributes, name);
- if (value == null)
- {
- failWithLocalName("runtime.parser.missing.attribute", reader, name);
- }
- else if (value.equals(""))
- {
- failWithLocalName("runtime.parser.invalidAttributeValue", reader, 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.
- */
- private static boolean setHandlersAndRoles(WSBinding binding, XMLStreamReader reader, QName serviceName, QName portName, ClassLoader classLoader)
- {
- if (XMLStreamReaderUtil.nextElementContent(reader) == XMLStreamConstants.END_ELEMENT || !reader.getName().equals(HandlerChainsModel.QNAME_HANDLER_CHAINS))
- {
- return false;
- }
-
- HandlerAnnotationInfo handlerInfo = HandlerChainsModel.parseHandlerFile(reader, classLoader, serviceName, portName, binding);
- binding.setHandlerChain(handlerInfo.getHandlers());
- if (binding instanceof SOAPBinding)
- {
- ((SOAPBinding)binding).setRoles(handlerInfo.getRoles());
- }
-
- // move past </handler-chains>
- XMLStreamReaderUtil.nextContent(reader);
- return true;
- }
-
- private static void ensureNoContent(XMLStreamReader reader)
- {
- if (reader.getEventType() != XMLStreamConstants.END_ELEMENT)
- {
- fail("runtime.parser.unexpectedContent", reader);
- }
- }
-
- private static void fail(String key, XMLStreamReader reader)
- {
- logger.log(Level.SEVERE, key + reader.getLocation().getLineNumber());
- throw new ServerRtException(key, Integer.toString(reader.getLocation().getLineNumber()));
- }
-
- private static void failWithFullName(String key, XMLStreamReader reader)
- {
- throw new ServerRtException(key, reader.getLocation().getLineNumber(), reader.getName());
- }
-
- private static void failWithLocalName(String key, XMLStreamReader reader)
- {
- throw new ServerRtException(key, reader.getLocation().getLineNumber(), reader.getLocalName());
- }
-
- private static void failWithLocalName(String key, XMLStreamReader reader, String arg)
- {
- throw new ServerRtException(key, reader.getLocation().getLineNumber(), reader.getLocalName(), arg);
- }
-
- /**
- * Loads the class of the given name.
- * @param reader used to report the source location information if there's any error
- */
- private static Class<?> getImplementorClass(String name, XMLStreamReader reader, ClassLoader classLoader)
- {
- try
- {
- return Class.forName(name, true, classLoader);
- }
- catch (ClassNotFoundException e)
- {
- logger.log(Level.SEVERE, e.getMessage(), e);
- throw new LocatableWebServiceException(ServerMessages.RUNTIME_PARSER_CLASS_NOT_FOUND(name), e, reader);
- }
- }
-}
Deleted: stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/DeploymentDescriptorParserJBWS.java
===================================================================
--- stack/metro/branches/tdiesler/trunk/modules/server/src/main/java/org/jboss/wsf/stack/metro/DeploymentDescriptorParserJBWS.java 2008-04-29 08:40:46 UTC (rev 6739)
+++ stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/DeploymentDescriptorParserJBWS.java 2008-04-29 09:51:21 UTC (rev 6741)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.wsf.stack.metro;
-
-// $Id$
-
-import java.net.MalformedURLException;
-
-import javax.ejb.Stateless;
-
-import com.sun.xml.ws.api.server.Container;
-import com.sun.xml.ws.api.server.InstanceResolver;
-import com.sun.xml.ws.api.server.Invoker;
-import com.sun.xml.ws.transport.http.ResourceLoader;
-import com.sun.xml.ws.transport.http.DeploymentDescriptorParser.AdapterFactory;
-
-/**
- * A copy of DeploymentDescriptorParser that externalizes
- *
- * createInvoker(Class)
- *
- * @author Thomas.Diesler at jboss.org
- * @since 10-May-2007
- */
-public class DeploymentDescriptorParserJBWS<A> extends DeploymentDescriptorParserExt<A>
-{
- public DeploymentDescriptorParserJBWS(ClassLoader cl, ResourceLoader loader, Container container, AdapterFactory<A> adapterFactory) throws MalformedURLException
- {
- super(cl, loader, container, adapterFactory);
- }
-
- @Override
- protected Invoker createInvoker(Class<?> implClass)
- {
- Invoker invoker;
- InstanceResolver<?> resolver = InstanceResolver.createDefault(implClass);
- if (implClass.isAnnotationPresent(Stateless.class))
- {
- invoker = new InvokerEJB3(resolver);
- }
- else
- {
- invoker = new InvokerJSE(resolver);
- }
- return invoker;
- }
-
-}
Deleted: stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/EndpointRegistryFactoryImpl.java
===================================================================
--- stack/metro/branches/tdiesler/trunk/modules/server/src/main/java/org/jboss/wsf/stack/metro/EndpointRegistryFactoryImpl.java 2008-04-29 08:40:46 UTC (rev 6739)
+++ stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/EndpointRegistryFactoryImpl.java 2008-04-29 09:51:21 UTC (rev 6741)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.wsf.stack.metro;
-
-import org.jboss.wsf.spi.management.EndpointRegistryFactory;
-import org.jboss.wsf.spi.management.EndpointRegistry;
-import org.jboss.wsf.common.KernelAwareSPIFactory;
-
-/**
- * An EndpointRegistryFactory implementation that retrieves
- * the registry from MC kernel.
- *
- * @see EndpointRegistry.BEAN_NAME
- *
- * @author Heiko.Braun at jboss.com
- * Created: Jul 23, 2007
- */
-public class EndpointRegistryFactoryImpl extends EndpointRegistryFactory
-{
- public EndpointRegistry getEndpointRegistry()
- {
- return new KernelAwareSPIFactory().getKernelProvidedSPI(
- EndpointRegistry.BEAN_NAME, EndpointRegistry.class
- );
- }
-}
Deleted: stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/EndpointServlet.java
===================================================================
--- stack/metro/branches/tdiesler/trunk/modules/server/src/main/java/org/jboss/wsf/stack/metro/EndpointServlet.java 2008-04-29 08:40:46 UTC (rev 6739)
+++ stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/EndpointServlet.java 2008-04-29 09:51:21 UTC (rev 6741)
@@ -1,103 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.wsf.stack.metro;
-
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.management.EndpointRegistry;
-import org.jboss.wsf.spi.management.EndpointRegistryFactory;
-import org.jboss.wsf.spi.SPIProvider;
-import org.jboss.wsf.spi.SPIProviderResolver;
-import org.jboss.wsf.spi.invocation.RequestHandler;
-import org.jboss.wsf.spi.invocation.EndpointAssociation;
-import org.jboss.wsf.common.ObjectNameFactory;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpServlet;
-import javax.management.ObjectName;
-import javax.xml.ws.WebServiceException;
-import java.io.IOException;
-
-/**
- * @author Heiko.Braun at jboss.com
- * Created: Jul 24, 2007
- */
-public class EndpointServlet extends HttpServlet
-{
- protected Endpoint endpoint;
- protected EndpointRegistry epRegistry;
-
- public void init(ServletConfig servletConfig) throws ServletException
- {
- super.init(servletConfig);
- SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
- epRegistry = spiProvider.getSPI(EndpointRegistryFactory.class).getEndpointRegistry();
- }
-
- public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
- {
- if (endpoint == null)
- {
- String contextPath = req.getContextPath();
- initServiceEndpoint(contextPath);
- }
-
- try
- {
- EndpointAssociation.setEndpoint(endpoint);
- RequestHandler requestHandler = endpoint.getRequestHandler();
- requestHandler.handleHttpRequest(endpoint, req, res, getServletContext());
- }
- finally
- {
- EndpointAssociation.removeEndpoint();
- }
- }
-
- /** Initialize the service endpoint
- */
- protected void initServiceEndpoint(String contextPath)
- {
- WebAppResolver resolver = new WebAppResolver(contextPath, getServletName());
- this.endpoint = epRegistry.resolve(resolver);
-
- if (this.endpoint == null)
- {
- ObjectName oname = ObjectNameFactory.create(Endpoint.SEPID_DOMAIN + ":" +
- Endpoint.SEPID_PROPERTY_CONTEXT + "=" + contextPath + "," +
- Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + getServletName()
- );
- throw new WebServiceException("Cannot obtain endpoint for: " + oname);
- }
-
- // Set the runtime classloader for JSE endpoints, this should be the tomcat classloader
- Deployment dep = endpoint.getService().getDeployment();
- if (dep.getType() == Deployment.DeploymentType.JAXRPC_JSE || dep.getType() == Deployment.DeploymentType.JAXWS_JSE)
- {
- ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
- dep.setRuntimeClassLoader(classLoader);
- }
- }
-}
Deleted: stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/InvokerEJB3.java
===================================================================
--- stack/metro/branches/tdiesler/trunk/modules/server/src/main/java/org/jboss/wsf/stack/metro/InvokerEJB3.java 2008-04-29 08:40:46 UTC (rev 6739)
+++ stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/InvokerEJB3.java 2008-04-29 09:51:21 UTC (rev 6741)
@@ -1,116 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.wsf.stack.metro;
-
-// $Id$
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import javax.xml.ws.Provider;
-import javax.xml.ws.WebServiceException;
-import javax.xml.ws.handler.MessageContext;
-
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.invocation.EndpointAssociation;
-import org.jboss.wsf.spi.invocation.Invocation;
-import org.jboss.wsf.spi.invocation.InvocationHandler;
-
-import com.sun.xml.ws.api.message.Packet;
-import com.sun.xml.ws.api.server.InstanceResolver;
-import com.sun.xml.ws.api.server.Invoker;
-import com.sun.xml.ws.api.server.WSEndpoint;
-import com.sun.xml.ws.api.server.WSWebServiceContext;
-
-/**
- * An invoker for EJB3 endpoints
- *
- * @author Thomas.Diesler at jboss.org
- * @since 10-May-2007
- */
-public class InvokerEJB3 extends Invoker
-{
- private final InstanceResolver resolver;
- private WSWebServiceContext webServiceCtx;
-
- public InvokerEJB3(InstanceResolver resolver)
- {
- this.resolver = resolver;
- }
-
- @Override
- public void start(WSWebServiceContext webServiceCtx, WSEndpoint endpoint)
- {
- this.resolver.start(webServiceCtx, endpoint);
- this.webServiceCtx = webServiceCtx;
- }
-
- @Override
- public void dispose()
- {
- this.resolver.dispose();
- }
-
- @Override
- public <T> T invokeProvider(Packet p, T arg)
- {
- Object targetBean = this.resolver.resolve(p);
- return ((Provider<T>)targetBean).invoke(arg);
- }
-
- @Override
- public Object invoke(Packet p, Method m, Object... args)
- throws InvocationTargetException, IllegalAccessException
- {
- Endpoint endpoint = EndpointAssociation.getEndpoint();
- InvocationHandler invocationHandler = endpoint.getInvocationHandler();
- Invocation invocation = invocationHandler.createInvocation();
- invocation.getInvocationContext().addAttachment(MessageContext.class, this.webServiceCtx.getMessageContext());
- invocation.setJavaMethod(m);
- invocation.setArgs(args);
-
- Object retObj = null;
- try
- {
- invocationHandler.invoke(endpoint, invocation);
- retObj = invocation.getReturnValue();
- }
- catch (Exception ex)
- {
- handleException(ex);
- }
-
- return retObj;
- }
-
- private void handleException(Exception ex)
- throws InvocationTargetException, IllegalAccessException
- {
- if (ex instanceof InvocationTargetException)
- throw (InvocationTargetException)ex;
-
- if (ex instanceof IllegalAccessException)
- throw (IllegalAccessException)ex;
-
- throw new WebServiceException(ex);
- }
-}
\ No newline at end of file
Deleted: stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/InvokerJSE.java
===================================================================
--- stack/metro/branches/tdiesler/trunk/modules/server/src/main/java/org/jboss/wsf/stack/metro/InvokerJSE.java 2008-04-29 08:40:46 UTC (rev 6739)
+++ stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/InvokerJSE.java 2008-04-29 09:51:21 UTC (rev 6741)
@@ -1,116 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.wsf.stack.metro;
-
-// $Id$
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import javax.xml.ws.Provider;
-import javax.xml.ws.WebServiceException;
-
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.invocation.EndpointAssociation;
-import org.jboss.wsf.spi.invocation.Invocation;
-import org.jboss.wsf.spi.invocation.InvocationContext;
-import org.jboss.wsf.spi.invocation.InvocationHandler;
-
-import com.sun.xml.ws.api.message.Packet;
-import com.sun.xml.ws.api.server.InstanceResolver;
-import com.sun.xml.ws.api.server.Invoker;
-import com.sun.xml.ws.api.server.WSEndpoint;
-import com.sun.xml.ws.api.server.WSWebServiceContext;
-
-/**
- * An invoker for JSE endpoints
- *
- * @author Thomas.Diesler at jboss.org
- * @since 10-May-2007
- */
-public class InvokerJSE extends Invoker
-{
- private final InstanceResolver resolver;
-
- public InvokerJSE(InstanceResolver resolver)
- {
- this.resolver = resolver;
- }
-
- @Override
- public void start(WSWebServiceContext webServiceCtx, WSEndpoint endpoint)
- {
- resolver.start(webServiceCtx, endpoint);
- }
-
- @Override
- public void dispose()
- {
- resolver.dispose();
- }
-
- @Override
- public <T> T invokeProvider(Packet p, T arg)
- {
- Object targetBean = resolver.resolve(p);
- return ((Provider<T>)targetBean).invoke(arg);
- }
-
- @Override
- public Object invoke(Packet p, Method m, Object... args)
- throws InvocationTargetException, IllegalAccessException
- {
- Endpoint endpoint = EndpointAssociation.getEndpoint();
- InvocationHandler invocationHandler = endpoint.getInvocationHandler();
- Invocation invocation = invocationHandler.createInvocation();
- InvocationContext invContext = invocation.getInvocationContext();
- invocation.setJavaMethod(m);
- invocation.setArgs(args);
-
- Object retObj = null;
- try
- {
- Object targetBean = resolver.resolve(p);
- invContext.setTargetBean(targetBean);
- invocationHandler.invoke(endpoint, invocation);
- retObj = invocation.getReturnValue();
- }
- catch (Exception ex)
- {
- handleException(ex);
- }
-
- return retObj;
- }
-
- private void handleException(Exception ex)
- throws InvocationTargetException, IllegalAccessException
- {
- if (ex instanceof InvocationTargetException)
- throw (InvocationTargetException)ex;
-
- if (ex instanceof IllegalAccessException)
- throw (IllegalAccessException)ex;
-
- throw new WebServiceException(ex);
- }
-}
Deleted: stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/MessageStreamAdapter.java
===================================================================
--- stack/metro/branches/tdiesler/trunk/modules/server/src/main/java/org/jboss/wsf/stack/metro/MessageStreamAdapter.java 2008-04-29 08:40:46 UTC (rev 6739)
+++ stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/MessageStreamAdapter.java 2008-04-29 09:51:21 UTC (rev 6741)
@@ -1,121 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.wsf.stack.metro;
-
-import com.sun.xml.ws.api.message.Packet;
-import com.sun.xml.ws.api.server.Adapter;
-import com.sun.xml.ws.api.server.TransportBackChannel;
-import com.sun.xml.ws.api.server.WSEndpoint;
-import com.sun.xml.ws.transport.http.DeploymentDescriptorParser.AdapterFactory;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author Heiko Braun
- */
-public class MessageStreamAdapter extends Adapter<MessageStreamAdapter.StreamToolkit>
-{
- public static final AdapterFactory<MessageStreamAdapter> FACTORY = new AdapterFactory<MessageStreamAdapter>()
- {
- public MessageStreamAdapter createAdapter(String name, String urlPattern, WSEndpoint<?> endpoint)
- {
- return new MessageStreamAdapter(endpoint);
- }
- };
-
- public MessageStreamAdapter(WSEndpoint endpoint)
- {
- super(endpoint);
- }
-
- public void handle(MessageStreamContext context, InputStream in, OutputStream out)
- throws IOException
- {
- MessageStreamConnectionImpl connection = new MessageStreamConnectionImpl(context, in, out);
-
- StreamToolkit tk = pool.take();
- try
- {
- tk.handle(connection);
- connection.flush();
- }
- finally
- {
- pool.recycle(tk);
- connection.close();
- }
- }
-
- protected StreamToolkit createToolkit()
- {
- return new StreamToolkit();
- }
-
- class StreamToolkit extends Adapter.Toolkit implements TransportBackChannel
- {
- private MessageStreamConnectionImpl connection;
-
- private void handle(MessageStreamConnectionImpl connection)
- throws IOException
- {
- this.connection = connection;
-
- String contentTypeStr = connection.getRequestHeader(MessageStreamContext.CONTENT_TYPE);
- InputStream in = connection.getInputStream();
- Packet packet = new Packet();
- codec.decode(in, contentTypeStr, packet);
-
- try
- {
- packet = head.process(packet, connection, this);
- }
- catch(Exception e)
- {
- e.printStackTrace();
- connection.setStatus(MessageStreamContext.STATUS_INTERNAL_SERVER_ERROR);
- return;
- }
-
- contentTypeStr = codec.getStaticContentType(packet).getContentType();
- if (contentTypeStr == null)
- {
- throw new UnsupportedOperationException();
- }
- else
- {
- Map<String, String> headers = new HashMap();
- headers.put(MessageStreamContext.CONTENT_TYPE, contentTypeStr);
- connection.setResponseHeaders(headers);
- codec.encode(packet, connection.getOutputStream());
- }
- }
-
- public void close()
- {
- connection.close();
- }
- }
-}
Deleted: stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/MessageStreamConnectionImpl.java
===================================================================
--- stack/metro/branches/tdiesler/trunk/modules/server/src/main/java/org/jboss/wsf/stack/metro/MessageStreamConnectionImpl.java 2008-04-29 08:40:46 UTC (rev 6739)
+++ stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/MessageStreamConnectionImpl.java 2008-04-29 09:51:21 UTC (rev 6741)
@@ -1,181 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.wsf.stack.metro;
-
-import com.sun.xml.ws.api.message.Packet;
-import com.sun.xml.ws.api.server.WSEndpoint;
-import com.sun.xml.ws.api.server.WebServiceContextDelegate;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.security.Principal;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author Heiko Braun
- */
-public class MessageStreamConnectionImpl implements WebServiceContextDelegate
-{
- private int status;
- private boolean isClosed;
- private InputStream inputStream;
- private OutputStream outputStream;
- private MessageStreamContext messageContext;
- private Map<String, String> requestHeaders = new HashMap<String, String>();
- private Map<String, String> responseHeaders;
-
- public MessageStreamConnectionImpl(MessageStreamContext context, InputStream in, OutputStream out)
- {
- this.outputStream = out;
- this.inputStream = in;
- this.messageContext = context;
- populateRequestHeaders();
- }
-
- public int getStatus()
- {
- return this.status;
- }
-
- public void setStatus(int statusCode)
- {
- this.status = statusCode;
- }
-
- public Map<String, String> getRequestHeaders()
- {
- return this.requestHeaders;
- }
-
- public void setRequestHeaders(Map<String, String> requestHeaders)
- {
- this.requestHeaders = requestHeaders;
- }
-
- public String getRequestHeader(String name)
- {
- return this.requestHeaders.get(name);
- }
-
- public Map<String, String> getResponseHeaders()
- {
- return this.responseHeaders;
- }
-
- public void setResponseHeaders(Map<String, String> responseHeaders)
- {
- this.responseHeaders = responseHeaders;
- }
-
- public InputStream getInputStream()
- {
- return this.inputStream;
- }
-
- public OutputStream getOutputStream()
- {
- return this.outputStream;
- }
-
- public void closeInput()
- {
- if (this.inputStream != null)
- {
- try
- {
- this.inputStream.close();
- }
- catch (IOException ignore) {}
- this.inputStream = null;
- }
- }
-
- public void closeOutput()
- {
- if (this.outputStream != null)
- {
- try
- {
- this.outputStream.close();
- }
- catch (IOException ignore) {}
- this.outputStream = null;
- }
- }
-
- public void close()
- {
- if (this.isClosed == false)
- {
- synchronized (this)
- {
- if (this.isClosed == false)
- {
- this.isClosed = true;
- closeInput();
- closeOutput();
- }
- }
- }
- }
-
- public void flush()
- throws IOException
- {
- if (this.outputStream != null)
- {
- this.outputStream.flush();
- }
- }
-
- public Principal getUserPrincipal(Packet request)
- {
- throw new UnsupportedOperationException();
- }
-
- public boolean isUserInRole(Packet request, String role)
- {
- throw new UnsupportedOperationException();
- }
-
- @SuppressWarnings("unchecked")
- public String getEPRAddress(Packet request, WSEndpoint endpoint)
- {
- throw new UnsupportedOperationException();
- }
-
- @SuppressWarnings("unchecked")
- public String getWSDLAddress(Packet request, WSEndpoint endpoint)
- {
- throw new UnsupportedOperationException();
- }
-
- private void populateRequestHeaders()
- {
- for(String s : this.messageContext.getRequestContext().keySet())
- {
- this.requestHeaders.put(s, this.messageContext.getRequestContext().get(s));
- }
- }
-}
Deleted: stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/MessageStreamContext.java
===================================================================
--- stack/metro/branches/tdiesler/trunk/modules/server/src/main/java/org/jboss/wsf/stack/metro/MessageStreamContext.java 2008-04-29 08:40:46 UTC (rev 6739)
+++ stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/MessageStreamContext.java 2008-04-29 09:51:21 UTC (rev 6741)
@@ -1,57 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.wsf.stack.metro;
-
-import java.util.Map;
-import java.util.HashMap;
-
-/**
- * @author Heiko Braun
- */
-class MessageStreamContext
-{
- public static final int STATUS_INTERNAL_SERVER_ERROR = 500;
- public static final String CONTENT_TYPE = "Content-Type";
-
- private Map<String, String> requestContext = new HashMap<String, String>();
- private Map<String, String> responseContext = new HashMap<String, String>();
-
- public Map<String, String> getRequestContext()
- {
- return requestContext;
- }
-
- public void setRequestContext(Map<String, String> requestContext)
- {
- this.requestContext = requestContext;
- }
-
- public Map<String, String> getResponseContext()
- {
- return responseContext;
- }
-
- public void setResponseContext(Map<String, String> responseContext)
- {
- this.responseContext = responseContext;
- }
-}
Deleted: stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/MetroServerConfig.java
===================================================================
--- stack/metro/branches/tdiesler/trunk/modules/server/src/main/java/org/jboss/wsf/stack/metro/MetroServerConfig.java 2008-04-29 08:40:46 UTC (rev 6739)
+++ stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/MetroServerConfig.java 2008-04-29 09:51:21 UTC (rev 6741)
@@ -1,55 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.wsf.stack.metro;
-
-//$Id$
-
-import org.jboss.logging.Logger;
-import org.jboss.wsf.common.management.AbstractServerConfig;
-
-/**
- * Basic implementation of a ServerConfig
- *
- * @author Thomas.Diesler at jboss.org
- * @since 08-May-2006
- */
-public class MetroServerConfig extends AbstractServerConfig implements MetroServerConfigMBean
-{
- private static final Logger log = Logger.getLogger(MetroServerConfig.class);
-
- public String getImplementationTitle()
- {
- return getClass().getPackage().getImplementationTitle();
- }
-
- public String getImplementationVersion()
- {
- return getClass().getPackage().getImplementationVersion();
- }
-
- public void create() throws Exception
- {
- log.info(getImplementationTitle());
- log.info(getImplementationVersion());
- super.create();
- }
-}
Deleted: stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/MetroServerConfigMBean.java
===================================================================
--- stack/metro/branches/tdiesler/trunk/modules/server/src/main/java/org/jboss/wsf/stack/metro/MetroServerConfigMBean.java 2008-04-29 08:40:46 UTC (rev 6739)
+++ stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/MetroServerConfigMBean.java 2008-04-29 09:51:21 UTC (rev 6741)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.wsf.stack.metro;
-
-//$Id$
-
-import org.jboss.wsf.common.management.AbstractServerConfigMBean;
-
-/**
- * Basic implementation of a ServerConfig
- *
- * @author Thomas.Diesler at jboss.org
- * @since 08-May-2006
- */
-public interface MetroServerConfigMBean extends AbstractServerConfigMBean
-{
-}
Deleted: stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/RequestHandlerFactoryImpl.java
===================================================================
--- stack/metro/branches/tdiesler/trunk/modules/server/src/main/java/org/jboss/wsf/stack/metro/RequestHandlerFactoryImpl.java 2008-04-29 08:40:46 UTC (rev 6739)
+++ stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/RequestHandlerFactoryImpl.java 2008-04-29 09:51:21 UTC (rev 6741)
@@ -1,37 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.wsf.stack.metro;
-
-import org.jboss.wsf.spi.invocation.RequestHandlerFactory;
-import org.jboss.wsf.spi.invocation.RequestHandler;
-
-/**
- * @author Heiko.Braun at jboss.com
- * Created: Jul 24, 2007
- */
-public class RequestHandlerFactoryImpl extends RequestHandlerFactory
-{
- public RequestHandler newRequestHandler()
- {
- return new RequestHandlerImpl();
- }
-}
Deleted: stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/RequestHandlerImpl.java
===================================================================
--- stack/metro/branches/tdiesler/trunk/modules/server/src/main/java/org/jboss/wsf/stack/metro/RequestHandlerImpl.java 2008-04-29 08:40:46 UTC (rev 6739)
+++ stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/RequestHandlerImpl.java 2008-04-29 09:51:21 UTC (rev 6741)
@@ -1,288 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.wsf.stack.metro;
-
-//$Id$
-
-import com.sun.xml.ws.transport.http.servlet.ServletAdapter;
-import org.jboss.logging.Logger;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.invocation.InvocationContext;
-import org.jboss.wsf.spi.invocation.RequestHandler;
-import org.jboss.wsf.spi.invocation.EndpointAssociation;
-import org.jboss.wsf.common.IOUtils;
-
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.ws.WebServiceException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.Writer;
-import java.util.Map;
-import java.util.Properties;
-import java.net.URL;
-
-/**
- * Request handler that delegates to Metro's ServletAdapter.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 25-Apr-2007
- */
-class RequestHandlerImpl implements RequestHandler
-{
- // provide logging
- private static final Logger log = Logger.getLogger(RequestHandlerImpl.class);
-
- RequestHandlerImpl()
- {
- }
-
- /**
- * Handles HTTP requests. It supports <b>POST</b> and <b>GET</b> HTTP methods only.
- * @param endpoint endpoint
- * @param req servlet request to handle
- * @param res servlet response to return
- * @param servletCtx servlet context
- * @throws ServletException when some problem occurs
- * @throws IOException when some IO problem occurs
- */
- public void handleHttpRequest(Endpoint endpoint, HttpServletRequest req, HttpServletResponse res, ServletContext servletCtx)
- throws ServletException, IOException
- {
- ServletAdapter target = endpoint.getAttachment(ServletAdapter.class);
- if(null == target)
- throw new IllegalStateException("Cannot obtain ServletAdapter");
-
- EndpointAssociation.setEndpoint(endpoint);
- try
- {
- String method = req.getMethod();
- if (method.equals("POST"))
- {
- doPost(target, servletCtx, req, res);
- }
- else if(method.equals("GET"))
- {
- doGet(target, req, servletCtx, res);
- }
- else
- {
- throw new WebServiceException("Unsupported method: " + method);
- }
- }
- finally
- {
- EndpointAssociation.removeEndpoint();
- }
- }
-
- /**
- * The InvocationContext accepts a {@link Properties} attachment that can carry request properties.<br/>
- * The properties keys are derived from {@link org.jboss.wsf.stack.metro.MessageStreamContext}
- * @param endpoint endpoint
- * @param inStream input stream
- * @param outStream output stream
- * @param invCtx invocation context
- */
- public void handleRequest(Endpoint endpoint, InputStream inStream, OutputStream outStream, InvocationContext invCtx)
- {
- MessageStreamAdapter adapter = endpoint.getAttachment(MessageStreamAdapter.class);
- if (adapter == null)
- throw new IllegalStateException("Cannot obtain: " + adapter.getClass().getName());
-
- try
- {
- // Hacky, but the InvokerJSE requires it.
- // It's better to do it here than outside the RequestHandler.
- EndpointAssociation.setEndpoint(endpoint);
-
- MessageStreamContext streamContext = new MessageStreamContext();
- copyProperties(invCtx, streamContext);
- adapter.handle(streamContext, inStream, outStream );
- }
- catch (IOException e)
- {
- throw new WebServiceException("Failed to process request: " + e.getMessage(), e);
- }
- finally
- {
- EndpointAssociation.removeEndpoint();
- }
- }
-
- /**
- * Handles HTTP get request. It obtains endpoint's address and constructs URL with <b>?wsdl</b> query string.
- * The constructed URL is used to create the input stream to read WSDL content from and submited to the user.
- * @param endpoint endpoint
- * @param outStream output stream
- * @param invCtx invocation context
- */
- public void handleWSDLRequest(Endpoint endpoint, OutputStream outStream, InvocationContext invCtx)
- {
- String endpointAddress = endpoint.getAddress();
- if (endpointAddress == null)
- throw new IllegalArgumentException("Invalid endpoint address: " + endpointAddress);
-
- InputStream inStream = null;
- try
- {
- URL wsdlUrl = new URL(endpointAddress + "?wsdl");
- inStream = wsdlUrl.openStream();
- IOUtils.copyStream(outStream, inStream);
- }
- catch (IOException e)
- {
- throw new WebServiceException("Failed to process WSDL request: " + e.getMessage(), e);
- }
- finally
- {
- // close input stream when available
- try
- {
- if(inStream!=null) inStream.close();
- }
- catch (IOException ignore) {}
- // close output stream when available
- try
- {
- if(outStream!=null) outStream.close();
- }
- catch (IOException ignore) {}
- }
- }
-
- /**
- * Handles HTTP GET request using Metro's ServletAdapter <b>publishWSDL</b> method
- * @param target Metro's ServletAdapter
- * @param req request message
- * @param context servlet context
- * @param res response message
- * @throws ServletException if some problem occurs
- */
- private static void doGet(ServletAdapter target, HttpServletRequest req, ServletContext context, HttpServletResponse res)
- throws ServletException
- {
- try
- {
- if (target != null)
- {
- String query = req.getQueryString();
- if (isMetadataQuery(query))
- {
- // Sends published WSDL and schema documents
- target.publishWSDL(context, req, res);
- return;
- }
- else
- {
- sendResponse(405, "HTTP GET not supported", res);
- }
- }
- else
- {
- sendResponse(404, "Not found", res);
- }
- }
- catch (Exception e)
- {
- log.error("Failed to process GET request", e);
- throw new ServletException(e.getMessage());
- }
- }
-
- /**
- * Handles HTTP POST request using Metro's ServletAdapter <b>handle</b> method
- * @param target Metro's ServletAdapter
- * @param req request message
- * @param context servlet context
- * @param res response message
- * @throws ServletException if some problem occurs
- */
- private static void doPost(ServletAdapter target, ServletContext context, HttpServletRequest req, HttpServletResponse res)
- {
- try
- {
- target.handle(context, req, res);
- }
- catch (Throwable e)
- {
- log.error("Failed to process POST request", e);
- res.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- }
- }
-
- /**
- * Copies properties from invocation context to message context when properties are available
- * @param invCtx invocation context
- * @param msgCtx message context
- */
- private static void copyProperties(InvocationContext invCtx, MessageStreamContext msgCtx)
- {
- boolean invCtxAvailable = (invCtx != null);
- boolean invCtxHasProps = (invCtx.getAttachment(Properties.class) != null);
-
- if (invCtxAvailable && invCtxHasProps)
- {
- Map<String, String> msgReqCtx = msgCtx.getRequestContext();
- Properties invCtxProps = invCtx.getAttachment(Properties.class);
-
- // copy invocation properties to message request context
- for(Object keyObject : invCtxProps.keySet())
- {
- String key = (String)keyObject;
- msgReqCtx.put(key, invCtxProps.getProperty(key));
- }
- }
- }
-
- /**
- * Sends HTTP text message to the client
- * @param status HTTP status code to return
- * @param message text message
- * @param res response to write message to
- * @throws IOException when some IO problem occurs
- */
- private static void sendResponse(int status, String message, HttpServletResponse res)
- throws IOException
- {
- res.setStatus(status);
- res.setContentType("text/plain");
- Writer out = res.getWriter();
- out.write(message);
- out.close();
- }
-
- /**
- * Returns true if the given query string is for metadata request.
- * @param query HTTP query, can be null
- * @return true for metadata requests false otherwise
- */
- private static boolean isMetadataQuery(String query)
- {
- // we intentionally return true even if documents don't exist, so that they get 404.
- return (query != null) && (query.equals("WSDL") || query.startsWith("wsdl") || query.startsWith("xsd="));
- }
-
-}
Deleted: stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/ServletResourceLoader.java
===================================================================
--- stack/metro/branches/tdiesler/trunk/modules/server/src/main/java/org/jboss/wsf/stack/metro/ServletResourceLoader.java 2008-04-29 08:40:46 UTC (rev 6739)
+++ stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/ServletResourceLoader.java 2008-04-29 09:51:21 UTC (rev 6741)
@@ -1,65 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.wsf.stack.metro;
-
-// $Id$
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Set;
-
-import javax.servlet.ServletContext;
-
-import com.sun.xml.ws.transport.http.ResourceLoader;
-
-/**
- * {@link ResourceLoader} backed by {@link ServletContext}.
- *
- * TDI: A copy of the original that is public
- *
- * @author WS Development Team
- * @author Thomas.Diesler at jboss.org
- */
-public class ServletResourceLoader implements ResourceLoader
-{
- private final ServletContext context;
-
- public ServletResourceLoader(ServletContext context)
- {
- this.context = context;
- }
-
- public URL getResource(String path) throws MalformedURLException
- {
- return context.getResource(path);
- }
-
- public URL getCatalogFile() throws MalformedURLException
- {
- return getResource("/WEB-INF/jax-ws-catalog.xml");
- }
-
- public Set<String> getResourcePaths(String path)
- {
- return context.getResourcePaths(path);
- }
-}
Deleted: stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/SunJaxwsDeploymentAspect.java
===================================================================
--- stack/metro/branches/tdiesler/trunk/modules/server/src/main/java/org/jboss/wsf/stack/metro/SunJaxwsDeploymentAspect.java 2008-04-29 08:40:46 UTC (rev 6739)
+++ stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/SunJaxwsDeploymentAspect.java 2008-04-29 09:51:21 UTC (rev 6741)
@@ -1,117 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.wsf.stack.metro;
-
-//$Id$
-
-import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.DeploymentAspect;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.WSFRuntime;
-import org.jboss.wsf.stack.metro.metadata.sunjaxws.DDEndpoint;
-import org.jboss.wsf.stack.metro.metadata.sunjaxws.DDEndpoints;
-import org.jboss.wsf.stack.metro.metadata.RuntimeModelDeploymentAspect;
-
-import javax.xml.ws.BindingType;
-import javax.xml.ws.soap.SOAPBinding;
-
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * An aspect that generates sun-jaxws.xml
- *
- * @author Thomas.Diesler at jboss.org
- * @since 10-May-2007
- */
-public class SunJaxwsDeploymentAspect extends DeploymentAspect
-{
- @Override
- @SuppressWarnings("unchecked")
- public void create(Deployment dep, WSFRuntime runtime)
- {
- DDEndpoints ddEndpoints = dep.getAttachment(DDEndpoints.class);
- if (ddEndpoints == null)
- {
- ddEndpoints = new DDEndpoints();
- for (Endpoint endpoint : dep.getService().getEndpoints())
- {
- String endpointName = endpoint.getShortName();
- String targetBean = endpoint.getTargetBeanName();
- String urlPattern = endpoint.getURLPattern();
-
- DDEndpoint ddEndpoint = new DDEndpoint(endpointName, targetBean, urlPattern);
- Class beanClass = endpoint.getTargetBeanClass();
- BindingType bindingType = (BindingType)beanClass.getAnnotation(BindingType.class);
-
- if (bindingType != null && bindingType.value().length() > 0)
- {
- String binding = bindingType.value();
- ddEndpoint.setBinding(binding);
- ddEndpoint.setEnableMTOM(isMtomEnabled(binding));
- }
-
- log.info("Add " + ddEndpoint);
- ddEndpoints.addEndpoint(ddEndpoint);
- }
-
- dep.addAttachment(DDEndpoints.class, ddEndpoints);
- putSunJaxwsConfigToDeployment(dep, ddEndpoints.createFileURL());
- }
- }
-
- @Override
- public void destroy(Deployment dep, WSFRuntime runtime)
- {
- DDEndpoints dd = dep.getAttachment(DDEndpoints.class);
- if (dd != null)
- {
- dd.destroyFileURL();
- }
- }
-
- /**
- * Puts SUN JAX-WS config file to deployment property <b>org.jboss.ws.webapp.ContextParameterMap</b> map
- * @param dep deployment where to put
- * @param dd beans to be put
- */
- private static void putSunJaxwsConfigToDeployment(Deployment dep, URL jaxwsConfigURL)
- {
- // get property map
- String propKey = "org.jboss.ws.webapp.ContextParameterMap";
- Map<String, String> contextParams = (Map<String, String>)dep.getProperty(propKey);
- if (contextParams == null)
- {
- // if there's no associated map with the property create it now
- contextParams = new HashMap<String, String>();
- dep.setProperty(propKey, contextParams);
- }
- // put sun jaxws config URL to the property map
- contextParams.put(RuntimeModelDeploymentAspect.PARAM_SUN_JAXWS_URL, jaxwsConfigURL.toExternalForm());
- }
-
- private static boolean isMtomEnabled(String binding)
- {
- return binding.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING) || binding.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING);
- }
-}
\ No newline at end of file
Deleted: stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/WebAppResolver.java
===================================================================
--- stack/metro/branches/tdiesler/trunk/modules/server/src/main/java/org/jboss/wsf/stack/metro/WebAppResolver.java 2008-04-29 08:40:46 UTC (rev 6739)
+++ stack/metro/branches/tdiesler/trunk/modules/client/src/main/java/org/jboss/wsf/stack/metro/WebAppResolver.java 2008-04-29 09:51:21 UTC (rev 6741)
@@ -1,69 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.wsf.stack.metro;
-
-import org.jboss.wsf.spi.management.EndpointResolver;
-import org.jboss.wsf.spi.deployment.Endpoint;
-
-import javax.management.ObjectName;
-import java.util.Iterator;
-
-/**
- * Resolves Endpoints by Servlet name and web context path.
- *
- * @author Heiko.Braun at jboss.com
- * Created: Jul 24, 2007
- */
-public class WebAppResolver implements EndpointResolver
-{
- private String contextPath;
- private String servletName;
-
- public WebAppResolver(String contextPath, String servletName)
- {
- this.contextPath = contextPath;
- this.servletName = servletName;
- }
-
- public Endpoint query(Iterator<Endpoint> endpoints)
- {
- Endpoint endpoint = null;
-
- if (contextPath.startsWith("/"))
- contextPath = contextPath.substring(1);
-
- while(endpoints.hasNext())
- {
- Endpoint auxEndpoint = endpoints.next();
- ObjectName sepId = auxEndpoint.getName();
- String propContext = sepId.getKeyProperty(Endpoint.SEPID_PROPERTY_CONTEXT);
- String propEndpoint = sepId.getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT);
- if (servletName.equals(propEndpoint) && contextPath.equals(propContext))
- {
- endpoint = auxEndpoint;
- break;
- }
- }
-
- return endpoint;
- }
-}
Modified: stack/metro/branches/tdiesler/trunk/modules/server/pom.xml
===================================================================
--- stack/metro/branches/tdiesler/trunk/modules/server/pom.xml 2008-04-29 08:42:23 UTC (rev 6740)
+++ stack/metro/branches/tdiesler/trunk/modules/server/pom.xml 2008-04-29 09:51:21 UTC (rev 6741)
@@ -51,12 +51,24 @@
</dependency>
<!-- Metro dependencies -->
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-tools</artifactId>
+ </dependency>
<!-- jboss provided -->
<dependency>
<groupId>jboss.common</groupId>
<artifactId>jboss-common</artifactId>
</dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </dependency>
<!-- transitve dependencies -->
<dependency>
Copied: stack/metro/branches/tdiesler/trunk/modules/server/src/main/resources (from rev 6734, stack/metro/branches/tdiesler/trunk/src/main/resources)
Copied: stack/metro/branches/tdiesler/trunk/modules/server/src/main/scripts (from rev 6729, stack/cxf/trunk/modules/server/src/main/scripts)
Modified: stack/metro/branches/tdiesler/trunk/pom.xml
===================================================================
--- stack/metro/branches/tdiesler/trunk/pom.xml 2008-04-29 08:42:23 UTC (rev 6740)
+++ stack/metro/branches/tdiesler/trunk/pom.xml 2008-04-29 09:51:21 UTC (rev 6741)
@@ -27,7 +27,7 @@
WS Stack Integration: | jbossws-native | | jbossws-metro | | jbossws-cxf | | |
+~~~~~~~~~~~~~~~~~+ +~~~~~~~~~~~~~~~~~+ +~~~~~~~~~~~~~~~~~+ | |
+~~~~~~~~~~~~~~~~~+ +~~~~~~~~~~~~~~~~~+ +~~~~~~~~~~~~~~~~~+ | |
- WS Stack: | jbossws-core | | Sun Metro | | Apache Metro | | |
+ WS Stack: | jbossws-core | | Sun Metro | | Apache CXF | | |
+~~~~~~~~~~~~~~~~~+ +~~~~~~~~~~~~~~~~~+ +~~~~~~~~~~~~~~~~~+ | |
WS-* Extensions: +~+ +~+ +~+ +~+ +~+ +~+ | |
| | | | | | | | | | | | | |
@@ -91,12 +91,12 @@
<version>1.0-SNAPSHOT</version>
</parent>
- <!-- Modules - ->
+ <!-- Modules -->
<modules>
<module>modules/management</module>
<module>modules/server</module>
<module>modules/client</module>
- </modules-->
+ </modules>
<!-- Properties -->
<properties>
@@ -223,6 +223,12 @@
<version>1.0-MR1</version>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
<!-- Metro dependencies -->
<dependency>
@@ -231,6 +237,12 @@
<version>${sun.jaxws.version}</version>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-tools</artifactId>
+ <version>${sun.jaxws.version}</version>
+ <scope>provided</scope>
+ </dependency>
<!-- jboss provided -->
<dependency>
More information about the jbossws-commits
mailing list