Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 89233 invoked from network); 1 Jul 2003 20:13:15 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 1 Jul 2003 20:13:15 -0000 Received: (qmail 25925 invoked by uid 97); 1 Jul 2003 20:15:43 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@nagoya.betaversion.org Received: (qmail 25918 invoked from network); 1 Jul 2003 20:15:43 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 1 Jul 2003 20:15:43 -0000 Received: (qmail 88685 invoked by uid 500); 1 Jul 2003 20:13:09 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 88644 invoked by uid 500); 1 Jul 2003 20:13:07 -0000 Received: (qmail 88560 invoked from network); 1 Jul 2003 20:13:04 -0000 Received: from icarus.apache.org (208.185.179.13) by daedalus.apache.org with SMTP; 1 Jul 2003 20:13:04 -0000 Received: (qmail 80825 invoked by uid 1616); 1 Jul 2003 20:13:03 -0000 Date: 1 Jul 2003 20:13:03 -0000 Message-ID: <20030701201303.80824.qmail@icarus.apache.org> From: hlship@apache.org To: jakarta-commons-sandbox-cvs@apache.org Subject: cvs commit: jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/impl RegistryBuilder.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N hlship 2003/07/01 13:13:03 Modified: hivemind/xdocs descriptor.xml configuration.xml hivemind/src/java/org/apache/commons/hivemind/parse DescriptorParser.java HiveMind_1.0.xsd AbstractConfigurationDescriptor.java hivemind/src/test/hivemind/test/config TestConfiguration.java hivemind/common links.xml hivemind/src/xsl hivemind.xsl hivemind/src/java/org/apache/commons/hivemind HiveMindMessages.properties hivemind/src/java/org/apache/commons/hivemind/util URLResourceLocation.java hivemind/src/test/hivemind/test/parse TestDescriptorParser.java TestToString.java hivemind/src/java/org/apache/commons/hivemind/impl RegistryBuilder.java Added: hivemind/src/java/org/apache/commons/hivemind/parse ResourceDescriptor.java hivemind/src/test/hivemind/test/config SetResource.xml SetResourceMissing.xml ResourceElement.java hivemind/src/test/hivemind/test/parse Resource.xml SetResource.xml Log: Add support for and Revision Changes Path 1.10 +101 -181 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.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- descriptor.xml 30 Jun 2003 23:04:28 -0000 1.9 +++ descriptor.xml 1 Jul 2003 20:12:57 -0000 1.10 @@ -413,6 +413,15 @@ Element. The configuation extension point must also be type Element. + + + resource + + 0..n + Adds the location (as an instance of IResourceLocation) of a resource file. + + + create-instance @@ -455,68 +464,16 @@ yes The fully qualified id of the service extension point to contribute to. - - - Element - Count - Description - - - - expression - - 0..n - Evaluates an OGNL expression and adds the result as a contribution - to the extension point. - - - - value - - 0..n - Includes a literal value as a contribution to the extension point. - - - - service-ref - - 0..n - Obtains a service as a contribution to the extension point. - - - - xml - - 0..n. - Reads an XML file and assigns the root element, as an instance of - Element. The configuation extension point must also by type - Element. - - - - create-instance - - 0..n - Creates an element as a contribution to the extension point. - - - - factory - - 0..n - Uses a factory service to create an instance as a contribution to - the extension point. - - - - new - - 0..n - - Configures a new object, created by the extension point. - - - + + + +

+ &_contribute-configuration; accepts the same elements + as &configuration; (with the exception of &description;). +

+ + +

&_create-instance; instantiates an object from a class name, and then @@ -529,7 +486,7 @@ then the newly created object's location property is set to the location of the &_create-instance; element. Note: - This applies to &set-create;, &factory; and &set-factory; + This applies to &set-create;, &factory; and similar elements as well.

@@ -579,7 +536,15 @@ 0..n Sets a property of the object to the root element of a parsed XML - file. The property must be type Element. + file. + + + + + set-resource + + 0..n + Sets a property to the location of a resource file. @@ -699,52 +664,13 @@ - - set-expression - - 0..n - Evaluates an OGNL expression and assigns its value to a property - of the object - - - - set - - 0..n - Sets a property of the object to a literal value. - - - - set-service-ref - - 0..n - Sets a property of the object by looking up a service. - - - - set-xml - - 0..n - Sets a property of the object to the root element of a parsed XML - file. The property must be type Element. - - - - set-create + + The remaining elements are the same + as for &create-instance; - 0..n - Sets a property of the object to a newly created (and configured) - object. - - - - set-factory - - 0..n - Sets a property of the object to a newly created (and configured) - object obtained from a factory service. - + +
@@ -755,74 +681,11 @@

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AttributeTypeRequired ?Description
ElementCountDescription
- description - 0..1Description of this configuration extension point.
- expression - 0..nEvaluates an OGNL expression and adds the result as a contribution - to the extension point.
- value - 0..nIncludes a literal value as a contribution to the extension point.
- service-ref - 0..nObtains a service as a contribution to the extension point.
- xml - 0..n.Reads an XML file and assigns the root element, as an instance of - Element. The configuation extension point must also be type - Element.
- create-instance - 0..nCreates an element as a contribution to the extension point.
- factory - 0..nUses a factory service to create an instance as a contribution to - the extension point.
- + +

