From hlship@apache.org Fri Aug 1 14:21:34 2003 Return-Path: Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 51954 invoked by uid 500); 1 Aug 2003 14:21:34 -0000 Received: (qmail 51951 invoked from network); 1 Aug 2003 14:21:34 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 1 Aug 2003 14:21:34 -0000 Received: (qmail 9236 invoked by uid 1616); 1 Aug 2003 14:21:38 -0000 Date: 1 Aug 2003 14:21:38 -0000 Message-ID: <20030801142138.9235.qmail@minotaur.apache.org> From: hlship@apache.org To: jakarta-commons-sandbox-cvs@apache.org Subject: cvs commit: jakarta-commons-sandbox/hivemind/src/xsl hivemind.xsl hivemind.css X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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 : elements are now always cached Fix ConstructRegistry to expand local ids to qualified ids in the service-id attribute of and . 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
  • 0..1: optional
  • 1 : required
  • 1..n: at least one
  • - - cache-elements - boolean - no - 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. - 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 Registry.getExtensionPointElements() for that extension point.

    -

    -In most cases, the element list is retained for future invocations of getExtensionPointElements(). -This is controlled by the cache-elements attribute of the &extension-point; element. Set -cache-elements to false for configuration extension points that will be read just once. -

    -
    @@ -156,12 +150,11 @@

    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: -hivemind.SymbolSource. Contributions to this extension point +hivemind.SymbolSource. 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.

    -

    TODO: Add link to generated master-module docs here. - -

    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.

    + @@ -199,7 +199,7 @@

    That's what we meant by a POJO. We'll create a second module to provide this implementation.

    + @@ -213,7 +213,7 @@ ]]>

    Another module may provide an interceptor:

    + 1.1 jakarta-commons-sandbox/hivemind/src/test-data/TestConstructRegistry/testLocalRefs.xml Index: testLocalRefs.xml =================================================================== 1.1 jakarta-commons-sandbox/hivemind/src/test-data/TestConstructRegistry/LocalRefs.xml Index: LocalRefs.xml =================================================================== 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 @@ + + + 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 @@ - + Module for managing the application toolbar. - - Items which may appear on the toolbar. - - - - - - + + + + + + + + + + + + + + + + - + + + + + Service for accessing the toolbar. - + - - - - - - + + + - - - + + + Wrapper around the ToolBarDAO session EJB. - - - org.example.ejb.toolbar.ToolBarDAO - - + + + 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 @@ - + Contains the boostrap service used to startup the application. - + Provides a list of Runnable objects used to startup the application. - + + + + An object that may be run. + + + + The name of the class to instantiate, which must implement Runnable. + + + + + + + + + + The service which actually bootstraps the application. 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 @@ - - + + - - - - + + + @@ -143,38 +138,19 @@ - - - - - - - - - - - - - -
    Configuration Extension PointsService Extension PointsExtension PointsServices
    - + @@ -103,15 +103,6 @@
    Class - - default - - -
    @@ -119,6 +110,10 @@
    Dependencies
    Meta DataKeyValue
    - - - - -
    - + - - + + - + @@ -189,51 +165,25 @@ - + - + +

    - Configuration

    + Extension Point - - - - - - - - - - - - - - - - - - - -
    Element Type - -
    Element Class
    Element Factory Id - -
    Expected Count unbounded
    Cached - true - -
    @@ -243,17 +193,12 @@
    - -

    Internal Contributions

    -
      - -
    -
    + - + -

    Contributions from Module +

    Extensions from module @@ -261,7 +206,7 @@

      - +
    @@ -269,16 +214,131 @@
    - + + +

    Schema

    + + + + + + + +
    + +
    + + + +

    Parameters Schema

    + + + + + + + +
    + +
    + + + + + + Element <> + + + + + + + + + + + + + + + + + + + + + + + +

    Rules

    + +
      + +
    + + + + + + +
    + + + + + + + + + + + + +
    + + + +
    + +
    + + + + + + Attribute + + + + Required + + + Optional + + + + + + + + + + + + + + + +

    - Contribute Configuration + Extension - +

      - +
    @@ -289,6 +349,7 @@
    +

    Service

    @@ -322,33 +383,39 @@
    - -

    Internal Contributions

    + + + + + +

    Internal Contributions

    +
      - +
    + - + -

    Contributions from Module +

    Extensions from module

      - +
    - +

    - Contribute Service + Service Extension @@ -358,165 +425,25 @@ - - - - - -
  • - <expression> - - - - </expression> -
  • -
    - - -
  • - <value> - - - - </value> -
  • -
    - - -
  • - <service-ref - service-id="" - /> -
  • -
    - - -
  • - <xml - path="" - /> -
  • -
    - - -
  • - <set-xml - property="" - path="" - /> -
  • -
    -
  • - <create-instance + <create-instance class="" - - - - > -
      - -
    - </create-instance> -
    - - /> - -
    -
  • -
    - - -
  • - <set-create - property="" - class="" - - - > -
      - -
    - </set-create> -
    - - /> - -
    -
  • -
    - - - -
  • - <factory - service-id="" - - - - > -
      - -
    - </factory> -
    - - /> - -
    -
  • + /> +
    - +
  • - <service-factory + <invoke-factory service-id="" - - - - > -
      - -
    - </service-factory> -
    - - /> - -
    -
  • -
    - - -
  • - <parameters> -
      - -
    - </parameters> -
  • -
    - - -
  • - <set-factory - property="" - service-id="" - - - - > -
      - -
    - </set-factory> -
    - - /> - -
    -
  • + +
      + +
    +
    + </invoke-factory> +
    @@ -530,135 +457,33 @@ /> - - -
  • - <set-expression - property="" - - - expression="" - - - - - > - - </set-expression> - - - /> - - -
  • -
    - - -
  • - <set - property="" - - - value="" - - - - - > - - </set> - - - /> - - -
  • -
    - - -
  • - <set-service-ref - property="" - service-id="" - /> -
  • -
    - - + +
  • - <new - - - - > -
      - -
    - </new> -
    - - /> - -
    + < + + ="" + + + + > +
      + +
    + </> +
    + + > + + </> + + + /> + +
  • -
    - - -
  • - <resource - path" - /> -
  • -
    - - -
  • - <set-resource - property="" - path" - /> -
  • -
    - - -
  • - <message - key="" - - - - > -
      - -
    - </message> -
    - - /> - -
    -
  • +
    - -
  • - <set-message - property="" - key="" - - - - > -
      - -
    - </set-message> -
    - - /> - -
    -
  • -
    - + 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