You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsrf-dev@ws.apache.org by sc...@apache.org on 2004/12/15 21:13:37 UTC

svn commit: r112016 - in incubator/apollo/trunk/src: java/org/apache/ws/resource/handler site/content/tutorial/src/example/filesystem site/content/xdocs/tutorial test/org/apache/ws/resource/properties

Author: scamp
Date: Wed Dec 15 12:13:35 2004
New Revision: 112016

URL: http://svn.apache.org/viewcvs?view=rev&rev=112016
Log:
changed the way we handle custom mappings for SOAPName to JavaNamechange
Removed:
   incubator/apollo/trunk/src/site/content/tutorial/src/example/filesystem/CustomSoapMethodNameMap.java
   incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/SushiSoapMethodNameMap.java
Modified:
   incubator/apollo/trunk/src/java/org/apache/ws/resource/handler/ServiceSoapMethodNameMap.java
   incubator/apollo/trunk/src/site/content/xdocs/tutorial/service.xml
   incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/AbstractSushiService.java

Modified: incubator/apollo/trunk/src/java/org/apache/ws/resource/handler/ServiceSoapMethodNameMap.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/handler/ServiceSoapMethodNameMap.java?view=diff&rev=112016&p1=incubator/apollo/trunk/src/java/org/apache/ws/resource/handler/ServiceSoapMethodNameMap.java&r1=112015&p2=incubator/apollo/trunk/src/java/org/apache/ws/resource/handler/ServiceSoapMethodNameMap.java&r2=112016
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/handler/ServiceSoapMethodNameMap.java	(original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/handler/ServiceSoapMethodNameMap.java	Wed Dec 15 12:13:35 2004
@@ -19,6 +19,7 @@
 import org.apache.ws.resource.ResourceContext;
 import javax.xml.namespace.QName;
 import java.util.Map;
+import java.util.HashMap;
 
 /**
  * LOG-DONE
@@ -32,16 +33,29 @@
    /**
     * Creates a new {@link ServiceSoapMethodNameMap} object.
     *
-    * @param customMethodNameMap DOCUMENT_ME
     * @param context             DOCUMENT_ME
     */
-   public ServiceSoapMethodNameMap( Map             customMethodNameMap,
-                                    ResourceContext context )
+   public ServiceSoapMethodNameMap(ResourceContext context)
    {
-      m_RequestQnameToMethodNameMap = customMethodNameMap;
+      m_RequestQnameToMethodNameMap = new HashMap();
       setParent( new DefaultMethodMap( new WsddSoapMethodNameMap( context ) ) );
    }
 
+    /**
+     * Adds a mapping for a SOAP Message to Java Method name
+     *
+     * @param soapMsgQname
+     * @param javaMethodName
+     */
+   public void addMapping(QName soapMsgQname, String javaMethodName)
+   {
+       m_RequestQnameToMethodNameMap.put(soapMsgQname,javaMethodName);
+   }
+
+   public void removeMapping(QName soapMsgQname)
+   {
+       m_RequestQnameToMethodNameMap.remove(soapMsgQname);
+   }
    /**
     * DOCUMENT_ME
     *

Deleted: /incubator/apollo/trunk/src/site/content/tutorial/src/example/filesystem/CustomSoapMethodNameMap.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/site/content/tutorial/src/example/filesystem/CustomSoapMethodNameMap.java?view=auto&rev=112015
==============================================================================

Modified: incubator/apollo/trunk/src/site/content/xdocs/tutorial/service.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/site/content/xdocs/tutorial/service.xml?view=diff&rev=112016&p1=incubator/apollo/trunk/src/site/content/xdocs/tutorial/service.xml&r1=112015&p2=incubator/apollo/trunk/src/site/content/xdocs/tutorial/service.xml&r2=112016
==============================================================================
--- incubator/apollo/trunk/src/site/content/xdocs/tutorial/service.xml	(original)
+++ incubator/apollo/trunk/src/site/content/xdocs/tutorial/service.xml	Wed Dec 15 12:13:35 2004
@@ -1,17 +1,99 @@
 <?xml version="1.0"?>
-
 <!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+<document>
+	<header>
+		<title>Writing a Service Class</title>
+	</header>
+	<body>
+		<section id="write-service">
+			<title>Writing a Service Class</title>
+			<p>
+        			The service class is the representation of your WSDL file as a Web service.  The public operations in the service class are the operations which will be invokable when a SOAP request is received for your service.
+        		</p>
+        		<p>This section will discuss how to write a service class.  Please note that the eventual goal will be to generate most of this code for you via code generation.  Currently, however, you will need to implement these classes by hand.</p>
+<p>Initially, you should model your service off of the included FileSystem example.  This will ensure you will write a working service.</p>
+         <ul>
+        <li><a href="#intro">What files will need to be written?</a></li>
+        <li><a href="#abstract">The AbstractService class.</a></li>
+        <li><a href="#service">The Service class.</a></li>
+        </ul>     
+		</section>
+		<section id="intro">
+			<title>What files will need to be written?</title>
+			<p>The provided example "FileSystem" includes a FileSystemService.  The FileSystemService extends AbstractFileSystemService to abstract out the code which should not need to be altered.  The abstract class mainly consists of the specification operations (i.e. getMultipleResourceProperties) and the service class which extends this class contains the user-specific operations.  In the case of FileSystemService, these operations are "mount" and "unmount".</p>
+                  <p>
+                   We recommend this structure for writing your service class, however you may write the service however you like.  Our description will describe the use of the abstract class to seperate the functionality.
+                  </p>
+                  
+                  <section id="abstract">
+			<title>The AbstractService class.</title>
+			<p>The abstract class is the superclass for your service and will contain most of the specification-specific operations and utility operations.  Our description of writing the class will be based on the example.filesystem.AbstractFileSystemService class.</p>
+			<p>We will describe the class in sections:</p>
+			<ol>
+				<li><a href="#class-declaration">Class Declaration</a></li>
+				<li><a href="#wsrfservice">WsrfService Interface</a></li>
+				<li><a href="#classvars">Class Variable</a></li>
+				<li><a href="#ops">Operations</a></li>
+			</ol>
+			
+			<section id="class-declaration">
+				<title>Class Declaration</title>
+				<p>When declaring your abstract class, you must implement <code>org.apache.ws.resource.handler.WsrfService</code>.  This interface provides methods for initialization, obtaining the ResourceContext and getting the SoapMethodNameMap use for mapping incoming request QName's to method name for a given object.  It basically ensures that Apollo can interact with your service class.</p>
+				<p>The AbstractFileSystemService's class declaration is as follows:</p>
+				<source><strong> abstract class AbstractFileSystemService
+   implements WsrfService,
+              GetResourcePropertyPortType,
+              GetMultipleResourcePropertiesPortType,
+              SetResourcePropertiesPortType,
+              QueryResourcePropertiesPortType,
+              ImmediateResourceTerminationPortType,
+              ScheduledResourceTerminationPortType</strong></source>
+	<p>You should notice that the class implements WsrfService (described above) and various *PortType inerfaces.  Each PortType interface is a Java representation of a specification's WSDL portType declaration.  By implementing the PortType interface corresponding to the specification's/portTypes you are interested in, you will ensure you get the correct method signature for the method call.</p>		<p>The packages: <strong>org.apache.ws.resource.properties.porttype</strong> and <strong>org.apache.ws.resource.lifetime.porttype</strong> contain the interfaces for the specifications.  You should refer to these packages when selecting the operations you'd like to support. 
+		</p>	
+			</section>
+			<section id="wsrfservice">
+				<title>WsrfService Interface</title>
+				<p>All services in Apollo need to implement the WsrfService interface.  The interface provides operation "hooks" which will allow Apollo to interact with your service.  There are currenty three operations defined by the interface:</p>
+<source>   /**
+    * Returns the SoapMethodNameMap for the Service, to determine
+    * which method to invoke for an incoming request.
+    *
+    * @return SoapMethodNameMap
+    */
+   public SoapMethodNameMap getMethodNameMap(  );
+
+   /**
+    * Returns the ResourceContext for the given Service.
+    *
+    * @return ResourceContext
+    */
+   public ResourceContext getResourceContext(  );
+
+   /**
+    * Initialization method.
+    */
+   public void init(  );</source>
+   
+   <p>The getMethodNameMap() returns a SoapMethodNameMap implementation which contains mappings of WSDL operation QNames to Java method names.  If you have custom operations you will need to extend SoapMethodNameM</p>
+			</section>
+
+			<section id="classvars">
+				<title>Class Variable</title>
+				<p></p>				
+			</section>
+			<section id="ops">
+				<title>Operations</title>
+				<p></p>				
+			</section>
 
-<document> 
-  <header> 
-    <title> </title> 
-  </header> 
-  <body> 
-    <section>
-      <title> </title>
-      <p>
-        TODO
-      </p>
-    </section>
-  </body>
+			</section>               
+			<section id="service">
+				<title>The Service class.</title>
+				<p></p>
+			</section>   
+		</section>
+		
+		
+		
+	</body>
 </document>

Modified: incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/AbstractSushiService.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/AbstractSushiService.java?view=diff&rev=112016&p1=incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/AbstractSushiService.java&r1=112015&p2=incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/AbstractSushiService.java&r2=112016
==============================================================================
--- incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/AbstractSushiService.java	(original)
+++ incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/AbstractSushiService.java	Wed Dec 15 12:13:35 2004
@@ -18,6 +18,7 @@
 import org.apache.ws.resource.ResourceContext;
 import org.apache.ws.resource.handler.SoapMethodNameMap;
 import org.apache.ws.resource.handler.WsrfService;
+import org.apache.ws.resource.handler.ServiceSoapMethodNameMap;
 import org.apache.ws.resource.properties.porttype.GetMultipleResourcePropertiesPortType;
 import org.apache.ws.resource.properties.porttype.GetResourcePropertyPortType;
 import org.apache.ws.resource.properties.porttype.QueryResourcePropertiesPortType;
@@ -56,7 +57,7 @@
    /**
     * DOCUMENT_ME
     */
-   private SushiSoapMethodNameMap m_methodNameMap;
+   private ServiceSoapMethodNameMap m_methodNameMap;
 
    /**
     * DOCUMENT_ME
@@ -138,8 +139,7 @@
     */
    public void init(  )
    {
-      m_methodNameMap    = new SushiSoapMethodNameMap( new HashMap(  ),
-                                                       getResourceContext(  ) );
+      m_methodNameMap    = new ServiceSoapMethodNameMap( getResourceContext(  ) );
       isInitialized      = true;
    }
 

Deleted: /incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/SushiSoapMethodNameMap.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/SushiSoapMethodNameMap.java?view=auto&rev=112015
==============================================================================

---------------------------------------------------------------------
To unsubscribe, e-mail: apollo-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: apollo-dev-help@ws.apache.org