You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hivemind.apache.org by ah...@apache.org on 2005/08/10 22:08:10 UTC

svn commit: r231307 - in /jakarta/hivemind/trunk: examples/src/documentation/content/xdocs/hivemind-examples/logging.xml src/documentation/content/xdocs/index.xml

Author: ahuegen
Date: Wed Aug 10 13:07:58 2005
New Revision: 231307

URL: http://svn.apache.org/viewcvs?rev=231307&view=rev
Log:
Activated source highlighting

Modified:
    jakarta/hivemind/trunk/examples/src/documentation/content/xdocs/hivemind-examples/logging.xml
    jakarta/hivemind/trunk/src/documentation/content/xdocs/index.xml

Modified: jakarta/hivemind/trunk/examples/src/documentation/content/xdocs/hivemind-examples/logging.xml
URL: http://svn.apache.org/viewcvs/jakarta/hivemind/trunk/examples/src/documentation/content/xdocs/hivemind-examples/logging.xml?rev=231307&r1=231306&r2=231307&view=diff
==============================================================================
--- jakarta/hivemind/trunk/examples/src/documentation/content/xdocs/hivemind-examples/logging.xml (original)
+++ jakarta/hivemind/trunk/examples/src/documentation/content/xdocs/hivemind-examples/logging.xml Wed Aug 10 13:07:58 2005
@@ -15,7 +15,7 @@
    limitations under the License.
 -->
 
-<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.3//EN" "http://xml.apache.org/forrest/dtd/document-v13.dtd"
+<!DOCTYPE document PUBLIC "-//HM//DTD Documentation V1.0//EN" "hm-document.dtd"
 [
 	<!ENTITY projectroot '../'>
 	<!ENTITY % common-links SYSTEM "../links.ent">
@@ -52,7 +52,7 @@
   <p> Interceptors are created by interceptor factories, which are themselves HiveMind services. Interceptor factories 
     implement the &api.ServiceInterceptorFactory; interface. </p>
   <p> Our implementation is very simple: </p>
-  <source><![CDATA[package org.apache.hivemind.examples.impl;
+  <javasource><![CDATA[package org.apache.hivemind.examples.impl;
 
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Proxy;
@@ -80,7 +80,7 @@
 
         stack.push(interceptor);
     }
-}]]></source>
+}]]></javasource>
   <p> The <code>createInterceptor()</code> method is passed the &api.InterceptorStack;, the &api.Module; of the 
     invoking module (the module containing the service being created), and any parameters passed to the interceptor 
     (from inside the &interceptor; element). This example does not make use of parameters, but the real logging 
@@ -113,7 +113,7 @@
 another interceptor instance, or may be the core service implementation.
 </p>
 
-<source><![CDATA[package org.apache.hivemind.examples.impl;
+<javasource><![CDATA[package org.apache.hivemind.examples.impl;
 
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.InvocationTargetException;
@@ -166,7 +166,7 @@
     }
 
 }
-]]></source>
+]]></javasource>
 
 <p>
 The <code>invoke()</code> method is the key. Using the remembered <code>Log</code> instance,
@@ -197,10 +197,10 @@
 Like any other service, an service interceptor factory must appear inside a HiveMind module deployment descriptor:
 </p>  
 
-<source><![CDATA[
+<xmlsource><![CDATA[
 <service-point id="ProxyLoggingInterceptor" interface="org.apache.hivemind.ServiceInterceptorFactory">
   <create-instance class="org.apache.hivemind.examples.impl.ProxyLoggingInterceptorFactory"/>
-</service-point>]]></source>
+</service-point>]]></xmlsource>
   
 </section>
 
@@ -211,7 +211,7 @@
 Using the interceptor is the same as using any other interceptor; the &interceptor; element simply has to point at the correct service:
 </p>  
 
-<source><![CDATA[
+<xmlsource><![CDATA[
 <module id="examples" version="1.0.0" package="org.apache.hivemind.examples">
 
     . . . 
@@ -224,13 +224,13 @@
       <create-instance class="impl.TargetServiceImpl"/>
       <interceptor service-id="ProxyLoggingInterceptor"/>
     </service-point>
-</module>]]></source>
+</module>]]></xmlsource>
 
 <p>
 The <code>TargetService</code> interface defines three methods used to demonstrate the logging interceptor:
 </p>
 
-<source>
+<javasource>
 <![CDATA[package org.apache.hivemind.examples;
 
 import java.util.List;
@@ -243,13 +243,13 @@
 
     public void exceptionThrower();
 }
-]]></source>
+]]></javasource>
 
 <p>
 The implementation class is equally inspiring:  
 </p>
 
-<source><![CDATA[package org.apache.hivemind.examples.impl;
+<javasource><![CDATA[package org.apache.hivemind.examples.impl;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -279,7 +279,7 @@
     {
         throw new ApplicationRuntimeException("Some application exception.");
     }
-}]]></source>
+}]]></javasource>
 
 </section>
 

