[jbossws-commits] JBossWS SVN: r3046 - projects/wsintegration/sunri-jboss50/trunk/src/main/java/org/jboss/ws/integration/jboss50/sunri.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Thu May 10 18:07:00 EDT 2007


Author: thomas.diesler at jboss.com
Date: 2007-05-10 18:06:59 -0400 (Thu, 10 May 2007)
New Revision: 3046

Added:
   projects/wsintegration/sunri-jboss50/trunk/src/main/java/org/jboss/ws/integration/jboss50/sunri/InvocationHandlerJSE.java
   projects/wsintegration/sunri-jboss50/trunk/src/main/java/org/jboss/ws/integration/jboss50/sunri/LifecycleHandlerImpl.java
   projects/wsintegration/sunri-jboss50/trunk/src/main/java/org/jboss/ws/integration/jboss50/sunri/RequestHandlerImpl.java
   projects/wsintegration/sunri-jboss50/trunk/src/main/java/org/jboss/ws/integration/jboss50/sunri/ServletResourceLoader.java
   projects/wsintegration/sunri-jboss50/trunk/src/main/java/org/jboss/ws/integration/jboss50/sunri/WSServletContextListener.java
Log:
Fisr JSE test passes

Added: projects/wsintegration/sunri-jboss50/trunk/src/main/java/org/jboss/ws/integration/jboss50/sunri/InvocationHandlerJSE.java
===================================================================
--- projects/wsintegration/sunri-jboss50/trunk/src/main/java/org/jboss/ws/integration/jboss50/sunri/InvocationHandlerJSE.java	                        (rev 0)
+++ projects/wsintegration/sunri-jboss50/trunk/src/main/java/org/jboss/ws/integration/jboss50/sunri/InvocationHandlerJSE.java	2007-05-10 22:06:59 UTC (rev 3046)
@@ -0,0 +1,56 @@
+/*
+ * 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.ws.integration.jboss50.sunri;
+
+// $Id$
+
+import org.jboss.logging.Logger;
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.invocation.InvocationContext;
+import org.jboss.ws.integration.invocation.InvocationHandler;
+
+/**
+ * Handles invocations on JSE endpoints.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 25-Apr-2007
+ */
+public class InvocationHandlerJSE implements InvocationHandler
+{
+   // provide logging
+   private static final Logger log = Logger.getLogger(InvocationHandlerJSE.class);
+
+   private Endpoint endpoint;
+
+   /** Initialize the service endpoint */
+   public void init(Endpoint endpoint)
+   {
+      this.endpoint = endpoint;
+   }
+
+   /** Invoke the the service endpoint */
+   public void invoke(InvocationContext reqContext) throws Exception
+   {
+      throw new NotImplementedException();
+   }
+}


Property changes on: projects/wsintegration/sunri-jboss50/trunk/src/main/java/org/jboss/ws/integration/jboss50/sunri/InvocationHandlerJSE.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/wsintegration/sunri-jboss50/trunk/src/main/java/org/jboss/ws/integration/jboss50/sunri/LifecycleHandlerImpl.java
===================================================================
--- projects/wsintegration/sunri-jboss50/trunk/src/main/java/org/jboss/ws/integration/jboss50/sunri/LifecycleHandlerImpl.java	                        (rev 0)
+++ projects/wsintegration/sunri-jboss50/trunk/src/main/java/org/jboss/ws/integration/jboss50/sunri/LifecycleHandlerImpl.java	2007-05-10 22:06:59 UTC (rev 3046)
@@ -0,0 +1,48 @@
+/*
+ * 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.ws.integration.jboss50.sunri;
+
+//$Id$
+
+import org.jboss.ws.integration.BasicLifecycleHandler;
+import org.jboss.ws.integration.Endpoint;
+
+/**
+ * A lifecycle handler
+ * 
+ * @author Thomas.Diesler at jboss.org
+ * @since 25-Apr-2007
+ */
+public class LifecycleHandlerImpl extends BasicLifecycleHandler
+{
+   public void start(Endpoint ep)
+   {
+      super.start(ep);
+      log.info("WebService started: " + ep.getName());
+   }
+
+   public void stop(Endpoint ep)
+   {
+      super.stop(ep);
+      log.info("WebService stoped: " + ep.getName());
+   }
+}


