Author: tho...@jb... Date: 2006-07-10 13:12:51 -0400 (Mon, 10 Jul 2006) New Revision: 586 Added: trunk/src/main/java/org/jboss/ws/integration/jboss/JBossHttpServer.java Modified: trunk/src/main/java/javax/xml/ws/spi/Provider.java trunk/src/main/java/org/jboss/ws/jaxws/spi/ProviderImpl.java trunk/src/main/java/org/jboss/ws/server/HttpServer.java trunk/src/main/java/org/jboss/ws/tools/wspublish.java trunk/src/test/build.xml trunk/src/test/java/org/jboss/test/ws/JBossTestDeployer.java trunk/src/test/java/org/jboss/test/ws/JBossWSTestDeployer.java trunk/src/test/java/org/jboss/test/ws/TomcatTestDeployer.java Log: More work on Endpoint API Modified: trunk/src/main/java/javax/xml/ws/spi/Provider.java =================================================================== --- trunk/src/main/java/javax/xml/ws/spi/Provider.java 2006-07-07 17:12:40 UTC (rev 585) +++ trunk/src/main/java/javax/xml/ws/spi/Provider.java 2006-07-10 17:12:51 UTC (rev 586) @@ -69,7 +69,19 @@ public abstract ServiceDelegate createServiceDelegate(URL url, QName qname, Class class1); + /** + * Creates an endpoint object with the provided binding and implementation object. + * + * @param bindingId A URI specifying the desired binding (e.g. SOAP/HTTP) + * @param implementor A service implementation object to which incoming requests will be dispatched. + * The corresponding class must be annotated with all the necessary Web service annotations. + */ public abstract Endpoint createEndpoint(String bindingId, Object implementor); + /** + * Creates and publishes an endpoint object with the specified address and implementation object. + * @param bindingId A URI specifying the address and transport/protocol to use. A http: URI must result in the SOAP 1.1/HTTP binding being used. Implementations may support other URI schemes. + * @param implementor A service implementation object to which incoming requests will be dispatched. The corresponding class must be annotated with all the necessary Web service annotations. + */ public abstract Endpoint createAndPublishEndpoint(String bindingId, Object implementor); } \ No newline at end of file Added: trunk/src/main/java/org/jboss/ws/integration/jboss/JBossHttpServer.java =================================================================== --- trunk/src/main/java/org/jboss/ws/integration/jboss/JBossHttpServer.java 2006-07-07 17:12:40 UTC (rev 585) +++ trunk/src/main/java/org/jboss/ws/integration/jboss/JBossHttpServer.java 2006-07-10 17:12:51 UTC (rev 586) @@ -0,0 +1,84 @@ +/* + * 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.jboss; + +//$Id$ + +import javax.management.MBeanServerConnection; +import javax.naming.InitialContext; +import javax.naming.NamingException; +import javax.xml.ws.Endpoint; + +import org.jboss.ws.WSException; +import org.jboss.ws.server.HttpServer; + +/** + * A Tomcat HTTP Server + * + * @author Tho...@jb... + * @since 07-Jul-2006 + */ +public class JBossHttpServer extends HttpServer +{ + private static final String MAIN_DEPLOYER = "jboss.system:service=MainDeployer"; + + /** Start an instance of this HTTP server */ + @Override + public void start() + { + // verify required properties + } + + /** Publish an JAXWS endpoint to the HTTP server */ + @Override + public void publish(Endpoint endpoint) + { + try + { + MBeanServerConnection server = getServer(); + //server.invoke(new ObjectName(MAIN_DEPLOYER), "deploy", new Object[] { url }, new String[] { "java.net.URL" }); + } + catch (RuntimeException rte) + { + throw rte; + } + catch (Exception ex) + { + throw new WSException(ex); + } + } + + @Override + public void destroy(Endpoint endpoint) + { + // TODO Auto-generated method stub + + } + + private MBeanServerConnection getServer() throws NamingException + { + InitialContext iniCtx = new InitialContext(); + MBeanServerConnection server = (MBeanServerConnection)iniCtx.lookup("jmx/invoker/RMIAdaptor"); + return server; + } + +} Property changes on: trunk/src/main/java/org/jboss/ws/integration/jboss/JBossHttpServer.java ___________________________________________________________________ Name: svn:keywords + Id Revision Name: svn:eol-style + LF Modified: trunk/src/main/java/org/jboss/ws/jaxws/spi/ProviderImpl.java =================================================================== --- trunk/src/main/java/org/jboss/ws/jaxws/spi/ProviderImpl.java 2006-07-07 17:12:40 UTC (rev 585) +++ trunk/src/main/java/org/jboss/ws/jaxws/spi/ProviderImpl.java 2006-07-10 17:12:51 UTC (rev 586) @@ -58,7 +58,7 @@ public Endpoint createAndPublishEndpoint(String bindingId, Object implementor) { EndpointImpl endpoint = new EndpointImpl(bindingId, implementor); - HttpServer server = HttpServer.create(null); + HttpServer server = HttpServer.create(); server.publish(endpoint); return endpoint; } Modified: trunk/src/main/java/org/jboss/ws/server/HttpServer.java =================================================================== --- trunk/src/main/java/org/jboss/ws/server/HttpServer.java 2006-07-07 17:12:40 UTC (rev 585) +++ trunk/src/main/java/org/jboss/ws/server/HttpServer.java 2006-07-10 17:12:51 UTC (rev 586) @@ -43,7 +43,7 @@ public static String HTTP_SERVER_PROPERTY = HttpServer.class.getName(); public static String DEFAULT_HTTP_SERVER_PROPERTY = TomcatHttpServer.class.getName(); - private Map<String, Object> properties; + private Map<String, Object> properties = new HashMap<String, Object>(); // Hide constructor protected HttpServer () @@ -78,4 +78,14 @@ { properties = map; } + + public void setProperty(String key, Object value) + { + properties.put(key, value); + } + + public Object getProperty(String key) + { + return properties.get(key); + } } Modified: trunk/src/main/java/org/jboss/ws/tools/wspublish.java =================================================================== --- trunk/src/main/java/org/jboss/ws/tools/wspublish.java 2006-07-07 17:12:40 UTC (rev 585) +++ trunk/src/main/java/org/jboss/ws/tools/wspublish.java 2006-07-10 17:12:51 UTC (rev 586) @@ -34,6 +34,7 @@ import org.jboss.util.file.JarUtils; import org.jboss.ws.deployment.ServiceEndpointPublisher; import org.jboss.ws.integration.tomcat.GenericServiceEndpointPublisher; +import org.jboss.ws.integration.tomcat.GenericServiceEndpointServlet; /** * Publish a standard portable J2EE web service endpoint @@ -47,7 +48,7 @@ // provide logging protected final Logger log = Logger.getLogger(wspublish.class); - public static final String DEFAULT_TOMCAT_SERVICE_ENDPOINT_SERVLET = "org.jboss.ws.integration.other.GenericServiceEndpointServlet"; + public static final String DEFAULT_TOMCAT_SERVICE_ENDPOINT_SERVLET = GenericServiceEndpointServlet.class.getName(); public URL process(URL warURL, File destDir, String servletName) throws IOException { Modified: trunk/src/test/build.xml =================================================================== --- trunk/src/test/build.xml 2006-07-07 17:12:40 UTC (rev 585) +++ trunk/src/test/build.xml 2006-07-10 17:12:51 UTC (rev 586) @@ -141,6 +141,8 @@ <pathelement location="${jboss.server.lib}/jboss.jar"/> <pathelement location="${jboss.server.deploy}/ejb3.deployer/jboss-annotations-ejb3.jar"/> <pathelement location="${jboss.server.deploy}/ejb3.deployer/jboss-ejb3x.jar"/> + <pathelement location="${build.lib.dir}/jbossws-jboss-integration.jar"/> + <pathelement location="${build.lib.dir}/jbossws-tomcat-integration.jar"/> </path> <!-- The test client classpath --> @@ -149,6 +151,7 @@ <pathelement location="${thirdparty.dir}/jaxb-impl.jar"/> <path refid="library.classpath"/> <path refid="jbossws.client.classpath"/> + <pathelement location="${build.lib.dir}/jbossws-jboss-integration.jar"/> <pathelement location="${build.lib.dir}/jbossws-tomcat-integration.jar"/> <pathelement location="${jboss.client}/jboss-aop-jdk50-client.jar"/> <pathelement location="${jboss.lib}/jboss-system.jar"/> Modified: trunk/src/test/java/org/jboss/test/ws/JBossTestDeployer.java =================================================================== --- trunk/src/test/java/org/jboss/test/ws/JBossTestDeployer.java 2006-07-07 17:12:40 UTC (rev 585) +++ trunk/src/test/java/org/jboss/test/ws/JBossTestDeployer.java 2006-07-10 17:12:51 UTC (rev 586) @@ -27,7 +27,13 @@ import javax.management.ObjectName; import javax.naming.InitialContext; import javax.naming.NamingException; +import javax.xml.ws.Endpoint; +import javax.xml.ws.spi.Provider; +import org.jboss.util.NotImplementedException; +import org.jboss.ws.integration.jboss.JBossHttpServer; +import org.jboss.ws.server.HttpServer; + /** * A JBossWS test helper that deals with test deployment/undeployment, etc. * @@ -56,4 +62,20 @@ MBeanServerConnection server = (MBeanServerConnection)iniCtx.lookup("jmx/invoker/RMIAdaptor"); return server; } + + public Endpoint deployEndpoint(Class endpointImpl) throws Exception + { + Provider provider = Provider.provider(); + + Endpoint endpoint = provider.createEndpoint(null, endpointImpl); + HttpServer httpServer = new JBossHttpServer(); + httpServer.start(); + httpServer.publish(endpoint); + return endpoint; + } + + public void undeployEndpoint(Endpoint endpoint) throws Exception + { + endpoint.stop(); + } } Modified: trunk/src/test/java/org/jboss/test/ws/JBossWSTestDeployer.java =================================================================== --- trunk/src/test/java/org/jboss/test/ws/JBossWSTestDeployer.java 2006-07-07 17:12:40 UTC (rev 585) +++ trunk/src/test/java/org/jboss/test/ws/JBossWSTestDeployer.java 2006-07-10 17:12:51 UTC (rev 586) @@ -23,8 +23,10 @@ import java.net.URL; +import javax.xml.ws.Endpoint; + /** - * Server deployer + * WS test deployer * * @author Tho...@jb... * @since 16-May-2006 @@ -38,4 +40,12 @@ /** Undeploy the given archive */ void undeploy(URL archive) throws Exception; + + /** Deploy the given endpoint + */ + Endpoint deployEndpoint(Class endpointImpl) throws Exception; + + /** Undeploy the given endpoint + */ + void undeployEndpoint(Endpoint endpoint) throws Exception; } \ No newline at end of file Modified: trunk/src/test/java/org/jboss/test/ws/TomcatTestDeployer.java =================================================================== --- trunk/src/test/java/org/jboss/test/ws/TomcatTestDeployer.java 2006-07-07 17:12:40 UTC (rev 585) +++ trunk/src/test/java/org/jboss/test/ws/TomcatTestDeployer.java 2006-07-10 17:12:51 UTC (rev 586) @@ -32,7 +32,12 @@ import java.util.HashMap; import java.util.Map; +import javax.xml.ws.Endpoint; +import javax.xml.ws.spi.Provider; + import org.jboss.util.Base64; +import org.jboss.ws.integration.tomcat.TomcatHttpServer; +import org.jboss.ws.server.HttpServer; import org.jboss.ws.tools.wspublish; /** @@ -105,6 +110,22 @@ } } + + public Endpoint deployEndpoint(Class endpointImpl) throws Exception + { + Provider provider = Provider.provider(); + Endpoint endpoint = provider.createEndpoint(null, endpointImpl); + HttpServer httpServer = new TomcatHttpServer(); + httpServer.start(); + httpServer.publish(endpoint); + return endpoint; + } + + public void undeployEndpoint(Endpoint endpoint) throws Exception + { + endpoint.stop(); + } + private String getManagerPath() throws MalformedURLException { String hostName = System.getProperty("jbosstest.server.host", "localhost"); |