Modified: jakarta/hivemind/trunk/src/documentation/content/xdocs/index.xml
URL: http://svn.apache.org/viewcvs/jakarta/hivemind/trunk/src/documentation/content/xdocs/index.xml?rev=231307&r1=231306&r2=231307&view=diff
==============================================================================
--- jakarta/hivemind/trunk/src/documentation/content/xdocs/index.xml (original)
+++ jakarta/hivemind/trunk/src/documentation/content/xdocs/index.xml Wed Aug 10 13:07:58 2005
@@ -15,8 +15,7 @@
    limitations under the License.
 -->
 
-<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.3//EN"
-	"http://xml.apache.org/forrest/dtd/document-v13.dtd" [
+<!DOCTYPE document PUBLIC "-//HM//DTD Documentation V1.0//EN" "hm-document.dtd" [
 	<!ENTITY % common-links SYSTEM "links.ent">
 	%common-links;
 	]>
@@ -153,12 +152,12 @@
 			<p>In any case, the code should be short. To external objects (objects
 				that are not managed by HiveMind, such as a servlet) the code for
 				accessing a service is quite streamlined:</p>
-			<source><![CDATA[
+			<javasource><![CDATA[
 Registry registry = RegistryBuilder.constructDefaultRegistry();
 MyService service = (MyService) registry.getService("com.mypackage.MyService", MyService.class);
 
 service.perform(...);
-    ]]></source>
+    ]]></javasource>
 			<p>You code is responsible for:</p>
 			<ul>
 				<li>Obtaining a reference to the Registry singleton</li>
@@ -215,7 +214,7 @@
         <title>Task: Log method entry and exit</title>
         <section>
           <title>Typical Approach</title>
-          <source> <![CDATA[ 
+          <javasource> <![CDATA[ 
 public String myMethod(String param)
 {
   if (LOG.isDebugEnabled()) 
@@ -227,7 +226,7 @@
     LOG.debug("myMethod() returns " + result); 
     
   return result;
-}]]> </source>
+}]]> </javasource>
           <p>This approach doesn't do a good or consistent job when a method has multiple return points. It also 
             creates many more branch points within the code ... basically, a lot of clutter. Finally, it doesn't report 
             on exceptions thrown from within the method.</p>
@@ -238,18 +237,18 @@
             service. It will consistently log method entry and exit, and log any exceptions thrown by the method.</p>
           <p>The following descriptor snippet defines a service, provides a core service implementation (using 
             &_create-instance;), and adds method logging (using &_interceptor;):</p>
-          <source><![CDATA[
+          <xmlsource><![CDATA[
 <service-point id="MyService" interface="com.myco.MyServiceInterface">
   <create-instance class="com.myco.impl.MyServiceImpl"/>
   <interceptor service-id="hivemind.LoggingInterceptor"/>
-</service-point>]]> </source>
+</service-point>]]> </xmlsource>
         </section>
       </section>
       <section>
         <title>Task: Reference another service</title>
         <section>
           <title>Typical Approach</title>
-          <source><![CDATA[
+          <javasource><![CDATA[
 private SomeOtherService _otherService;
 
 public String myMethod(String param)
@@ -260,7 +259,7 @@
   _otherService.doSomething(. . .);
   
   . . .
-}]]> </source>
+}]]> </javasource>
           <p>How the other service is looked up is specified to the environment; it might be a JNDI lookup for an EJB. 
             For other microkernels, such as Avalon, there will be calls to a specific API.</p>
           <p>In addition, this code is not thread-safe; multiple threads could execute it simultaneously, causing 
@@ -271,7 +270,7 @@
           <p>Let HiveMind assign the other service as a property. This is <link 
             href="http://www.martinfowler.com/articles/injection.html"> dependency injection</link>. HiveMind can 
             inject dependencies using JavaBeans properties or constructor arguments.</p>
-          <source><![CDATA[
+          <javasource><![CDATA[
 private SomeOtherService _otherService;
 
 public void setOtherService(SomeOtherService otherService)
@@ -284,7 +283,7 @@
   _otherService.doSomething(. . .);
   
   . . .
-}]]> </source>
+}]]> </javasource>
           <p>HiveMind uses a system of proxies to defer creation of services until actually needed. The proxy object 
             assigned to the otherService property will cause the actual service implementation to be instantiated and 
             configured the first time a service method is invoked ... and all of this is done in a thread-safe 
@@ -304,7 +303,7 @@
         </section>
         <section>
           <title>HiveMind Approach</title>
-          <source><![CDATA[
+          <javasource><![CDATA[
 private List _configuration;
 
 public void setConfiguration(List configuration)
@@ -321,7 +320,7 @@
     
     item.doStuff(. . .);
   }
-}]]> </source>
+}]]> </javasource>
           <p>HiveMind will set the <code>configuration</code> property from a <link 
             href="site:configurations">configuration point</link> you specify. The objects in the list are constructed 
             from configuration point contributions and converted, by HiveMind, into objects. As with services, a 



---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-cvs-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-cvs-help@jakarta.apache.org