+ &_parameters; accepts the same elements as &configuration; +

+
@@ -864,7 +727,7 @@ to access the HiveMind repository).

- Variable references in the expression are expanded. + Symbol references in the expression are expanded.

@@ -900,7 +763,7 @@

- Variable references in the expression are expanded before the expression is evaluated. + Symbol references in the expression are expanded before the expression is evaluated.

@@ -909,7 +772,7 @@ type occur automatically.

The body of the &_value; element is the literal value to contribute.

- Variable references in the value are expanded. + Symbol references in the value are expanded.

@@ -943,7 +806,7 @@

- Variable references in the value are expanded. + Symbol references in the value are expanded.

@@ -1031,6 +894,63 @@ The path, relative to the contributing module's descriptor, of the XML file to read. The root element of the XML file, represented as an instance of Element, is assigned to the property. + + + + +
+ +
+ +

&_resource; contributes the location of a resource file as + an instance of IResourceLocation.

+ +

+ The referenced file must exist. +

+ + + + + + + + + + + + + +
AttributeTypeRequired ?Description
pathstringyesThe path, relative to the contributing module's descriptor, of the + resource file.
+
+
+

&_set-resource; updates a property of an object to the location + of a resource file (as an instance of + IResourceLocation).

+ +

+ The referenced file must exist. +

