|
From: <jbo...@li...> - 2006-07-07 17:12:49
|
Author: tho...@jb...
Date: 2006-07-07 13:12:40 -0400 (Fri, 07 Jul 2006)
New Revision: 585
Modified:
trunk/.classpath
trunk/src/main/java/javax/xml/ws/Endpoint.java
trunk/src/main/java/org/jboss/ws/jaxws/spi/EndpointImpl.java
trunk/src/main/java/org/jboss/ws/server/HttpServer.java
Log:
Endpoint API
Modified: trunk/.classpath
===================================================================
--- trunk/.classpath 2006-07-07 16:08:23 UTC (rev 584)
+++ trunk/.classpath 2006-07-07 17:12:40 UTC (rev 585)
@@ -1,28 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src/main/java"/>
- <classpathentry excluding="org/jboss/test/ws/interop/" kind="src" path="src/test/java"/>
- <classpathentry kind="lib" path="thirdparty/activation.jar"/>
- <classpathentry sourcepath="D:/cvs/JBossRemoting/src/main" kind="lib" path="thirdparty/jboss-remoting.jar"/>
- <classpathentry kind="lib" path="thirdparty/mailapi.jar"/>
- <classpathentry kind="lib" path="thirdparty/qdox.jar"/>
- <classpathentry kind="lib" path="thirdparty/servlet-api.jar"/>
- <classpathentry kind="lib" path="thirdparty/wsdl4j.jar"/>
- <classpathentry kind="lib" path="thirdparty/xercesImpl.jar"/>
- <classpathentry kind="lib" path="thirdparty/xml-apis.jar"/>
- <classpathentry kind="lib" path="thirdparty/xmlsec.jar"/>
- <classpathentry kind="lib" path="thirdparty/xmlunit1.0.jar"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/ant-1.6.5"/>
- <classpathentry kind="lib" path="thirdparty/xalan.jar"/>
- <classpathentry kind="lib" path="thirdparty/junit.jar"/>
- <classpathentry kind="lib" path="thirdparty/concurrent.jar"/>
- <classpathentry kind="lib" path="thirdparty/javassist.jar"/>
- <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/jboss-5.0.x"/>
- <classpathentry kind="lib" path="thirdparty/jboss-xml-binding.jar"/>
- <classpathentry kind="lib" path="thirdparty/policy-1.0.jar"/>
- <classpathentry kind="lib" path="thirdparty/stax-api-1.0.jar"/>
- <classpathentry kind="lib" path="thirdparty/wstx-lgpl-2.0.6.jar"/>
- <classpathentry kind="lib" path="thirdparty/jaxb-api.jar"/>
- <classpathentry kind="output" path="output-eclipse"/>
+ <classpathentry path="src/main/java" kind="src"/>
+ <classpathentry excluding="org/jboss/test/ws/interop/" path="src/test/java" kind="src"/>
+ <classpathentry path="thirdparty/activation.jar" kind="lib"/>
+ <classpathentry sourcepath="D:/cvs/JBossRemoting/src/main" path="thirdparty/jboss-remoting.jar" kind="lib"/>
+ <classpathentry path="thirdparty/mailapi.jar" kind="lib"/>
+ <classpathentry path="thirdparty/qdox.jar" kind="lib"/>
+ <classpathentry path="thirdparty/servlet-api.jar" kind="lib"/>
+ <classpathentry path="thirdparty/wsdl4j.jar" kind="lib"/>
+ <classpathentry path="thirdparty/xercesImpl.jar" kind="lib"/>
+ <classpathentry path="thirdparty/xml-apis.jar" kind="lib"/>
+ <classpathentry path="thirdparty/xmlsec.jar" kind="lib"/>
+ <classpathentry path="thirdparty/xmlunit1.0.jar" kind="lib"/>
+ <classpathentry path="org.eclipse.jdt.launching.JRE_CONTAINER" kind="con"/>
+ <classpathentry path="thirdparty/xalan.jar" kind="lib"/>
+ <classpathentry path="thirdparty/junit.jar" kind="lib"/>
+ <classpathentry path="thirdparty/concurrent.jar" kind="lib"/>
+ <classpathentry path="thirdparty/javassist.jar" kind="lib"/>
+ <classpathentry path="org.eclipse.jdt.USER_LIBRARY/jboss-5.0.x" kind="con"/>
+ <classpathentry path="thirdparty/jboss-xml-binding.jar" kind="lib"/>
+ <classpathentry path="thirdparty/policy-1.0.jar" kind="lib"/>
+ <classpathentry path="thirdparty/stax-api-1.0.jar" kind="lib"/>
+ <classpathentry path="thirdparty/wstx-lgpl-2.0.6.jar" kind="lib"/>
+ <classpathentry path="thirdparty/jaxb-api.jar" kind="lib"/>
+ <classpathentry path="thirdparty/ant.jar" kind="lib"/>
+ <classpathentry path="output-eclipse" kind="output"/>
</classpath>
Modified: trunk/src/main/java/javax/xml/ws/Endpoint.java
===================================================================
--- trunk/src/main/java/javax/xml/ws/Endpoint.java 2006-07-07 16:08:23 UTC (rev 584)
+++ trunk/src/main/java/javax/xml/ws/Endpoint.java 2006-07-07 17:12:40 UTC (rev 585)
@@ -66,43 +66,91 @@
{
}
+ /**
+ * Creates an endpoint with the specified implementor object. If there is a binding specified via a BindingType annotation then it
+ * MUST be used else a default of SOAP 1.1 / HTTP binding MUST be used.
+ *
+ * The newly created endpoint may be published by calling one of the javax.xml.ws.Endpoint#publish(String)
+ * and javax.xml.ws.Endpoint#publish(Object) methods.
+ */
public static Endpoint create(Object implementor)
{
return create(null, implementor);
}
+ /**
+ * Creates an endpoint with the specified binding type and implementor object.
+ *
+ * The newly created endpoint may be published by calling one of the javax.xml.ws.Endpoint#publish(String)
+ * and javax.xml.ws.Endpoint#publish(Object) methods.
+ */
public static Endpoint create(String bindingId, Object implementor)
{
return Provider.provider().createEndpoint(bindingId, implementor);
}
+ /** Returns the binding for this endpoint. */
public abstract Binding getBinding();
+ /** Returns the implementation object for this endpoint. */
public abstract Object getImplementor();
- public abstract void publish(String s);
+ /**
+ * Publishes this endpoint at the given address. The necessary server infrastructure will be created and configured by the JAX-WS
+ * implementation using some default configuration. In order to get more control over the server configuration,
+ * please use the javax.xml.ws.Endpoint#publish(Object) method instead.
+ *
+ * @param A URI specifying the address to use. The address must be compatible with the binding specified at the time the endpoint was created.
+ */
+ public abstract void publish(String address);
+ /**
+ * Creates and publishes an endpoint for the specified implementor object at the given address.
+ *
+ * The necessary server infrastructure will be created and configured by the JAX-WS implementation using some default configuration.
+ * In order to get more control over the server configuration, please use the javax.xml.ws.Endpoint#create(String,Object)
+ * and javax.xml.ws.Endpoint#publish(Object) method instead.
+ */
public static Endpoint publish(String address, Object implementor)
{
return Provider.provider().createAndPublishEndpoint(address, implementor);
}
- public abstract void publish(Object obj);
+ /**
+ * Publishes this endpoint at the provided server context.
+ * A server context encapsulates the server infrastructure and addressing information for a particular transport.
+ * For a call to this method to succeed, the server context passed as an argument to it must be compatible with the endpoint's binding.
+ *
+ * @param serverContext An object representing a server context to be used for publishing the endpoint.
+ */
+ public abstract void publish(Object serverContext);
+ /** Stops publishing this endpoint. If the endpoint is not in a published state, this method has not effect. */
public abstract void stop();
+ /** Returns true if the endpoint has been published. */
public abstract boolean isPublished();
+ /** Returns a list of metadata documents for the service. */
public abstract List<Source> getMetadata();
+ /** Sets the metadata for this endpoint. */
public abstract void setMetadata(List<Source> list);
+ /** Returns the executor for this Endpointinstance. The executor is used to dispatch an incoming request to the implementor object. */
public abstract Executor getExecutor();
+ /**
+ * Sets the executor for this Endpoint instance. The executor is used to dispatch an incoming request to the implementor object.
+ * If this Endpoint is published using the publish(Object) method and the specified server context defines its own threading behavior,
+ * the executor may be ignored.
+ */
public abstract void setExecutor(Executor executor);
+ /** Returns the property bag for this Endpoint instance. */
public abstract Map<String, Object> getProperties();
+ /** Sets the property bag for this Endpoint instance. */
public abstract void setProperties(Map<String, Object> map);
}
\ No newline at end of file
Modified: trunk/src/main/java/org/jboss/ws/jaxws/spi/EndpointImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxws/spi/EndpointImpl.java 2006-07-07 16:08:23 UTC (rev 584)
+++ trunk/src/main/java/org/jboss/ws/jaxws/spi/EndpointImpl.java 2006-07-07 17:12:40 UTC (rev 585)
@@ -23,113 +23,141 @@
// $Id$
-import java.net.URL;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executor;
-import javax.xml.namespace.QName;
import javax.xml.transform.Source;
import javax.xml.ws.Binding;
import javax.xml.ws.Endpoint;
-import javax.xml.ws.spi.Provider;
-import javax.xml.ws.spi.ServiceDelegate;
import org.jboss.util.NotImplementedException;
+import org.jboss.ws.jaxws.client.BindingImpl;
+import org.jboss.ws.server.HttpServer;
/**
- * Service provider for ServiceDelegate and Endpoint objects.
+ * A Web service endpoint implementation.
*
* @author Tho...@jb...
- * @since 03-May-2006
+ * @since 07-Jul-2006
*/
public class EndpointImpl extends Endpoint
{
+ private Object implementor;
+ private Binding binding = new BindingImpl();
+ private Map<String, Object> properties;
+ private HttpServer httpServer;
+ private boolean isPublished;
+ private boolean isDestroyed;
+
public EndpointImpl(String bindingId, Object implementor)
{
+ this.implementor = implementor;
}
@Override
public Binding getBinding()
{
- // TODO Auto-generated method stub
- return null;
+ return binding;
}
@Override
public Object getImplementor()
{
- // TODO Auto-generated method stub
- return null;
+ return implementor;
}
+ /**
+ * Publishes this endpoint at the given address. The necessary server infrastructure will be created and configured by the JAX-WS
+ * implementation using some default configuration. In order to get more control over the server configuration,
+ * please use the javax.xml.ws.Endpoint#publish(Object) method instead.
+ *
+ * @param A URI specifying the address to use. The address must be compatible with the binding specified at the time the endpoint was created.
+ */
@Override
- public void publish(String s)
+ public void publish(String address)
{
- // TODO Auto-generated method stub
+ if (isDestroyed)
+ throw new IllegalStateException("Endpoint already destroyed");
+ httpServer = HttpServer.create();
+ httpServer.setProperties(properties);
+ httpServer.start();
+ httpServer.publish(this);
+ isPublished = true;
}
+ /**
+ * Publishes this endpoint at the provided server context.
+ * A server context encapsulates the server infrastructure and addressing information for a particular transport.
+ * For a call to this method to succeed, the server context passed as an argument to it must be compatible with the endpoint's binding.
+ *
+ * @param serverContext An object representing a server context to be used for publishing the endpoint.
+ */
@Override
- public void publish(Object obj)
+ public void publish(Object serverContext)
{
- // TODO Auto-generated method stub
+ if (isDestroyed)
+ throw new IllegalStateException("Endpoint already destroyed");
+ if (serverContext instanceof HttpServer)
+ {
+ httpServer = (HttpServer)serverContext;
+ httpServer.publish(this);
+ isPublished = true;
+ }
}
@Override
public void stop()
{
- // TODO Auto-generated method stub
+ if (httpServer == null || isPublished == false)
+ throw new IllegalStateException("Endpoint not published");
+ httpServer.destroy(this);
+ isPublished = false;
+ isDestroyed = true;
}
@Override
public boolean isPublished()
{
- // TODO Auto-generated method stub
- return false;
+ return isPublished;
}
@Override
public List<Source> getMetadata()
{
- // TODO Auto-generated method stub
- return null;
+ throw new NotImplementedException();
}
@Override
public void setMetadata(List<Source> list)
{
- // TODO Auto-generated method stub
-
+ throw new NotImplementedException();
}
@Override
public Executor getExecutor()
{
- // TODO Auto-generated method stub
- return null;
+ throw new NotImplementedException();
}
@Override
public void setExecutor(Executor executor)
{
- // TODO Auto-generated method stub
-
+ throw new NotImplementedException();
}
@Override
public Map<String, Object> getProperties()
{
- // TODO Auto-generated method stub
- return null;
+ return properties;
}
@Override
public void setProperties(Map<String, Object> map)
{
- // TODO Auto-generated method stub
-
+ properties = map;
}
}
\ No newline at end of file
Modified: trunk/src/main/java/org/jboss/ws/server/HttpServer.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/server/HttpServer.java 2006-07-07 16:08:23 UTC (rev 584)
+++ trunk/src/main/java/org/jboss/ws/server/HttpServer.java 2006-07-07 17:12:40 UTC (rev 585)
@@ -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 = new HashMap<String, Object>();
+ private Map<String, Object> properties;
// Hide constructor
protected HttpServer ()
@@ -54,14 +54,9 @@
* Create an instance of an HTTP server.
* The discovery algorithm is described in {@link FactoryFinder.find(String,String)}
*/
- public static HttpServer create(Map<String, Object> props)
+ public static HttpServer create()
{
HttpServer server = (HttpServer)FactoryFinder.find(HTTP_SERVER_PROPERTY, DEFAULT_HTTP_SERVER_PROPERTY);
- if (props != null)
- {
- for (String key : props.keySet())
- server.setProperty(key, props.get(key));
- }
return server;
}
@@ -71,24 +66,16 @@
/** Publish an JAXWS endpoint to the HTTP server */
public abstract void publish(Endpoint endpoint);
- public void setProperty(String key, Object value)
+ /** Removes an JAXWS endpoint from the HTTP server */
+ public abstract void destroy(Endpoint endpoint);
+
+ public Map<String, Object> getProperties()
{
- properties.put(key, value);
+ return properties;
}
- public Object getProperty(String key)
+ public void setProperties(Map<String, Object> map)
{
- return properties.get(key);
+ properties = map;
}
-
- public void removeProperty(String key)
- {
- properties.remove(key);
- }
-
- public Iterator<String> getPropertyNames()
- {
- return properties.keySet().iterator();
- }
-
}
|