Property changes on: projects/wsintegration/sunri-jboss50/trunk/src/main/java/org/jboss/ws/integration/jboss50/sunri/LifecycleHandlerImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/wsintegration/sunri-jboss50/trunk/src/main/java/org/jboss/ws/integration/jboss50/sunri/RequestHandlerImpl.java
===================================================================
--- projects/wsintegration/sunri-jboss50/trunk/src/main/java/org/jboss/ws/integration/jboss50/sunri/RequestHandlerImpl.java	                        (rev 0)
+++ projects/wsintegration/sunri-jboss50/trunk/src/main/java/org/jboss/ws/integration/jboss50/sunri/RequestHandlerImpl.java	2007-05-10 22:06:59 UTC (rev 3046)
@@ -0,0 +1,57 @@
+/*
+ * 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.ws.integration.jboss50.sunri;
+
+//$Id$
+
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.jboss.logging.Logger;
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.RequestHandler;
+import org.jboss.ws.integration.invocation.InvocationContext;
+
+/**
+ * A request handler
+ * 
+ * @author Thomas.Diesler at jboss.org
+ * @since 25-Apr-2007
+ */
+public class RequestHandlerImpl implements RequestHandler
+{
+   // provide logging
+   private static final Logger log = Logger.getLogger(RequestHandlerImpl.class);
+
+   public void handleRequest(Endpoint endpoint, InputStream inputStream, OutputStream outputStream, InvocationContext context)
+   {
+      log.debug("handleRequest: " + endpoint.getName());
+      throw new NotImplementedException();
+   }
+
+   public void handleWSDLRequest(Endpoint endpoint, OutputStream outputStream, InvocationContext context)
+   {
+      log.debug("handleWSDLRequest: " + endpoint.getName());
+      throw new NotImplementedException();
+   }
+}


Property changes on: projects/wsintegration/sunri-jboss50/trunk/src/main/java/org/jboss/ws/integration/jboss50/sunri/RequestHandlerImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/wsintegration/sunri-jboss50/trunk/src/main/java/org/jboss/ws/integration/jboss50/sunri/ServletResourceLoader.java
===================================================================
--- projects/wsintegration/sunri-jboss50/trunk/src/main/java/org/jboss/ws/integration/jboss50/sunri/ServletResourceLoader.java	                        (rev 0)
+++ projects/wsintegration/sunri-jboss50/trunk/src/main/java/org/jboss/ws/integration/jboss50/sunri/ServletResourceLoader.java	2007-05-10 22:06:59 UTC (rev 3046)
@@ -0,0 +1,67 @@
+/*
+ * 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.ws.integration.jboss50.sunri;
+
+// $Id$
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Set;
+
+import javax.servlet.ServletContext;
+
+import com.sun.xml.ws.transport.http.HttpAdapter;
+import com.sun.xml.ws.transport.http.ResourceLoader;
+
+/**
+ * Parses {@code sun-jaxws.xml} and sets up
+ * {@link HttpAdapter}s for all deployed endpoints.
+ *
+ * <p>
+ * This code is the entry point at the server side.
+ *
+ * @author WS Development Team
+ */
+final 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);
+   }
+}


