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/08/01 16:21:38 UTC
cvs commit: jakarta-commons-sandbox/hivemind/src/xsl hivemind.xsl hivemind.css
hlship 2003/08/01 07:21:38
Modified: hivemind/xdocs descriptor.xml extension-points.xml
services.xml
hivemind/src/java/org/apache/commons/hivemind/parse
ExtensionPointDescriptor.java DescriptorParser.java
hivemind/src/test/hivemind/test/ant
TestConstructRegistry.java
hivemind/src/java/org/apache/commons/hivemind/impl
ExtensionPointImpl.java RegistryBuilder.java
hivemind maven.xml
hivemind/src/test-data/sample org.example.toolbar.ui.xml
org.example.boostrap.xml
hivemind/src/java/org/apache/commons/hivemind/ant
ConstructRegistry.java
hivemind/src/xsl hivemind.xsl hivemind.css
Added: hivemind/src/test-data/TestConstructRegistry
testLocalRefs.xml LocalRefs.xml
Log:
Revise the HiveMind XSL stylesheet
Remove the cache-elements attribute from <extension-point>: elements are now always cached
Fix ConstructRegistry to expand local ids to qualified ids in the service-id attribute of <invoke-factory> and <interceptor>.
Revision Changes Path
1.15 +1 -10 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.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- descriptor.xml 31 Jul 2003 21:06:24 -0000 1.14
+++ descriptor.xml 1 Aug 2003 14:21:38 -0000 1.15
@@ -207,15 +207,6 @@
(default): any number</li> <li><b>0..1</b>: optional</li> <li><b>1</b>
: required</li> <li><b>1..n</b>: at least one</li> </ul> </td>
</tr>
- <tr>
- <td>cache-elements</td>
- <td>boolean</td>
- <td>no</td>
- <td>If true (the default), then the list of elements created from the
- contributions are cached and reused on subsequent accesses. If
- false, then the list of elements is created fresh on each access to
- the configuration extension point.</td>
- </tr>
</table>
1.2 +4 -11 jakarta-commons-sandbox/hivemind/xdocs/extension-points.xml
Index: extension-points.xml
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/xdocs/extension-points.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- extension-points.xml 31 Jul 2003 21:06:24 -0000 1.1
+++ extension-points.xml 1 Aug 2003 14:21:38 -0000 1.2
@@ -109,12 +109,6 @@
first call to <code>Registry.getExtensionPointElements()</code> for that extension point.
</p>
-<p>
-In most cases, the element list is retained for future invocations of <code>getExtensionPointElements()</code>.
-This is controlled by the <code>cache-elements</code> attribute of the &extension-point; element. Set
-<code>cache-elements</code> to <code>false</code> for configuration extension points that will be read just once.
-</p>
-
</section>
<section name="Substitution Symbols">
@@ -156,12 +150,11 @@
<p>
This begs the question: where do symbol values come from? The answser is application dependent.
HiveMind itself defines a configuration extension point for this purpose:
-<code>hivemind.SymbolSource</code>. Contributions to this extension point
+<a href="base-registry/hivemind.html#extension-point:hivemind.SymbolSource">hivemind.SymbolSource</a>. Contributions to this extension point define
+new objects that can provide values for symbols, and identify the order in which
+these objects should be consulted.
</p>
-<p><b>TODO: Add link to generated master-module docs here.</b>
-
-</p>
</subsection>
1.12 +4 -4 jakarta-commons-sandbox/hivemind/xdocs/services.xml
Index: services.xml
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/xdocs/services.xml,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- services.xml 31 Jul 2003 21:06:24 -0000 1.11
+++ services.xml 1 Aug 2003 14:21:38 -0000 1.12
@@ -168,7 +168,7 @@
simple HiveMind deployment descriptor. This is an XML file, named
hivemind.xml, that must be included in the module's META-INF directory.</p>
<source><![CDATA[
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0"?>
<module id="com.myco.mypackage" version="1.0.0">
<service id="Adder" interface="com.myco.mypackage.Adder"/>
</module>
@@ -199,7 +199,7 @@
<p>That's what we meant by a POJO. We'll create a second module to provide
this implementation.</p>
<source><![CDATA[
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0"?>
<module id="com.myco.mypackage.impl" version="1.0.0">
<extend-service service-id="com.myco.mypackage.Adder">
<create-instance class="com.myco.mypackage.impl.AdderImpl"/>
@@ -213,7 +213,7 @@
]]></source>
<p>Another module may provide an interceptor:</p>
<source><![CDATA[
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0"?>
<moduleid="com.myco.anotherpackage" version="1.0.0">
<dependency module-id="com.myco.mypackage"/>
<extend-service service-id="com.myco.mypackage.Adder">
1.1 jakarta-commons-sandbox/hivemind/src/test-data/TestConstructRegistry/testLocalRefs.xml
Index: testLocalRefs.xml
===================================================================
<?xml version="1.0"?>
<registry>
<module id="hivemind.test.config" uid="1" version="1.0.0">
<service id="hivemind.test.config.MyService" uid="2">
<invoke-factory service-id="hivemind.test.config.MyService"/>
<interceptor service-id="hivemind.test.config.MyService"/>
</service>
</module>
</registry>
1.1 jakarta-commons-sandbox/hivemind/src/test-data/TestConstructRegistry/LocalRefs.xml
Index: LocalRefs.xml
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: LocalRefs.xml,v 1.1 2003/08/01 14:21:38 hlship Exp $ -->
<module id="hivemind.test.config" version="1.0.0">
<service id="MyService">
<!-- Not a sensible contribution, but the point is to exercise the code
that expands the service-id in these elements to fully qualified ids. -->
<invoke-factory service-id="MyService"/>
<interceptor service-id="MyService"/>
</service>
</module>
1.3 +1 -13 jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/parse/ExtensionPointDescriptor.java
Index: ExtensionPointDescriptor.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/parse/ExtensionPointDescriptor.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ExtensionPointDescriptor.java 30 Jul 2003 22:34:53 -0000 1.2
+++ ExtensionPointDescriptor.java 1 Aug 2003 14:21:38 -0000 1.3
@@ -73,14 +73,12 @@
{
private String _id;
private Occurances _count = Occurances.UNBOUNDED;
- private boolean _cacheElements;
private Schema _schema;
protected void extendDescription(ToStringBuilder builder)
{
builder.append("id", _id);
builder.append("count", _count);
- builder.append("cacheElements", _cacheElements);
builder.append("schema", _schema);
}
@@ -102,16 +100,6 @@
public void setId(String string)
{
_id = string;
- }
-
- public boolean getCacheElements()
- {
- return _cacheElements;
- }
-
- public void setCacheElements(boolean b)
- {
- _cacheElements = b;
}
public Schema getSchema()
1.16 +3 -7 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.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- DescriptorParser.java 31 Jul 2003 21:06:25 -0000 1.15
+++ DescriptorParser.java 1 Aug 2003 14:21:38 -0000 1.16
@@ -148,7 +148,6 @@
private static final int STATE_INTERCEPTOR = 7;
private static final int STATE_EXTEND_SERVICE = 8;
-
/**
* Used for both <schema&;gt; within a <extension-point>,
* and for <parameters-schema> within a
@@ -157,8 +156,8 @@
private static final int STATE_SCHEMA = 9;
private static final int STATE_ELEMENT = 10;
private static final int STATE_RULES = 11;
- private static final int STATE_INVOKE_FACTORY = 12;
-
+ private static final int STATE_INVOKE_FACTORY = 12;
+
/**
* Represents building Element hierarchy as a light-wieght DOM.
*/
@@ -196,7 +195,6 @@
static {
EXTENSION_POINT_ATTRIBUTES.put("id", Boolean.TRUE);
EXTENSION_POINT_ATTRIBUTES.put("occurs", Boolean.FALSE);
- EXTENSION_POINT_ATTRIBUTES.put("cache-elements", Boolean.FALSE);
}
private static final Map SERVICE_ATTRIBUTES = new HashMap();
@@ -758,7 +756,6 @@
checkAttributes(MODULE_ATTRIBUTES);
-
md.setModuleId(getAttribute("id"));
md.setVersion(getAttribute("version"));
@@ -790,7 +787,6 @@
checkAttributes(EXTENSION_POINT_ATTRIBUTES);
epd.setId(getAttribute("id"));
- epd.setCacheElements(getBooleanAttribute("cache-elements", true));
String occurs = getAttribute("occurs");
1.6 +22 -1 jakarta-commons-sandbox/hivemind/src/test/hivemind/test/ant/TestConstructRegistry.java
Index: TestConstructRegistry.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/test/hivemind/test/ant/TestConstructRegistry.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TestConstructRegistry.java 29 Jul 2003 22:20:49 -0000 1.5
+++ TestConstructRegistry.java 1 Aug 2003 14:21:38 -0000 1.6
@@ -163,6 +163,27 @@
compare(output, "src/test-data/TestConstructRegistry/testBasic.xml");
}
+
+ public void testLocalRefs() throws Exception
+ {
+ ConstructRegistry cr = create();
+
+ Path p = cr.createDescriptors();
+
+ p.createPath().setLocation(new File("src/test-data/TestConstructRegistry/LocalRefs.xml"));
+
+ File output = File.createTempFile("testLocalRefs-", ".xml");
+
+ // Delete the file, to force the task to re-create it.
+
+ output.delete();
+
+ cr.setOutput(output);
+
+ cr.execute();
+
+ compare(output, "src/test-data/TestConstructRegistry/testLocalRefs.xml");
+ }
public void testUptoDate() throws Exception
{
1.3 +11 -26 jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/impl/ExtensionPointImpl.java
Index: ExtensionPointImpl.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/impl/ExtensionPointImpl.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ExtensionPointImpl.java 30 Jul 2003 22:34:52 -0000 1.2
+++ ExtensionPointImpl.java 1 Aug 2003 14:21:38 -0000 1.3
@@ -82,20 +82,18 @@
{
private static final Log LOG = LogFactory.getLog(ExtensionPointImpl.class);
- /**
- * The cached elements for the extension point (if caching is enabled).
- */
- private List _elements;
+ /**
+ * The cached elements for the extension point (if caching is enabled).
+ */
+ private List _elements;
private Occurances _expectedCount;
private List _extensions;
- private boolean _cacheElements;
private boolean _building;
private Schema _schema;
protected void extendDescription(ToStringBuilder builder)
{
builder.append("expectedCount", _expectedCount);
- builder.append("cacheElements", _cacheElements);
builder.append("extensions", _extensions);
builder.append("schema", _schema);
}
@@ -136,9 +134,9 @@
public synchronized List getElements()
{
- if (_elements != null)
- return _elements;
-
+ if (_elements != null)
+ return _elements;
+
if (_building)
throw new ApplicationRuntimeException(
HiveMind.format(
@@ -156,12 +154,9 @@
// the schema and extensions (used to build the
// result); it can all be released to the GC.
- if (_cacheElements)
- {
- _elements = result;
- _schema = null;
- _extensions = null;
- }
+ _elements = result;
+ _schema = null;
+ _extensions = null;
return result;
}
@@ -210,16 +205,6 @@
ex);
}
- }
-
- public boolean getCacheElements()
- {
- return _cacheElements;
- }
-
- public void setCacheElements(boolean b)
- {
- _cacheElements = b;
}
public Schema getSchema()
1.16 +1 -2 jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/impl/RegistryBuilder.java
Index: RegistryBuilder.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/impl/RegistryBuilder.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- RegistryBuilder.java 31 Jul 2003 21:06:24 -0000 1.15
+++ RegistryBuilder.java 1 Aug 2003 14:21:38 -0000 1.16
@@ -303,7 +303,6 @@
point.setLocation(epd.getLocation());
point.setModule(module);
point.setExpectedCount(epd.getCount());
- point.setCacheElements(epd.getCacheElements());
point.setSchema(epd.getSchema());
module.addExtensionPoint(point);
1.5 +5 -1 jakarta-commons-sandbox/hivemind/maven.xml
Index: maven.xml
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/maven.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- maven.xml 20 Jun 2003 14:00:29 -0000 1.4
+++ maven.xml 1 Aug 2003 14:21:38 -0000 1.5
@@ -11,6 +11,10 @@
</taskdef>
<manifestClassPath property="hivemind.manifest.class.path">
<classpath>
+
+ <!-- This, unforutnately, includes a few dependencies we don't want, but
+ that's largely OK. -->
+
<path refid="maven.dependency.classpath"/>
</classpath>
</manifestClassPath>
1.5 +38 -29 jakarta-commons-sandbox/hivemind/src/test-data/sample/org.example.toolbar.ui.xml
Index: org.example.toolbar.ui.xml
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/test-data/sample/org.example.toolbar.ui.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- org.example.toolbar.ui.xml 9 Jul 2003 11:27:25 -0000 1.4
+++ org.example.toolbar.ui.xml 1 Aug 2003 14:21:38 -0000 1.5
@@ -1,54 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id$ -->
-<module xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:noNamespaceSchemaLocation="http://jakarta.apache.org/commons/hivemind/schema/HiveMind_1.0.xsd"
- id="org.example.ui.toolbar" version="1.0.1">
+<module id="org.example.ui.toolbar" version="1.0.1">
<description>
Module for managing the application toolbar.
</description>
- <dependency module-id="org.example.bootstrap"/>
- <configuration id="Toolbar"
- element-type="org.example.ui.toolbar.ToolbarItem"
+ <extension-point id="Toolbar"
count="1..n">
<description>
Items which may appear on the toolbar.
</description>
- <new>
- <set-message property="label" key="quit.label"/>
- <set property="mneumonic" value="Q"/>
- <set property="order" value="1"/>
- <set-create property="callback" class="org.example.ui.toolbar.impl.QuitCallback"/>
- </new>
+ <schema>
+ <element name="item">
+ <attribute name="label" required="true"/>
+ <attribute name="mnuemonic"/>
+ <attribute name="order"/>
+ <attribute name="callback" required="true"/>
+
+ <rules>
+ <create-object class="org.example.ui.toolbar.ToolbarItem"/>
+ <read-attribute property="label" attribute="label"/>
+ <read-attribute property="mnuemonic" attribute="mnuemonic"/>
+ <read-attribute property="order" attribute="order" translator="int"/>
+ <read-attribute property="callback" attribute="callback" translator="class"/>
+ </rules>
+ </element>
+ </schema>
- </configuration>
+ </extension-point>
+
+ <extension point-id="Toolbar">
+ <item
+ label="%quit.label"
+ mnuemonic="Q"
+ order="1"
+ callback="org.example.ui.toolbar.impl.QuitCallback"/>
+ </extension>
<service id="ToolbarManager" interface="org.example.ui.toolbar.IToolbarManager">
<description>Service for accessing the toolbar.</description>
<create-instance class="org.example.ui.toolbar.impl.ToolbarManagerService"/>
- <interceptor service-id="org.apache.commons.hivemind.LoggingInterceptor"/>
+ <interceptor service-id="hivemind.LoggingInterceptor"/>
</service>
- <contribute-configuration configuration-id="org.apache.commons.hivemind.SymbolSource">
- <new>
- <set property="order" value="100"/>
- <set-create property="source" class="org.example.toolbar.ui.impl.PreferencesSymbolSource"/>
- </new>
- </contribute-configuration>
+ <extension point-id="hivemind.SymbolSource">
+ <source class="org.example.toolbar.ui.impl.PreferencesSymbolSource" order="100"/>
+ </extension>
- <contribute-configuration configuration-id="org.example.bootstrap.Bootstrap">
- <create-instance class="org.example.ui.toolbar.impl.ToolbarStartup"/>
- </contribute-configuration>
+ <extension point-id="org.example.bootstrap.Bootstrap">
+ <run class="org.example.ui.toolbar.impl.ToolbarStartup"/>
+ </extension>
<service id="ToolbarDAO" interface="org.example.ejb.toolbar.ToolBarDAO">
<description>
Wrapper around the ToolBarDAO session EJB.
</description>
- <service-factory service-id="org.apache.commons.hivemind.EJBProxyFactory">
- <parameters>
- <value>org.example.ejb.toolbar.ToolBarDAO</value>
- </parameters>
- </service-factory>
+ <invoke-factory service-id="hivemind.EJBProxyFactory">
+ <parameters jndiName="org.example.ejb.toolbar.ToolBarDAO"/>
+ </invoke-factory>
</service>
</module>
1.2 +21 -8 jakarta-commons-sandbox/hivemind/src/test-data/sample/org.example.boostrap.xml
Index: org.example.boostrap.xml
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/test-data/sample/org.example.boostrap.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- org.example.boostrap.xml 20 Jun 2003 14:00:30 -0000 1.1
+++ org.example.boostrap.xml 1 Aug 2003 14:21:38 -0000 1.2
@@ -1,17 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id$ -->
-<module xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:noNamespaceSchemaLocation="http://jakarta.apache.org/commons/hivemind/schema/HiveMind_1.0.xsd"
- id="org.example.bootstrap" version="1.0.0">
+<module id="org.example.bootstrap" version="1.0.0">
<description>
Contains the boostrap service used to startup the application.
</description>
- <configuration id="Bootstrap"
- element-type="java.lang.Runnable"
- cache-elements="false">
+ <extension-point id="Bootstrap">
<description>Provides a list of Runnable objects used to startup the application.</description>
- </configuration>
+
+ <schema>
+ <element name="run">
+ <description>An object that may be run.</description>
+
+ <attribute name="class" required="true">
+ <description>
+ The name of the class to instantiate, which must implement Runnable.
+ </description>
+ </attribute>
+
+ <rules>
+ <push-attribute attribute="class" translator="class"/>
+ <invoke-parent method="addElement"/>
+ </rules>
+ </element>
+ </schema>
+ </extension-point>
<service id="Bootstrap" interface="java.lang.Runnable">
<description>The service which actually bootstraps the application.</description>
1.5 +40 -25 jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/ant/ConstructRegistry.java
Index: ConstructRegistry.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/ant/ConstructRegistry.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ConstructRegistry.java 29 Jul 2003 22:20:50 -0000 1.4
+++ ConstructRegistry.java 1 Aug 2003 14:21:38 -0000 1.5
@@ -149,7 +149,7 @@
}
- protected DocumentBuilder getBuilder() throws ParserConfigurationException
+ private DocumentBuilder getBuilder() throws ParserConfigurationException
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
@@ -158,7 +158,7 @@
return factory.newDocumentBuilder();
}
- protected Document constructRegistry(File[] moduleDescriptors) throws BuildException
+ private Document constructRegistry(File[] moduleDescriptors) throws BuildException
{
try
{
@@ -232,7 +232,7 @@
return result;
}
- protected void writeDocument(Document document, File file) throws BuildException
+ private void writeDocument(Document document, File file) throws BuildException
{
try
{
@@ -251,7 +251,7 @@
}
}
- protected void prepareModuleForInclusion(Element module)
+ private void prepareModuleForInclusion(Element module)
{
NamedNodeMap attributes = module.getAttributes();
@@ -282,29 +282,18 @@
String name = e.getTagName();
if (name.equals("service") || name.equals("extension-point"))
- {
- String fullId = moduleId + "." + e.getAttribute("id");
+ qualify(moduleId, e, "id");
- e.setAttribute("id", fullId);
- }
+ // Expand local ids to fully qualified ids in extension and extend-service
- // Expand local ids to fully qualified ids in extension and extend-service
-
if (name.equals("extension"))
- {
- String id = e.getAttribute("point-id");
-
- if (id.indexOf('.') <= 0)
- e.setAttribute("point-id", moduleId + "." + id);
- }
+ qualify(moduleId, e, "point-id");
if (name.equals("extend-service"))
- {
- String id = e.getAttribute("service-id");
+ qualify(moduleId, e, "service-id");
- if (id.indexOf('.') <= 0)
- e.setAttribute("service-id", moduleId + "." + id);
- }
+ if (name.equals("service") || name.equals("extend-service"))
+ qualifyServiceIds(moduleId, e);
}
@@ -312,17 +301,43 @@
}
}
- protected void writeDocument(Document document, OutputStream out) throws IOException
+ private void qualify(String moduleId, Element element, String attributeName)
{
- XMLSerializer serializer = new XMLSerializer(out, new OutputFormat(document, null, true));
+ String id = element.getAttribute(attributeName);
+
+ if (id.indexOf('.') < 0)
+ element.setAttribute(attributeName, moduleId + "." + id);
+ }
+
+ private void qualifyServiceIds(String moduleId, Element element)
+ {
+ Node node = element.getFirstChild();
+
+ while (node != null)
+ {
+ if (node instanceof Element)
+ {
+ Element e = (Element) node;
+ String name = e.getTagName();
+
+ if (name.equals("invoke-factory") || name.equals("interceptor"))
+ qualify(moduleId, e, "service-id");
+ }
+
+ node = node.getNextSibling();
+ }
+ }
+
+ private void writeDocument(Document document, OutputStream out) throws IOException
+ {
+ XMLSerializer serializer = new XMLSerializer(out, new OutputFormat(document, null, true));
serializer.serialize(document);
}
public Path createDescriptors()
{
_descriptorsPath = new Path(project);
-
return _descriptorsPath;
}
1.11 +191 -366 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.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- hivemind.xsl 9 Jul 2003 18:55:45 -0000 1.10
+++ hivemind.xsl 1 Aug 2003 14:21:38 -0000 1.11
@@ -43,14 +43,14 @@
<table class="summary">
<tr>
- <th class="subhead">Configuration Extension Points</th>
- <th class="subhead">Service Extension Points</th>
+ <th class="subhead">Extension Points</th>
+ <th class="subhead">Services</th>
</tr>
<tr>
<td>
- <xsl:for-each select="/registry/module/configuration">
+ <xsl:for-each select="/registry/module/extension-point">
<xsl:sort select="@id"/>
<xsl:apply-templates select="." mode="link"/>
@@ -103,15 +103,6 @@
<xsl:value-of select="@version"/>
</td>
</tr>
- <tr>
- <th>Class</th>
- <td colspan="2">
- <xsl:if test="not(@class)">
- <span class="missing">default</span>
- </xsl:if>
- <xsl:value-of select="@class"/>
- </td>
- </tr>
<xsl:if test="description">
<tr>
<td class="description" colspan="3">
@@ -119,6 +110,10 @@
</td>
</tr>
</xsl:if>
+
+ <!-- Dependencies are not yet back into the picture, but
+ we'll just leave this in place for the meantime. -->
+
<xsl:if test="count(dependency)">
<tr>
<th>Dependencies</th>
@@ -143,38 +138,19 @@
</tr>
</xsl:for-each>
</xsl:if>
- <xsl:for-each select="meta">
- <xsl:sort select="@key"/>
- <xsl:if test="position() = 1">
- <tr>
- <th>Meta Data</th>
- <th class="subhead">Key</th>
- <th class="subhead">Value</th>
- </tr>
- </xsl:if>
- <tr>
- <th/>
- <td>
- <xsl:value-of select="@key"/>
- </td>
- <td>
- <xsl:value-of select="@value"/>
- </td>
- </tr>
- </xsl:for-each>
</tbody>
</table>
- <xsl:apply-templates select="configuration">
+ <xsl:apply-templates select="extension-point">
<xsl:sort select="@id"/>
</xsl:apply-templates>
<xsl:apply-templates select="service">
<xsl:sort select="@id"/>
</xsl:apply-templates>
- <xsl:apply-templates select="contribute-configuration">
- <xsl:sort select="@configuration-id"/>
+ <xsl:apply-templates select="extension">
+ <xsl:sort select="@point-id"/>
</xsl:apply-templates>
- <xsl:apply-templates select="contribute-service">
+ <xsl:apply-templates select="extend-service">
<xsl:sort select="@service-id"/>
</xsl:apply-templates>
@@ -189,51 +165,25 @@
</xsl:template>
- <xsl:template match="configuration" mode="link">
+ <xsl:template match="extension-point" mode="link">
<a href="{../@id}.html#{@uid}"><xsl:value-of select="@id"/></a>
</xsl:template>
- <xsl:template match="configuration">
+ <xsl:template match="extension-point">
+ <a name="extension-point:{@id}"/>
<h2 id="{@uid}">
- Configuration <xsl:value-of select="@id"/> </h2>
+ Extension Point <xsl:value-of select="@id"/> </h2>
<table class="summary">
<tbody>
<tr>
- <th>Element Type</th>
- <td>
- <xsl:value-of select="@element-type"/>
- </td>
- </tr>
- <xsl:if test="@element-class">
- <tr>
- <th>Element Class</th>
- <td><xsl:value-of select="@element-class"/></td>
- </tr>
- </xsl:if>
- <xsl:if test="@factory-id">
- <tr>
- <th>Element Factory Id</th>
- <td>
- <xsl:apply-templates select="/registry/module/service[@id = current()/@factory-id]" mode="link"/>
- </td>
- </tr>
- </xsl:if>
- <tr>
<th>Expected Count</th>
<td>
<xsl:if test="not(@count)">unbounded</xsl:if>
<xsl:value-of select="@count"/>
</td>
</tr>
- <tr>
- <th>Cached</th>
- <td>
- <xsl:if test="not(@cache-elements)">true</xsl:if>
- <xsl:value-of select="@cache-elements"/>
- </td>
- </tr>
<xsl:if test="description">
<tr>
<td colspan="2" class="description">
@@ -243,17 +193,12 @@
</xsl:if>
</tbody>
</table>
- <xsl:if test="*[local-name() != 'description']">
- <h3>Internal Contributions</h3>
- <ul>
- <xsl:apply-templates/>
- </ul>
- </xsl:if>
+ <xsl:apply-templates select="schema"/>
- <xsl:for-each select="/registry/module/contribute-configuration[@configuration-id = current()/@id]">
+ <xsl:for-each select="/registry/module/extension[@point-id = current()/@id]">
<xsl:sort select="../@id"/>
- <h3>Contributions from Module
+ <h3>Extensions from module
<a href="{../@id}.html#{@uid}">
<xsl:value-of select="../@id"/>
@@ -261,7 +206,7 @@
</h3>
<ul>
- <xsl:apply-templates select="*"/>
+ <xsl:apply-templates select="*" mode="raw"/>
</ul>
</xsl:for-each>
@@ -269,16 +214,131 @@
</xsl:template>
- <xsl:template match="contribute-configuration">
+ <xsl:template match="schema">
+
+ <h3>Schema</h3>
+
+ <table class="summary">
+ <tbody>
+
+ <xsl:apply-templates/>
+
+ </tbody>
+ </table>
+
+ </xsl:template>
+
+ <xsl:template match="parameters-schema">
+
+ <h3>Parameters Schema</h3>
+
+ <table class="summary">
+ <tbody>
+
+ <xsl:apply-templates/>
+
+ </tbody>
+ </table>
+
+ </xsl:template>
+
+
+ <xsl:template match="element">
+
+ <tr>
+ <th class="section-id" colspan="3">Element <<xsl:value-of select="@name"/>></th>
+
+ </tr>
+
+ <xsl:if test="description">
+ <tr>
+ <td colspan="3" class="description">
+ <xsl:value-of select="description"/>
+ </td>
+ </tr>
+ </xsl:if>
+
+ <xsl:for-each select="attribute">
+ <xsl:sort select="name"/>
+
+ <xsl:apply-templates select="."/>
+
+ </xsl:for-each>
+
+ <xsl:if test="rules">
+ <tr>
+ <td/>
+
+ <td colspan="2">
+ <h3>Rules</h3>
+
+ <ul>
+ <xsl:apply-templates select="rules/*" mode="raw"/>
+ </ul>
+
+ </td>
+
+ </tr>
+
+
+ </xsl:if>
+
+ <xsl:if test="element">
+
+ <tr>
+ <td/>
+ <td colspan="2">
+ <table class="summary">
+ <tbody>
+
+ <xsl:apply-templates select="element"/>
+
+ </tbody>
+ </table>
+ </td>
+ </tr>
+
+ </xsl:if>
+
+ </xsl:template>
+
+ <xsl:template match="attribute">
+
+ <tr>
+ <td/>
+ <td>Attribute <xsl:value-of select="@name"/></td>
+ <td>
+ <xsl:choose>
+ <xsl:when test="@required = 'true'">
+ Required
+ </xsl:when>
+ <xsl:otherwise>
+ Optional
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+
+ <xsl:if test="description">
+ <tr>
+ <td/>
+ <td colspan="2" class="description">
+ <xsl:value-of select="description"/>
+ </td>
+ </tr>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="extension">
<h2> <xsl:attribute name="id"><xsl:value-of select="@uid"/></xsl:attribute>
- Contribute Configuration
+ Extension
- <xsl:apply-templates select="/registry/module/configuration[@id = current()/@configuration-id]" mode="link"/>
+ <xsl:apply-templates select="/registry/module/extension-point[@id = current()/@point-id]" mode="link"/>
</h2>
<ul>
- <xsl:apply-templates/>
+ <xsl:apply-templates mode="raw"/>
</ul>
</xsl:template>
@@ -289,6 +349,7 @@
</xsl:template>
<xsl:template match="service">
+ <a name="service:{@id}"/>
<h2 id="{@uid}">
Service <xsl:value-of select="@id"/> </h2>
<table class="summary">
@@ -322,33 +383,39 @@
</xsl:if>
</tbody>
</table>
- <xsl:if test="*[local-name() != 'description']">
- <h3>Internal Contributions</h3>
+
+ <xsl:apply-templates select="parameters-schema"/>
+
+ <xsl:if test="create-instance|invoke-factory|interceptor">
+
+ <h3>Internal Contributions</h3>
+
<ul>
- <xsl:apply-templates/>
+ <xsl:apply-templates select="create-instance|invoke-factory|interceptor"/>
</ul>
</xsl:if>
+
- <xsl:for-each select="/registry/module/contribute-service[@service-id = current()/@id]">
+ <xsl:for-each select="/registry/module/extend-service[@service-id = current()/@id]">
<xsl:sort select="../@id"/>
- <h3>Contributions from Module
+ <h3>Extensions from module
<a href="{../@id}.html#{@uid}">
<xsl:value-of select="../@id"/>
</a>
</h3>
<ul>
- <xsl:apply-templates select="*"/>
+ <xsl:apply-templates/>
</ul>
</xsl:for-each>
</xsl:template>
- <xsl:template match="contribute-service">
+ <xsl:template match="extend-service">
<h2> <xsl:attribute name="id"><xsl:value-of select="@uid"/></xsl:attribute>
- Contribute Service
+ Service Extension
<xsl:apply-templates select="/registry/module/service[@id = current()/@service-id]" mode="link"/>
@@ -358,165 +425,25 @@
</ul>
</xsl:template>
- <xsl:template match="description">
- <!-- Ignore, matched in places we'd rather not. -->
- </xsl:template>
-
- <xsl:template match="expression">
- <li>
- <span class="tag"><expression></span>
- <span class="expression">
- <xsl:value-of select="."/>
- </span>
- <span class="tag"></expression></span>
- </li>
- </xsl:template>
-
- <xsl:template match="value">
- <li>
- <span class="tag"><value></span>
- <span class="literal">
- <xsl:value-of select="."/>
- </span>
- <span class="tag"></value></span>
- </li>
- </xsl:template>
-
- <xsl:template match="service-ref">
- <li>
- <span class="tag"><service-ref</span>
- <span class="attribute"> service-id</span>="<xsl:apply-templates select="/registry/module/service[@id = current()/@service-id]" mode="link"/>"
- <span class="tag">/></span>
- </li>
- </xsl:template>
-
- <xsl:template match="xml">
- <li>
- <span class="tag"><xml</span>
- <span class="attribute"> path</span>="<xsl:value-of select="@path"/>"
- <span class="tag">/></span>
- </li>
- </xsl:template>
-
- <xsl:template match="set-xml">
- <li>
- <span class="tag"><set-xml</span>
- <span class="attribute"> property</span>="<xsl:value-of select="@property"/>"
- <span class="attribute"> path</span>="<xsl:value-of select="@path"/>"
- <span class="tag">/></span>
- </li>
- </xsl:template>
-
<xsl:template match="create-instance">
<li>
- <span class="tag"><create-instance</span>
+ <span class="tag"><create-instance</span>
<span class="attribute"> class</span>="<xsl:value-of select="@class"/>"
-
- <xsl:choose>
- <xsl:when test="*">
- <span class="tag">></span>
- <ul>
- <xsl:apply-templates/>
- </ul>
- <span class="tag"></create-instance></span>
- </xsl:when>
- <xsl:otherwise>
- <span class="tag">/></span>
- </xsl:otherwise>
- </xsl:choose>
- </li>
- </xsl:template>
-
- <xsl:template match="set-create">
- <li>
- <span class="tag"><set-create</span>
- <span class="attribute"> property</span>="<xsl:value-of select="@property"/>"
- <span class="attribute">class</span>="<xsl:value-of select="@class"/>"
- <xsl:choose>
- <xsl:when test="*">
- <span class="tag">></span>
- <ul>
- <xsl:apply-templates/>
- </ul>
- <span class="tag"></set-create></span>
- </xsl:when>
- <xsl:otherwise>
- <span class="tag">/></span>
- </xsl:otherwise>
- </xsl:choose>
- </li>
- </xsl:template>
-
-
- <xsl:template match="factory">
- <li>
- <span class="tag"><factory</span>
- <span class="attribute"> service-id</span>="<xsl:apply-templates select="/registry/module/service[@id = current()/@service-id]" mode="link"/>"
-
- <xsl:choose>
- <xsl:when test="*">
- <span class="tag">></span>
- <ul>
- <xsl:apply-templates/>
- </ul>
- <span class="tag"></factory></span>
- </xsl:when>
- <xsl:otherwise>
- <span class="tag">/></span>
- </xsl:otherwise>
- </xsl:choose>
- </li>
+ <span class="tag">/></span>
+ </li>
</xsl:template>
- <xsl:template match="service-factory">
+ <xsl:template match="invoke-factory">
<li>
- <span class="tag"><service-factory</span>
+ <span class="tag"><invoke-factory</span>
<span class="attribute"> service-id</span>="<xsl:apply-templates select="/registry/module/service[@id = current()/@service-id]" mode="link"/>"
-
- <xsl:choose>
- <xsl:when test="*">
- <span class="tag">></span>
- <ul>
- <xsl:apply-templates/>
- </ul>
- <span class="tag"></service-factory></span>
- </xsl:when>
- <xsl:otherwise>
- <span class="tag">/></span>
- </xsl:otherwise>
- </xsl:choose>
- </li>
- </xsl:template>
-
- <xsl:template match="parameters">
- <li>
- <span class="tag"><parameters></span>
- <ul>
- <xsl:apply-templates/>
- </ul>
- <span class="tag"></parameters></span>
- </li>
- </xsl:template>
-
- <xsl:template match="set-factory">
- <li>
- <span class="tag"><set-factory</span>
- <span class="attribute"> property</span>="<xsl:value-of select="@property"/>"
- <span class="attribute"> service-id</span>="<xsl:apply-templates select="/registry/module/service[@id = current()/@service-id]" mode="link"/>"
-
- <xsl:choose>
- <xsl:when test="*">
- <span class="tag">></span>
- <ul>
- <xsl:apply-templates/>
- </ul>
- <span class="tag"></set-factory></span>
- </xsl:when>
- <xsl:otherwise>
- <span class="tag">/></span>
- </xsl:otherwise>
- </xsl:choose>
- </li>
+ <xsl:if test="*">
+ <ul>
+ <xsl:apply-templates mode="raw"/>
+ </ul>
+ </xsl:if>
+ <span class="tag"></invoke-factory></span>
+ </li>
</xsl:template>
<xsl:template match="interceptor">
@@ -530,135 +457,33 @@
<span class="tag">/></span> </li>
</xsl:template>
-
- <xsl:template match="set-expression">
- <li>
- <span class="tag"><set-expression</span>
- <span class="attribute"> property</span>="<xsl:value-of select="@property"/>"
-
- <xsl:if test="@expression">
- <span class="attribute"> expression</span>="<span class="expression"><xsl:value-of select="@expression"/></span>"
- </xsl:if>
-
- <xsl:choose>
- <xsl:when test="normalize-space()">
- <span class="tag">></span>
- <span class="expression"><xsl:value-of select="."/></span>
- <span class="tag"></set-expression></span>
- </xsl:when>
- <xsl:otherwise>
- <span class="tag">/></span>
- </xsl:otherwise>
- </xsl:choose>
- </li>
- </xsl:template>
-
- <xsl:template match="set">
- <li>
- <span class="tag"><set</span>
- <span class="attribute"> property</span>="<xsl:value-of select="@property"/>"
-
- <xsl:if test="@value">
- <span class="attribute">value</span>="<span class="literal"><xsl:value-of select="@value"/></span>"
- </xsl:if>
-
- <xsl:choose>
- <xsl:when test="normalize-space()">
- <span class="tag">></span>
- <span class="literal"><xsl:value-of select="."/></span>
- <span class="tag"></set></span>
- </xsl:when>
- <xsl:otherwise>
- <span class="tag">/></span>
- </xsl:otherwise>
- </xsl:choose>
- </li>
- </xsl:template>
-
- <xsl:template match="set-service-ref">
- <li>
- <span class="tag"><set-service-ref</span>
- <span class="attribute"> property</span>="<xsl:value-of select="@property"/>"
- <span class="attribute"> service-id</span>="<xsl:apply-templates select="/registry/module/service[@id = current()/@service-id]" mode="link"/>"
- <span class="tag">/></span>
- </li>
- </xsl:template>
-
- <xsl:template match="new">
+
+ <xsl:template match="*" mode="raw">
<li>
- <span class="tag"><new</span>
-
- <xsl:choose>
- <xsl:when test="*">
- <span class="tag">></span>
- <ul>
- <xsl:apply-templates/>
- </ul>
- <span class="tag"></new></span>
- </xsl:when>
- <xsl:otherwise>
- <span class="tag">/></span>
- </xsl:otherwise>
- </xsl:choose>
+ <span class="tag"><<xsl:value-of select="name()"/></span>
+ <xsl:for-each select="@*" xml:space="preserve">
+ <span class="attribute"> <xsl:value-of select="name()"/></span>="<xsl:value-of select="."/>"
+ </xsl:for-each>
+ <xsl:choose>
+ <xsl:when test="*">
+ <span class="tag">></span>
+ <ul>
+ <xsl:apply-templates/>
+ </ul>
+ <span class="tag"></<xsl:value-of select="name()"/>></span>
+ </xsl:when>
+ <xsl:when test="normalize-space()">
+ <span class="tag">></span>
+ <xsl:value-of select="."/>
+ <span class="tag"></<xsl:value-of select="name()"/>></span>
+ </xsl:when>
+ <xsl:otherwise>
+ <span class="tag">/></span>
+ </xsl:otherwise>
+ </xsl:choose>
</li>
- </xsl:template>
-
- <xsl:template match="resource">
- <li>
- <span class="tag"><resource</span>
- <span class="attribute"> path</span>"<xsl:value-of select="@path"/>
- <span class="tag">/></span>
- </li>
- </xsl:template>
-
- <xsl:template match="set-resource">
- <li>
- <span class="tag"><set-resource</span>
- <span class="attribute"> property</span>="<xsl:value-of select="@property"/>"
- <span class="attribute"> path</span>"<xsl:value-of select="@path"/>
- <span class="tag">/></span>
- </li>
- </xsl:template>
-
- <xsl:template match="message">
- <li>
- <span class="tag"><message</span>
- <span class="attribute"> key</span>="<xsl:value-of select="@key"/>"
-
- <xsl:choose>
- <xsl:when test="*">
- <span class="tag">></span>
- <ul>
- <xsl:apply-templates/>
- </ul>
- <span class="tag"></message></span>
- </xsl:when>
- <xsl:otherwise>
- <span class="tag">/></span>
- </xsl:otherwise>
- </xsl:choose>
- </li>
+
</xsl:template>
- <xsl:template match="set-message">
- <li>
- <span class="tag"><set-message</span>
- <span class="attribute"> property</span>="<xsl:value-of select="@property"/>"
- <span class="attribute"> key</span>="<xsl:value-of select="@key"/>"
-
- <xsl:choose>
- <xsl:when test="*">
- <span class="tag">></span>
- <ul>
- <xsl:apply-templates/>
- </ul>
- <span class="tag"></set-message></span>
- </xsl:when>
- <xsl:otherwise>
- <span class="tag">/></span>
- </xsl:otherwise>
- </xsl:choose>
- </li>
- </xsl:template>
-
+
</xsl:stylesheet>
1.3 +5 -5 jakarta-commons-sandbox/hivemind/src/xsl/hivemind.css
Index: hivemind.css
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/xsl/hivemind.css,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- hivemind.css 9 Jul 2003 18:55:45 -0000 1.2
+++ hivemind.css 1 Aug 2003 14:21:38 -0000 1.3
@@ -46,6 +46,11 @@
text-align: center;
}
+TABLE.summary TH.section-id
+{
+ text-align: left;
+}
+
LI
{
list-style-type: none;
@@ -73,8 +78,3 @@
{
font-family: monospace;
}
-
-SPAN.expression
-{
- font-style: italic;
-}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org