You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by hl...@apache.org on 2003/06/18 20:47:01 UTC

cvs commit: jakarta-commons-sandbox/hivemind/src/xsl hivemind.xsl

hlship      2003/06/18 11:47:01

  Modified:    hivemind/src/test/hivemind/test/config SetLocation.xml
               hivemind/xdocs descriptor.xml configuration.xml intro.xml
               hivemind/src/test/hivemind/test/parse
                        TestDescriptorParser.java TestToString.java
               hivemind/src/java/org/apache/commons/hivemind/parse
                        DescriptorParser.java HiveMind_1.0.xsd
                        AbstractInstanceBuilderDescriptor.java
               hivemind/src/test-data/sample sample-registry.xml
               hivemind/src/xsl hivemind.xsl
  Removed:     hivemind/src/test/hivemind/test/parse SetLocation.xml
               hivemind/src/java/org/apache/commons/hivemind/parse
                        SetLocationDescriptor.java
  Log:
  Remote <set-location> element; location property automatically set when appropriate (object implements ILocationHolder).
  
  Revision  Changes    Path
  1.2       +1 -2      jakarta-commons-sandbox/hivemind/src/test/hivemind/test/config/SetLocation.xml
  
  Index: SetLocation.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/test/hivemind/test/config/SetLocation.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SetLocation.xml	4 Jun 2003 21:46:05 -0000	1.1
  +++ SetLocation.xml	18 Jun 2003 18:47:00 -0000	1.2
  @@ -8,7 +8,6 @@
     <configuration id="Config" element-type="hivemind.test.config.ConfigElement">
       <create-instance class="hivemind.test.config.ConfigElement">
         <set property="title" value="First"/>
  -      <set-location property="location"/>	
       </create-instance>	
     </configuration>
   </module>
  
  
  
  1.5       +24 -12    jakarta-commons-sandbox/hivemind/xdocs/descriptor.xml
  
  Index: descriptor.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/xdocs/descriptor.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- descriptor.xml	11 Jun 2003 18:43:12 -0000	1.4
  +++ descriptor.xml	18 Jun 2003 18:47:00 -0000	1.5
  @@ -507,6 +507,17 @@
   			<p> &_create-instance; instantiates an object from a class name, and then
   				configures the new object. The object may be contributed to a service
   				extension point or configuration extension point.</p>
  +				
  +			<p>
  +			If the created object implements the
  +			<code>ILocationHolder</code> interface,
  +			then the newly created object's <code>location</code> property
  +			is set to the location of the &_create-instance; element.
  +			<em>Note:</em>
  +			This applies to &set-create;, &factory; and &set-factory;
  +			as well.
  +			</p>
  +			
   			<table>
   				<tr>
   					<th>Attribute</th>
  @@ -582,8 +593,8 @@
   			<tr> <td>class</td> <td>class name</td> <td>yes</td> <td>Fully qualified
   			class name to instantiate.</td> </tr> </table> </section>
   		<section name="factory">
  -			<p> &_factory; instantiates an object obtains a factory instance and has
  -				the factory create a new instance, which is configured.</p>
  +			<p> &_factory; uses a factory service to create an object,
  +				which is then configured.</p>
   			<p>&_factory; contains the same elements as &create-instance;.</p>
   			<table>
   				<tr>
  @@ -592,13 +603,7 @@
   					<th>Required ?</th>
   					<th>Description</th>
   				</tr>
  -				<tr>
  -					<td>property</td>
  -					<td>string</td>
  -					<td>yes</td>
  -					<td>The name of the property to be updated to the newly created
  -						object.</td>
  -				</tr>
  +
   				<tr>
   					<td>service-id</td>
   					<td>service id</td>
  @@ -609,8 +614,8 @@
   			</table>
   		</section>
   		<section name="set-factory">
  -			<p> &_set-factory; instantiates an object obtained from a factory instance
  -				and has the factory create a new instance, which is configured.</p>
  +			<p> &_set-factory;  uses a factory service to create an object,
  +				which is then configured.</p>
   			<p>&_set-factory; contains the same elements as &create-instance;.</p>
   			<table>
   				<tr>
  @@ -619,6 +624,13 @@
   					<th>Required ?</th>
   					<th>Description</th>
   				</tr>
  +				<tr>
  +					<td>property</td>
  +					<td>string</td>
  +					<td>yes</td>
  +					<td>The name of the property to be updated to the newly created
  +						object.</td>
  +				</tr>				
   				<tr>
   					<td>service-id</td>
   					<td>service id</td>
  
  
  
  1.3       +11 -3     jakarta-commons-sandbox/hivemind/xdocs/configuration.xml
  
  Index: configuration.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/xdocs/configuration.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- configuration.xml	12 Jun 2003 20:57:39 -0000	1.2
  +++ configuration.xml	18 Jun 2003 18:47:00 -0000	1.3
  @@ -15,8 +15,16 @@
   <p>
   A central concept in HiveMind is <em>configurations</em>. Once you have a set of
   services, its natural to want to configure those services.  In HiveMind, a configuration
  -is a list of <em>elements</em>.  Each element is contributed by a module ... any module may make
  -contributes to any service extension point.
  +is an unordered list of <em>elements</em>.  Each element is contributed by a module ... any module may make
  +contributes to any configuration extension point.
  +</p>
  +
  +<p>
  +There is not a direct connection between a service and a configuration, though it is often the case
  +that a service and a configuration will be similarily named (or even identically named; services
  +and configurations are in seperate namespaces).	Any relationship between a service and a configuration
  +is explicit only in code ... the service may request a configuration from the registry and operate
  +on the elements it receives.
   </p>
   
   		</section>
  
  
  
  1.3       +7 -1      jakarta-commons-sandbox/hivemind/xdocs/intro.xml
  
  Index: intro.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/xdocs/intro.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- intro.xml	11 Jun 2003 18:43:12 -0000	1.2
  +++ intro.xml	18 Jun 2003 18:47:00 -0000	1.3
  @@ -184,6 +184,12 @@
       the application.
       </p>
       
  +    <p>The <a href="base-registry.html">HiveMind module descriptor documentation</a>
  +    gives a general idea of what the documentation looks like.  Since its documentation
  +    for just the core HiveMind module, it doesn't really show off the bells and whistles
  +    you get when multiple modules work together.
  +    </p>
  +    
       </section>
       
       <section name="Out of Scope">
  
  
  
  1.6       +2 -16     jakarta-commons-sandbox/hivemind/src/test/hivemind/test/parse/TestDescriptorParser.java
  
  Index: TestDescriptorParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/test/hivemind/test/parse/TestDescriptorParser.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestDescriptorParser.java	9 Jun 2003 22:23:09 -0000	1.5
  +++ TestDescriptorParser.java	18 Jun 2003 18:47:00 -0000	1.6
  @@ -62,18 +62,17 @@
   import java.util.List;
   
   import org.apache.commons.hivemind.Occurances;
  +import org.apache.commons.hivemind.parse.AbstractInstanceBuilderDescriptor;
   import org.apache.commons.hivemind.parse.ConfigurationDescriptor;
   import org.apache.commons.hivemind.parse.ContributeConfigurationDescriptor;
   import org.apache.commons.hivemind.parse.ContributeServiceDescriptor;
   import org.apache.commons.hivemind.parse.CreateInstanceDescriptor;
   import org.apache.commons.hivemind.parse.ExpressionDescriptor;
   import org.apache.commons.hivemind.parse.FactoryDescriptor;
  -import org.apache.commons.hivemind.parse.AbstractInstanceBuilderDescriptor;
   import org.apache.commons.hivemind.parse.InterceptorDescriptor;
   import org.apache.commons.hivemind.parse.ModuleDescriptor;
   import org.apache.commons.hivemind.parse.ServiceDescriptor;
   import org.apache.commons.hivemind.parse.ServiceRefDescriptor;
  -import org.apache.commons.hivemind.parse.SetLocationDescriptor;
   import org.apache.commons.hivemind.parse.ValueDescriptor;
   import org.apache.commons.hivemind.parse.XMLDescriptor;
   import org.apache.tapestry.Tapestry;
  @@ -455,20 +454,7 @@
           assertEquals("AnXMLFile.xml", xd.getPath());
       }
   
  -    public void testSetLocation() throws Exception
  -    {
  -        ModuleDescriptor md = parse("SetLocation.xml");
  -
  -        ServiceDescriptor sd = md.getService("Foo");
  -        AbstractInstanceBuilderDescriptor ibd = sd.getInstanceBuilder();
  -        List l = ibd.getConfigurators();
  -        assertEquals(1, l.size());
   
  -        SetLocationDescriptor d = (SetLocationDescriptor) l.get(0);
  -
  -        assertEquals("location", d.getPropertyName());
  -        assertSame(ibd, d.getContainer());
  -    }
   
       public void testSetValueExtended() throws Exception
       {
  
  
  
  1.3       +1 -3      jakarta-commons-sandbox/hivemind/src/test/hivemind/test/parse/TestToString.java
  
  Index: TestToString.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/test/hivemind/test/parse/TestToString.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestToString.java	4 Jun 2003 23:52:50 -0000	1.2
  +++ TestToString.java	18 Jun 2003 18:47:00 -0000	1.3
  @@ -78,7 +78,6 @@
   import org.apache.commons.hivemind.parse.ModuleDescriptor;
   import org.apache.commons.hivemind.parse.ServiceDescriptor;
   import org.apache.commons.hivemind.parse.ServiceRefDescriptor;
  -import org.apache.commons.hivemind.parse.SetLocationDescriptor;
   import org.apache.commons.hivemind.parse.ValueDescriptor;
   import org.apache.commons.hivemind.parse.XMLDescriptor;
   
  @@ -108,7 +107,6 @@
   		new ModuleDescriptor().toString();
   		new ServiceDescriptor().toString();
   		new ServiceRefDescriptor().toString();
  -		new SetLocationDescriptor().toString();
   		new ValueDescriptor().toString();
   		new XMLDescriptor().toString();
   		new InterceptorDescriptor().toString();
  
  
  
  1.7       +1 -9      jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/parse/DescriptorParser.java
  
  Index: DescriptorParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/parse/DescriptorParser.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DescriptorParser.java	10 Jun 2003 21:29:25 -0000	1.6
  +++ DescriptorParser.java	18 Jun 2003 18:47:00 -0000	1.7
  @@ -343,14 +343,6 @@
               new String[] { "propertyName", "factoryServiceId" });
           result.addSetNext(pattern, "addConfigurator");
   
  -        pattern = "*/set-location";
  -
  -        result.addObjectCreate(pattern, SetLocationDescriptor.class);
  -        result.addRule(pattern, setLocationRule);
  -        result.addSetLimitedProperties(pattern, "property", "propertyName");
  -        result.addSetTop(pattern, "setContainer");
  -        result.addSetNext(pattern, "addConfigurator");
  -
           pattern = "*/interceptor";
   
           result.addObjectCreate(pattern, InterceptorDescriptor.class);
  
  
  
  1.6       +0 -8      jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/parse/HiveMind_1.0.xsd
  
  Index: HiveMind_1.0.xsd
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/parse/HiveMind_1.0.xsd,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- HiveMind_1.0.xsd	17 Jun 2003 21:13:04 -0000	1.5
  +++ HiveMind_1.0.xsd	18 Jun 2003 18:47:00 -0000	1.6
  @@ -238,14 +238,6 @@
   					</xs:attribute>
   				</xs:complexType>
   			</xs:element>
  -			<xs:element name="set-location">
  -				<xs:annotation>
  -					<xs:documentation>Used to set a property of the object to the location that created the object.</xs:documentation>
  -				</xs:annotation>
  -				<xs:complexType>
  -					<xs:attributeGroup ref="property-setter"/>
  -				</xs:complexType>
  -			</xs:element>
   		</xs:choice>
   	</xs:complexType>
   	<xs:element name="value" type="xs:string">
  
  
  
  1.3       +8 -1      jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/parse/AbstractInstanceBuilderDescriptor.java
  
  Index: AbstractInstanceBuilderDescriptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/parse/AbstractInstanceBuilderDescriptor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractInstanceBuilderDescriptor.java	4 Jun 2003 23:52:47 -0000	1.2
  +++ AbstractInstanceBuilderDescriptor.java	18 Jun 2003 18:47:00 -0000	1.3
  @@ -64,6 +64,7 @@
   import org.apache.commons.lang.builder.ToStringBuilder;
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  +import org.apache.tapestry.ILocationHolder;
   import org.apache.tapestry.Tapestry;
   
   /**
  @@ -110,6 +111,12 @@
        */
       protected void configureNewInstance(Object object, IModule module)
       {
  +    	if (object instanceof ILocationHolder)
  +    	{
  +    		ILocationHolder holder = (ILocationHolder)object;
  +    		holder.setLocation(getLocation());
  +    	}
  +    	
           int count = Tapestry.size(_configurators);
   
           if (count == 0)
  
  
  
  1.2       +15 -1     jakarta-commons-sandbox/hivemind/src/test-data/sample/sample-registry.xml
  
  Index: sample-registry.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/test-data/sample/sample-registry.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- sample-registry.xml	17 Jun 2003 21:13:04 -0000	1.1
  +++ sample-registry.xml	18 Jun 2003 18:47:01 -0000	1.2
  @@ -45,7 +45,9 @@
   		</service>
   	</module>
   	<module id="hivemind.test.config" uid="4" version="1.0.0">
  -		<configuration count="1" element-type="java.lang.String" id="hivemind.test.config.Required" uid="5"/>
  +		<configuration count="1" element-type="java.lang.String" id="hivemind.test.config.Required" uid="5">
  +		<description>Trouble maker.</description>
  +		</configuration>
   	</module>
   	<module id="zap.branigan" uid="6" version="1.0.1">
   	  <service id="zap.branigan.Futurama" interface="futurama.Robot" uid="7">
  @@ -60,4 +62,16 @@
   	  	<value>foo</value>	
   	  </contribute-configuration>
   	</module>
  +	
  +  <module id="teela" uid="10" version="1.0.0">
  +     <contribute-configuration configuration-id="org.apache.commons.hivemind.VariableSource" uid="11">
  +	  	<value>bar</value>	
  +	  		<value>baz</value>	
  +	  </contribute-configuration>
  +	  	
  +	  		  <contribute-service service-id="org.apache.commons.hivemind.LoggingInterceptor" uid="12">
  +	  	<interceptor service-id="teela.OneEye"/>
  +	  	<interceptor service-id="teela.BigBoots"/>
  +	  </contribute-service>
  +  </module>
   </registry>
  
  
  
  1.2       +57 -5     jakarta-commons-sandbox/hivemind/src/xsl/hivemind.xsl
  
  Index: hivemind.xsl
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/xsl/hivemind.xsl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- hivemind.xsl	17 Jun 2003 21:13:06 -0000	1.1
  +++ hivemind.xsl	18 Jun 2003 18:47:01 -0000	1.2
  @@ -161,15 +161,42 @@
   				</xsl:if>
   			</tbody>
   		</table>
  -		<xsl:if test="*">
  +		<xsl:if test="*[local-name() != 'description']">
  +			<h3>Internal Contributions</h3>
   			<ul>
   				<xsl:apply-templates/>
   			</ul>
   		</xsl:if>
  +					
  +		<xsl:for-each select="/registry/module/contribute-configuration[@configuration-id = current()/@id]">
  +		  <xsl:sort select="../@id"/>
  +		  
  +		  <h3>Contributions from Module
  +		  <a>
  +		    <xsl:attribute name="href">#<xsl:value-of select="@uid"/></xsl:attribute>
  +		    <xsl:value-of select="../@id"/>
  +		  </a>	
  +		  </h3>
  +		  
  +		  <ul>
  +		  	<xsl:apply-templates select="*"/>	
  +		  </ul>
  +			
  +		</xsl:for-each>
  +
  +		
   	</xsl:template>
   	<xsl:template match="contribute-configuration">
  -		<h2> <xsl:attribute name="id"><xsl:value-of select="@uid"/></xsl:attribute> 
  -			Contribute Configuration <xsl:value-of select="@configuration-id"/> </h2>
  +					<h2> <xsl:attribute name="id"><xsl:value-of select="@uid"/></xsl:attribute> 
  +			Contribute Configuration 
  +			
  +			<a>
  +				<xsl:attribute name="href">#<xsl:value-of select="/registry/module/configuration[@id = current()/@configuration-id]/@uid"/></xsl:attribute>
  +					<xsl:value-of select="@configuration-id"/> 
  +			</a>
  +					
  +			</h2>
  +			
   		<ul>
   			<xsl:apply-templates/>
   		</ul>
  @@ -201,15 +228,40 @@
   				</xsl:if>
   			</tbody>
   		</table>
  -		<xsl:if test="*">
  +		<xsl:if test="*[local-name() != 'description']">
  +			<h3>Internal Contributions</h3>
   			<ul>
   				<xsl:apply-templates/>
   			</ul>
   		</xsl:if>
  +		
  +		<xsl:for-each select="/registry/module/contribute-service[@service-id = current()/@id]">
  +		  <xsl:sort select="../@id"/>
  +		  
  +		  <h3>Contributions from Module
  +		  <a>
  +		    <xsl:attribute name="href">#<xsl:value-of select="@uid"/></xsl:attribute>
  +		    <xsl:value-of select="../@id"/>
  +		  </a>	
  +		  </h3>
  +		  
  +		  <ul>
  +		  	<xsl:apply-templates select="*"/>	
  +		  </ul>
  +			
  +		</xsl:for-each>		
  +		
   	</xsl:template>
   	<xsl:template match="contribute-service">
   		<h2> <xsl:attribute name="id"><xsl:value-of select="@uid"/></xsl:attribute> 
  -			Contribute Service <xsl:value-of select="@configuration-id"/> </h2>
  +			Contribute Service 
  +			
  +			<a>
  +				<xsl:attribute name="href">#<xsl:value-of select="/registry/module/service[@id = current()/@service-id]/@uid"/></xsl:attribute>
  +					<xsl:value-of select="@service-id"/> 
  +			</a>
  +					
  +			</h2>
   		<ul>
   			<xsl:apply-templates/>
   		</ul>
  
  
  

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