Property changes on: projects/wsintegration/sunri-jboss50/trunk/src/main/java/org/jboss/ws/integration/jboss50/sunri/ServletResourceLoader.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/wsintegration/sunri-jboss50/trunk/src/main/java/org/jboss/ws/integration/jboss50/sunri/WSServletContextListener.java
===================================================================
--- projects/wsintegration/sunri-jboss50/trunk/src/main/java/org/jboss/ws/integration/jboss50/sunri/WSServletContextListener.java	                        (rev 0)
+++ projects/wsintegration/sunri-jboss50/trunk/src/main/java/org/jboss/ws/integration/jboss50/sunri/WSServletContextListener.java	2007-05-10 22:06:59 UTC (rev 3046)
@@ -0,0 +1,180 @@
+/*
+ * 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.ws.integration.jboss50.sunri;
+
+// $Id$
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextAttributeEvent;
+import javax.servlet.ServletContextAttributeListener;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import javax.xml.ws.WebServiceException;
+
+import com.sun.istack.NotNull;
+import com.sun.xml.ws.api.server.BoundEndpoint;
+import com.sun.xml.ws.api.server.Container;
+import com.sun.xml.ws.api.server.Module;
+import com.sun.xml.ws.resources.WsservletMessages;
+import com.sun.xml.ws.transport.http.DeploymentDescriptorParser;
+import com.sun.xml.ws.transport.http.HttpAdapter;
+import com.sun.xml.ws.transport.http.servlet.ServletAdapter;
+import com.sun.xml.ws.transport.http.servlet.ServletAdapterList;
+import com.sun.xml.ws.transport.http.servlet.WSServlet;
+import com.sun.xml.ws.transport.http.servlet.WSServletDelegate;
+
+/**
+ * Parses {@code sun-jaxws.xml} and sets up
+ * {@link HttpAdapter}s for all deployed endpoints.
+ *
+ * <p>
+ * This code is the entry point at the server side.
+ *
+ * @author WS Development Team
+ * @author Thomas.Diesler at jboss.org
+ * @since 10-May-2007
+ */
+public class WSServletContextListener implements ServletContextAttributeListener, ServletContextListener
+{
+   public static final String SUN_JAXWS_URL = "sun-jaxws-url";
+
+   private WSServletDelegate delegate;
+
+   public void attributeAdded(ServletContextAttributeEvent event)
+   {
+   }
+
+   public void attributeRemoved(ServletContextAttributeEvent event)
+   {
+   }
+
+   public void attributeReplaced(ServletContextAttributeEvent event)
+   {
+   }
+
+   public void contextDestroyed(ServletContextEvent event)
+   {
+      if (delegate != null)
+      { // the deployment might have failed.
+         delegate.destroy();
+      }
+
+      if (logger.isLoggable(Level.INFO))
+      {
+         logger.info(WsservletMessages.LISTENER_INFO_DESTROY());
+      }
+   }
+
+   public void contextInitialized(ServletContextEvent event)
+   {
+      if (logger.isLoggable(Level.INFO))
+      {
+         logger.info(WsservletMessages.LISTENER_INFO_INITIALIZE());
+      }
+      ServletContext context = event.getServletContext();
+      ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+      if (classLoader == null)
+      {
+         classLoader = getClass().getClassLoader();
+      }
+
+      ServletContainer container = new ServletContainer(context);
+      try
+      {
+         ServletResourceLoader resourceLoader = new ServletResourceLoader(context);
+         ServletAdapterList adapterList = new ServletAdapterList();
+         // Parse the descriptor file and build endpoint infos
+         DeploymentDescriptorParser<ServletAdapter> parser = new DeploymentDescriptorParser<ServletAdapter>(classLoader, resourceLoader, container, adapterList);
+
+         URL sunJaxWsXml = context.getResource(JAXWS_RI_RUNTIME);
+         if (sunJaxWsXml == null)
+         {
+            String urlStr = context.getInitParameter(SUN_JAXWS_URL);
+            if (urlStr != null && urlStr.length() > 0)
+               sunJaxWsXml = new URL(urlStr);
+         }
+         if (sunJaxWsXml == null)
+            throw new WebServiceException(WsservletMessages.NO_SUNJAXWS_XML(JAXWS_RI_RUNTIME));
+
+         List<ServletAdapter> adapters = parser.parse(sunJaxWsXml.toExternalForm(), sunJaxWsXml.openStream());
+
+         delegate = new WSServletDelegate(adapters, context);
+
+         context.setAttribute(WSServlet.JAXWS_RI_RUNTIME_INFO, delegate);
+
+      }
+      catch (Throwable e)
+      {
+         logger.log(Level.SEVERE, WsservletMessages.LISTENER_PARSING_FAILED(e), e);
+         context.removeAttribute(WSServlet.JAXWS_RI_RUNTIME_INFO);
+         throw new WebServiceException("listener.parsingFailed", e);
+      }
+   }
+
+   /**
+    * Provides access to {@link ServletContext} via {@link Container}. Pipes
+    * can get ServletContext from Container and use it to load some resources. 
+    */
+   private static class ServletContainer extends Container
+   {
+      private final ServletContext servletContext;
+
+      private final Module module = new Module()
+      {
+         private final List<BoundEndpoint> endpoints = new ArrayList<BoundEndpoint>();
+
+         public @NotNull
+         List<BoundEndpoint> getBoundEndpoints()
+         {
+            return endpoints;
+         }
+      };
+
+      ServletContainer(ServletContext servletContext)
+      {
+         this.servletContext = servletContext;
+      }
+
+      public <T> T getSPI(Class<T> spiType)
+      {
+         if (spiType == ServletContext.class)
+         {
+            return (T)servletContext;
+         }
+         if (spiType == Module.class)
+         {
+            return spiType.cast(module);
+         }
+         return null;
+      }
+   }
+
+   private static final String JAXWS_RI_RUNTIME = "/WEB-INF/sun-jaxws.xml";
+
+   private static final Logger logger = Logger.getLogger(com.sun.xml.ws.util.Constants.LoggingDomain + ".server.http");
+}


Property changes on: projects/wsintegration/sunri-jboss50/trunk/src/main/java/org/jboss/ws/integration/jboss50/sunri/WSServletContextListener.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF




More information about the jbossws-commits mailing list