You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pubscribe-commits@ws.apache.org by jr...@apache.org on 2005/07/28 18:59:52 UTC

svn commit: r225821 - in /webservices/pubscribe/trunk/src/site/content/xdocs/tutorial: mod_home.xml mod_resource.xml

Author: jruzzi
Date: Thu Jul 28 09:59:48 2005
New Revision: 225821

URL: http://svn.apache.org/viewcvs?rev=225821&view=rev
Log:
updated content

Modified:
    webservices/pubscribe/trunk/src/site/content/xdocs/tutorial/mod_home.xml
    webservices/pubscribe/trunk/src/site/content/xdocs/tutorial/mod_resource.xml

Modified: webservices/pubscribe/trunk/src/site/content/xdocs/tutorial/mod_home.xml
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/site/content/xdocs/tutorial/mod_home.xml?rev=225821&r1=225820&r2=225821&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/site/content/xdocs/tutorial/mod_home.xml (original)
+++ webservices/pubscribe/trunk/src/site/content/xdocs/tutorial/mod_home.xml Thu Jul 28 09:59:48 2005
@@ -8,60 +8,38 @@
 	<body>
 		<section>
 			<title>Introduction</title>
-			<p>In this step of the tutorial, the generated Home class (<code>FilesystemHome</code>) is modified to include a <code>getInstance</code> method. 
+			<p>In this step of the tutorial, the generated Home class (<code>FilesystemHome</code>) is modified to include an <code>init</code> method. 
 			The Home is used to lookup the resource instance. It can act as a factory for creating instances upon request, or build all instances. It is meant 
 			to be the entry point for locating a resource instance.
 			</p>
 		</section>
 		<section>
-			<title>Modify the Home Class</title>
+			<title>Modify the FileSytem Home Class</title>
 			<p>Open <code>WORK_DIR/generated/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemHome.java</code> and
-			replace the <code>public Resource getInstance( ResourceContext resourceContext )</code> method with the following method:</p>
-			<source><![CDATA[    public Resource getInstance( ResourceContext resourceContext )
-            throws ResourceException,
-            ResourceContextException,
-            ResourceUnknownException
+			replace the <code>public void init()</code> method with the following method. You will also need to copy the instance variables below.</p>
+			<source><![CDATA[
+    private static final String LVOL1_ID = "/dev/vg00/lvol1";
+    private static final String LVOL2_ID = "/dev/vg00/lvol2";
+
+    /**
+     * Create and add two resource instances.
+     *
+     * @throws Exception on error
+     */
+    public void init() throws Exception
     {
-        ResourceKey key = resourceContext.getResourceKey();
-        FilesystemResource resource = null;
-        try
-        {
-            resource = (FilesystemResource)find( key );
-        }
-        catch ( ResourceException re )
-        {
-            Object id = key.getValue();
-         /**
-          * Determine if the passed-in key is, in fact, something we expect.
-          */
-         if ( id.equals( "/dev/vg00/lvol1" ) || id.equals( "/dev/vg00/lvol2" ) )
-         {
-            try
-            {
-               resource = (FilesystemResource)createInstance( key);
-               EndpointReference epr = getEndpointReference(resourceContext.getBaseURL(  ) + "/" + getServiceName().getLocalPart() , key, SPEC_NAMESPACE_SET.getAddressingNamespace());
-               resource.setEndpointReference(epr);
-            }
-            catch ( Exception e )
-            {
-               throw new ResourceException( e );
-            }
-            add( key, resource );
-         }
-         else
-         {
-            throw new ResourceUnknownException( id,
-                  resourceContext.getServiceName() );
-            }
-        }
-        return resource;
+        super.init();
+        FilesystemResource lvol1Resource = (FilesystemResource) createInstance( LVOL1_ID );
+        add( lvol1Resource );
+        FilesystemResource lvol2Resource = (FilesystemResource) createInstance( LVOL2_ID );
+        add( lvol2Resource );
     }]]></source>
-			<p>
-				<img src="images/back.gif" alt="go to the previous step"/>
-				<a href="site:wsdl2java">Back</a>
-				<img src="images/next.gif" alt="go to the next step"/>
-				<a href="site:modresource">Next</a>
-			</p>
+		<p>
+			<img src="images/back.gif" alt="go to the previous step"/>
+			<a href="site:wsdl2java">Back</a>
+			<img src="images/next.gif" alt="go to the next step"/>
+			<a href="site:modresource">Next</a>
+		</p>
 		</section>
 	</body>
 </document>

Modified: webservices/pubscribe/trunk/src/site/content/xdocs/tutorial/mod_resource.xml
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/site/content/xdocs/tutorial/mod_resource.xml?rev=225821&r1=225820&r2=225821&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/site/content/xdocs/tutorial/mod_resource.xml (original)
+++ webservices/pubscribe/trunk/src/site/content/xdocs/tutorial/mod_resource.xml Thu Jul 28 09:59:48 2005
@@ -16,7 +16,7 @@
 			Properties document defined in the schema section of your WSDL file.
 			</p>
 			<p>In addition, this class is used to expose resource properties as notification topics and register the exposed topics.
-			</p>	
+			</p>
 		</section>
 		<section>
 			<title>Modify the Resource Class</title>
@@ -132,27 +132,8 @@
    catch (Exception e)
    {
    throw new javax.xml.rpc.JAXRPCException("Unable to init the ResourceProperty Changed topics. Cause: " + e.getLocalizedMessage(), e);
-   }  
-                
-            /**
-     * Initializes the Topic, TopicExpressionDialects and FixedTopicSet resource properties
-     *
-     * </br>
-     * <strong>NOTE this MUST be called last in the Resource.init() method to ensure all topics get registered</strong>
-     * </br>
-     * FixedTopicSet will be set based on the value returned from the {@see TopicSpaceSet#isFixed()} method.
-     * </br>
-     * Topic will have all root topics in the TopicSpaceSet, set to Simple dialect AND all child topics set ot
-     * Concrete dialect.
-     * </br>
-     *
-     * TopicExpressionDialects will be set to the engine's known Topic Dialects acquired from the TopicExpressionEngine
-     *
-     * @param topicSpaceSet
-     * @param propSet
-     */
-        org.apache.ws.notification.topics.util.TopicUtils.initNotificationProducerProperties(getTopicSpaceSet() , getResourcePropertySet());
-  }]]></source>
+   }
+}]]></source>
 			<p>
 				<img src="images/back.gif" alt="go to the previous step"/>
 				<a href="site:modhome">Back</a>