+ + + + + + + + + + + + + + + + + +
AttributeTypeRequired ?Description
propertystringyesThe name of the property to be updated.
pathstringyesThe path, relative to the contributing module's descriptor, of + resource file.
1.6 +3 -2 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.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- configuration.xml 30 Jun 2003 23:04:28 -0000 1.5 +++ configuration.xml 1 Jul 2003 20:12:57 -0000 1.6 @@ -57,6 +57,7 @@
  • Elements created by the extension point (&new;)
  • Parsed contents of XML files (&xml;)
  • References to HiveMind services (&service-ref;)
  • +
  • Locations of resource files (&resource;)
  • @@ -146,7 +147,7 @@

    HiveMind supports this notion through substitution symbols. These are references to values that are supplied at runtime. Substitution symbols can appear inside literal values and OGNL expressions (in -a module descriptor). In addition, when the &xml; element reads an external XML file, substitution variables +a module descriptor). In addition, when the &xml; element reads an external XML file, substitution symbols in attributes and inside element content are expanded.

    1.10 +18 -2 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.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- DescriptorParser.java 26 Jun 2003 20:31:25 -0000 1.9 +++ DescriptorParser.java 1 Jul 2003 20:13:01 -0000 1.10 @@ -182,7 +182,6 @@ // TBD: meta // TBD: dependency - // TBD: library pattern = "module/service"; @@ -315,6 +314,13 @@ result.addSetLimitedProperties(pattern, "path", "path"); result.addSetNext(pattern, "addProvider"); + pattern = "*/resource"; + + result.addObjectCreate(pattern, ResourceDescriptor.class); + result.addRule(pattern, setLocationRule); + result.addSetLimitedProperties(pattern, "path", "path"); + result.addSetNext(pattern, "addProvider"); + pattern = "*/new"; result.addObjectCreate(pattern, NewDescriptor.class); @@ -330,7 +336,17 @@ new String[] { "property", "path" }, new String[] { "propertyName", "path" }); result.addSetNext(pattern, "addConfigurator"); + + pattern = "*/set-resource"; + result.addObjectCreate(pattern, ResourceDescriptor.class); + result.addRule(pattern, setLocationRule); + result.addSetLimitedProperties( + pattern, + new String[] { "property", "path" }, + new String[] { "propertyName", "path" }); + result.addSetNext(pattern, "addConfigurator"); + pattern = "*/set-expression"; result.addObjectCreate(pattern, ExpressionDescriptor.class); 1.10 +30 -1 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.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- HiveMind_1.0.xsd 26 Jun 2003 20:31:25 -0000 1.9 +++ HiveMind_1.0.xsd 1 Jul 2003 20:13:01 -0000 1.10 @@ -242,6 +242,20 @@ + + + Assigns the location of a file as a property. + + + + + + The path of the file, relative to the + contributing module's descriptor. + + + + @@ -255,6 +269,7 @@ + @@ -471,6 +486,20 @@ Contributes the contents of an XML file. + + + + + The path of the XML file, relative to the + contributing module's module descriptor. + + + + + + + Contributes the location of an arbitrary file (relative + to the contributing module deployment descriptor). 1.7 +2 -2 jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/parse/AbstractConfigurationDescriptor.java Index: AbstractConfigurationDescriptor.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/parse/AbstractConfigurationDescriptor.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- AbstractConfigurationDescriptor.java 30 Jun 2003 23:04:58 -0000 1.6 +++ AbstractConfigurationDescriptor.java 1 Jul 2003 20:13:01 -0000 1.7 @@ -105,7 +105,7 @@ * null if this descriptor has no value providers. The caller * should not modify the returned list. */ - public List getElementProviders() + public List getProviders() { return _elementProviders; } 1.1 jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/parse/ResourceDescriptor.java Index: ResourceDescriptor.java =================================================================== /* * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 1999-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Commons", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . * */ package org.apache.commons.hivemind.parse; import org.apache.commons.hivemind.HiveMind; import org.apache.commons.hivemind.Module; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.tapestry.ApplicationRuntimeException; import org.apache.tapestry.IResourceLocation; /** * Descriptor for the <resource> and <set-resource> * elements. * * @author Howard Lewis Ship * @version $Id: ResourceDescriptor.java,v 1.1 2003/07/01 20:13:01 hlship Exp $ */ public class ResourceDescriptor extends AbstractConfigurator { private String _path; protected void extendDescription(ToStringBuilder builder) { builder.append("path", _path); } public void configure(Object object, Module module) { Object value = provideValue(module); configureProperty(object, value, module); } /** * Returns a location relative to the module's resource location. */ public Object provideValue(Module module) { IResourceLocation moduleLocation = module.getLocation().getResourceLocation(); IResourceLocation result = moduleLocation.getRelativeLocation(_path); if (result.getResourceURL() == null) throw new ApplicationRuntimeException( HiveMind.format( "ResourceDescriptor.missing-resource", _path, module.getModuleId(), moduleLocation)); return result; } public String getPath() { return _path; } public void setPath(String string) { _path = string; } } 1.11 +34 -0 jakarta-commons-sandbox/hivemind/src/test/hivemind/test/config/TestConfiguration.java Index: TestConfiguration.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/test/hivemind/test/config/TestConfiguration.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- TestConfiguration.java 30 Jun 2003 23:04:41 -0000 1.10 +++ TestConfiguration.java 1 Jul 2003 20:13:01 -0000 1.11 @@ -497,4 +497,38 @@ } + public void testSetResource() throws Exception + { + Registry r = buildRegistry("SetResource.xml"); + List l = r.getConfiguration("hivemind.test.config.Config"); + + assertEquals(1, l.size()); + + ResourceElement e = (ResourceElement) l.get(0); + + IResourceLocation expected = getLocation("Symbols.xml"); + + assertEquals(expected, e.getLocation()); + + } + + public void testSetResourceMissing() throws Exception + { + Registry r = buildRegistry("SetResourceMissing.xml"); + + try + { + + r.getConfiguration("hivemind.test.config.Config"); + + unreachable(); + } + catch (ApplicationRuntimeException ex) + { + Throwable t = findNestedException(ex); + + checkException(t, "Resource Xyzzyx relative to module hivemind.test.config"); + } + + } } 1.1 jakarta-commons-sandbox/hivemind/src/test/hivemind/test/config/SetResource.xml Index: SetResource.xml =================================================================== 1.1 jakarta-commons-sandbox/hivemind/src/test/hivemind/test/config/SetResourceMissing.xml Index: SetResourceMissing.xml =================================================================== 1.1 jakarta-commons-sandbox/hivemind/src/test/hivemind/test/config/ResourceElement.java Index: ResourceElement.java =================================================================== /* * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 1999-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Commons", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . * */ package hivemind.test.config; import org.apache.tapestry.IResourceLocation; /** * Used to test the <set-resource> descriptor element. * * @author Howard Lewis Ship * @version $Id: ResourceElement.java,v 1.1 2003/07/01 20:13:01 hlship Exp $ */ public class ResourceElement { private IResourceLocation _location; public IResourceLocation getLocation() { return _location; } public void setLocation(IResourceLocation location) { _location = location; } } 1.8 +8 -2 jakarta-commons-sandbox/hivemind/common/links.xml Index: links.xml =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/common/links.xml,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- links.xml 26 Jun 2003 20:31:27 -0000 1.7 +++ links.xml 1 Jul 2003 20:13:02 -0000 1.8 @@ -74,4 +74,10 @@ &_new;'> <parameters>'> -&_parameters;'> \ No newline at end of file +&_parameters;'> + +<resource>'> +&_resource;'> + +<set-resource>'> +&_set-resource;'> \ No newline at end of file 1.7 +17 -0 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.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- hivemind.xsl 26 Jun 2003 20:31:27 -0000 1.6 +++ hivemind.xsl 1 Jul 2003 20:13:02 -0000 1.7 @@ -564,4 +564,21 @@ + +
  • + <resource + path" + /> +
  • +
    + + +
  • + <set-resource + property="" + path" + /> +
  • +
    + 1.8 +3 -1 jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/HiveMindMessages.properties Index: HiveMindMessages.properties =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/HiveMindMessages.properties,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- HiveMindMessages.properties 26 Jun 2003 20:31:29 -0000 1.7 +++ HiveMindMessages.properties 1 Jul 2003 20:13:02 -0000 1.8 @@ -68,6 +68,8 @@ XMLDescriptor.unable-to-parse=Unable to parse {0} (referenced at {1}): {2} +ResourceDescriptor.missing-resource=Resource {0} relative to module {1} ({2}) not found. + # service.impl package RemoteExceptionCoordinator.method-while-locked=RemoteExceptionCoordinator method {0} was invoked during a notification. 1.4 +16 -2 jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/util/URLResourceLocation.java Index: URLResourceLocation.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/util/URLResourceLocation.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- URLResourceLocation.java 4 Jun 2003 23:52:50 -0000 1.3 +++ URLResourceLocation.java 1 Jul 2003 20:13:02 -0000 1.4 @@ -57,6 +57,8 @@ package org.apache.commons.hivemind.util; +import java.io.IOException; +import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import java.util.Locale; @@ -104,12 +106,24 @@ { try { - _url = new URL(getPath()); + URL test = new URL(getPath()); + + InputStream stream = test.openStream(); + + stream.close(); + + _url = test; } catch (MalformedURLException ex) { throw new ApplicationRuntimeException(ex); } + catch (IOException ex) + { + // If the resource can't be opened, + // then return null. + } + } return _url; 1.10 +43 -8 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.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- TestDescriptorParser.java 1 Jul 2003 11:28:53 -0000 1.9 +++ TestDescriptorParser.java 1 Jul 2003 20:13:02 -0000 1.10 @@ -66,6 +66,7 @@ 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.DescriptorParser; import org.apache.commons.hivemind.parse.ExpressionDescriptor; import org.apache.commons.hivemind.parse.FactoryDescriptor; import org.apache.commons.hivemind.parse.InstanceBuilder; @@ -73,6 +74,7 @@ import org.apache.commons.hivemind.parse.ModuleDescriptor; import org.apache.commons.hivemind.parse.NewDescriptor; import org.apache.commons.hivemind.parse.ParametersDescriptor; +import org.apache.commons.hivemind.parse.ResourceDescriptor; import org.apache.commons.hivemind.parse.ServiceDescriptor; import org.apache.commons.hivemind.parse.ServiceRefDescriptor; import org.apache.commons.hivemind.parse.ValueDescriptor; @@ -305,7 +307,7 @@ ModuleDescriptor d = parse("Configuration.xml"); ConfigurationDescriptor cd = d.getConfiguration("Blat"); - List l = cd.getElementProviders(); + List l = cd.getProviders(); assertEquals(4, Tapestry.size(l)); ValueDescriptor vd = (ValueDescriptor) l.get(0); @@ -330,7 +332,7 @@ ModuleDescriptor d = parse("ContributeConfiguration.xml"); ContributeConfigurationDescriptor cd = d.getConfigurationContribution("foo.bar.Blat"); - List l = cd.getElementProviders(); + List l = cd.getProviders(); assertEquals(4, Tapestry.size(l)); ValueDescriptor vd = (ValueDescriptor) l.get(0); @@ -397,7 +399,7 @@ ModuleDescriptor md = parse("ServiceRef.xml"); ConfigurationDescriptor cd = md.getConfiguration("Blat"); - List l = cd.getElementProviders(); + List l = cd.getProviders(); assertEquals(1, l.size()); ServiceRefDescriptor d = (ServiceRefDescriptor) l.get(0); @@ -410,7 +412,7 @@ ModuleDescriptor md = parse("SetServiceRef.xml"); ConfigurationDescriptor cd = md.getConfiguration("Blat"); - List l = cd.getElementProviders(); + List l = cd.getProviders(); assertEquals(1, l.size()); CreateInstanceDescriptor cid = (CreateInstanceDescriptor) l.get(0); @@ -431,7 +433,7 @@ ModuleDescriptor md = parse("ContributeXML.xml"); ContributeConfigurationDescriptor cd = md.getConfigurationContribution("foo.bar.Blat"); - List l = cd.getElementProviders(); + List l = cd.getProviders(); assertEquals(1, l.size()); XMLDescriptor xd = (XMLDescriptor) l.get(0); @@ -444,7 +446,7 @@ ModuleDescriptor md = parse("ContributeSetXML.xml"); ContributeConfigurationDescriptor cd = md.getConfigurationContribution("foo.bar.Blat"); - List l = cd.getElementProviders(); + List l = cd.getProviders(); assertEquals(1, l.size()); CreateInstanceDescriptor cid = (CreateInstanceDescriptor) l.get(0); @@ -524,7 +526,7 @@ ModuleDescriptor d = parse("ConfigurationNew.xml"); ConfigurationDescriptor cd = d.getConfiguration("Blat"); - List l = cd.getElementProviders(); + List l = cd.getProviders(); assertEquals(1, l.size()); NewDescriptor nd = (NewDescriptor) l.get(0); @@ -541,6 +543,7 @@ public void testContributeFactoryParameters() throws Exception { ModuleDescriptor d; + try { @@ -574,4 +577,36 @@ assertEquals("blat", vd.getValue()); } + + public void testResource() throws Exception + { + ModuleDescriptor d = parse("Resource.xml"); + ConfigurationDescriptor cd = d.getConfiguration("Resource"); + + List l = cd.getProviders(); + assertEquals(1, l.size()); + + ResourceDescriptor rd = (ResourceDescriptor) l.get(0); + + assertEquals("foo/bar.baz", rd.getPath()); + } + + public void testSetResource() throws Exception + { + ModuleDescriptor d = parse("SetResource.xml"); + ConfigurationDescriptor cd = d.getConfiguration("Resource"); + + List l = cd.getProviders(); + assertEquals(1, l.size()); + + NewDescriptor nd = (NewDescriptor) l.get(0); + + l = nd.getConfigurators(); + assertEquals(1, l.size()); + + ResourceDescriptor rd = (ResourceDescriptor) l.get(0); + + assertEquals("foo", rd.getPropertyName()); + assertEquals("biff.blat", rd.getPath()); + } } 1.6 +3 -1 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.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- TestToString.java 1 Jul 2003 11:28:53 -0000 1.5 +++ TestToString.java 1 Jul 2003 20:13:02 -0000 1.6 @@ -77,6 +77,7 @@ import org.apache.commons.hivemind.parse.InterceptorDescriptor; import org.apache.commons.hivemind.parse.ModuleDescriptor; import org.apache.commons.hivemind.parse.ParametersDescriptor; +import org.apache.commons.hivemind.parse.ResourceDescriptor; import org.apache.commons.hivemind.parse.ServiceDescriptor; import org.apache.commons.hivemind.parse.ServiceRefDescriptor; import org.apache.commons.hivemind.parse.ValueDescriptor; @@ -112,6 +113,7 @@ new XMLDescriptor().toString(); new InterceptorDescriptor().toString(); new ParametersDescriptor().toString(); + new ResourceDescriptor().toString(); new FactoryContributionImpl().toString(); new BaseModule().toString(); 1.1 jakarta-commons-sandbox/hivemind/src/test/hivemind/test/parse/Resource.xml Index: Resource.xml =================================================================== 1.1 jakarta-commons-sandbox/hivemind/src/test/hivemind/test/parse/SetResource.xml Index: SetResource.xml =================================================================== 1.9 +3 -3 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.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- RegistryBuilder.java 30 Jun 2003 23:04:29 -0000 1.8 +++ RegistryBuilder.java 1 Jul 2003 20:13:03 -0000 1.9 @@ -302,7 +302,7 @@ _configurationPoints.put(pointId, point); - addConfigurationContributions(module, point, cd.getElementProviders()); + addConfigurationContributions(module, point, cd.getProviders()); } } @@ -472,7 +472,7 @@ continue; } - addConfigurationContributions(sourceModule, point, cd.getElementProviders()); + addConfigurationContributions(sourceModule, point, cd.getProviders()); } } --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org