hlship 2004/02/29 17:08:03
Modified: hivemind/framework/src/test/hivemind/test/config
TestConfigurationPoint.java
hivemind/xdocs descriptor.xml rules.xml
hivemind/framework/src/java/org/apache/hivemind/schema/rules
InvokeParentRule.java SetParentRule.java
ReadAttributeRule.java
hivemind/framework/src/test/hivemind/test/rules
TestObjectTranslator.java
hivemind/framework/src/descriptor/META-INF hivemodule.xml
hivemind/common links.xml
hivemind/src/xsl hivemind.xsl
hivemind/library/src/descriptor/META-INF hivemodule.xml
hivemind/framework/src/java/org/apache/hivemind
HiveMindMessages.properties
Added: hivemind/framework/src/test/hivemind/test/config Basics.xml
ExtraAttributeNames.xml DataItem.java
TestConversion.java Basics2.xml
hivemind/framework/src/java/org/apache/hivemind/parse
ConversionDescriptor.java
AttributeMappingDescriptor.java
Log:
Add <conversion> and <map> elements to the module deployment descriptor, as a
simpler alternative to the existing <rules> element.
Revision Changes Path
1.9 +2 -3
jakarta-commons-sandbox/hivemind/framework/src/test/hivemind/test/config/TestConfigurationPoint.java
Index: TestConfigurationPoint.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/hivemind/framework/src/test/hivemind/test/config/TestConfigurationPoint.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- TestConfigurationPoint.java 29 Feb 2004 20:57:09 -0000 1.8
+++ TestConfigurationPoint.java 1 Mar 2004 01:08:02 -0000 1.9
@@ -27,7 +27,6 @@
import java.util.List;
import java.util.Locale;
-import org.apache.hivemind.util.ClasspathResource;
import org.apache.hivemind.ApplicationRuntimeException;
import org.apache.hivemind.Element;
import org.apache.hivemind.Module;
@@ -35,7 +34,7 @@
import org.apache.hivemind.Resource;
import org.apache.hivemind.impl.RegistryBuilder;
import org.apache.hivemind.impl.SchemaProcessorImpl;
-import org.apache.hivemind.schema.rules.ResourceTranslator;
+import org.apache.hivemind.util.ClasspathResource;
/**
* A number of tests related to processing of extension points.
1.1
jakarta-commons-sandbox/hivemind/framework/src/test/hivemind/test/config/Basics.xml
Index: Basics.xml
===================================================================
<?xml version="1.0"?>
<!-- $Id: Basics.xml,v 1.1 2004/03/01 01:08:02 hlship Exp $ -->
<module id="hivemind.test.config" version="1.0.0">
<configuration-point id="Basics">
<schema>
<element name="data-item">
<attribute name="item-name" required="true"/>
<attribute name="count"/>
<attribute name="service-id"/>
<conversion class="hivemind.test.config.DataItem">
<map attribute="item-name" property="name"/>
<map attribute="service-id" property="factory"
translator="service"/>
</conversion>
</element>
</schema>
</configuration-point>
<contribution configuration-id="Basics">
<data-item item-name="builder" count="5"
service-id="hivemind.BuilderFactory"/>
</contribution>
</module>
1.1
jakarta-commons-sandbox/hivemind/framework/src/test/hivemind/test/config/ExtraAttributeNames.xml
Index: ExtraAttributeNames.xml
===================================================================
<?xml version="1.0"?>
<!-- $Id: ExtraAttributeNames.xml,v 1.1 2004/03/01 01:08:02 hlship Exp $ -->
<module id="hivemind.test.config" version="1.0.0">
<configuration-point id="ExtraAttributeNames">
<schema>
<element name="data-item">
<attribute name="name" required="true"/>
<attribute name="count"/>
<attribute name="factory"/>
<conversion class="hivemind.test.config.DataItem">
<map attribute="factory" translator="service"/>
<map attribute="extra"/>
</conversion>
</element>
</schema>
</configuration-point>
<contribution configuration-id="ExtraAttributeNames">
<data-item name="lamb" count="95" factory="hivemind.BuilderFactory"/>
</contribution>
</module>
1.1
jakarta-commons-sandbox/hivemind/framework/src/test/hivemind/test/config/DataItem.java
Index: DataItem.java
===================================================================
// Copyright 2004 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package hivemind.test.config;
import org.apache.hivemind.ServiceImplementationFactory;
import org.apache.hivemind.impl.BaseLocatable;
/**
* Data object used by [EMAIL PROTECTED] hivemind.test.config.TestConversion}.
*
* @author Howard Lewis Ship
* @version $Id: DataItem.java,v 1.1 2004/03/01 01:08:02 hlship Exp $
*/
public class DataItem extends BaseLocatable
{
private String _name;
private int _count;
private ServiceImplementationFactory _factory;
public int getCount()
{
return _count;
}
public ServiceImplementationFactory getFactory()
{
return _factory;
}
public String getName()
{
return _name;
}
public void setCount(int i)
{
_count = i;
}
public void setFactory(ServiceImplementationFactory factory)
{
_factory = factory;
}
public void setName(String string)
{
_name = string;
}
}
1.1
jakarta-commons-sandbox/hivemind/framework/src/test/hivemind/test/config/TestConversion.java
Index: TestConversion.java
===================================================================
// Copyright 2004 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package hivemind.test.config;
import hivemind.test.FrameworkTestCase;
import java.util.List;
import org.apache.hivemind.Registry;
import org.apache.hivemind.ServiceImplementationFactory;
/**
* Tests for the <conversion> and <map> elements
* within a module deployment descriptor.
*
* TODO: test [EMAIL PROTECTED]
org.apache.hivemind.parse.ConversionDescriptor#setParentMethodName(String)}.
*
* @author Howard Lewis Ship
* @version $Id: TestConversion.java,v 1.1 2004/03/01 01:08:02 hlship Exp $
*/
public class TestConversion extends FrameworkTestCase
{
public void testBasics() throws Exception
{
Registry r = buildFrameworkRegistry("Basics.xml");
List l = r.getConfiguration("hivemind.test.config.Basics");
assertEquals(1, l.size());
DataItem d = (DataItem) l.get(0);
assertEquals("builder", d.getName());
assertEquals(5, d.getCount());
ServiceImplementationFactory builderFactory =
(ServiceImplementationFactory) r.getService(
"hivemind.BuilderFactory",
ServiceImplementationFactory.class);
assertSame(builderFactory, d.getFactory());
}
public void testPropertyNameDefaultsToAttributeName() throws Exception
{
Registry r = buildFrameworkRegistry("Basics2.xml");
List l = r.getConfiguration("hivemind.test.config.Basics2");
assertEquals(1, l.size());
DataItem d = (DataItem) l.get(0);
assertEquals("underworld", d.getName());
assertEquals(18, d.getCount());
ServiceImplementationFactory builderFactory =
(ServiceImplementationFactory) r.getService(
"hivemind.BuilderFactory",
ServiceImplementationFactory.class);
assertSame(builderFactory, d.getFactory());
}
public void testExtraAttributeNames() throws Exception
{
interceptLogging();
Registry r = buildFrameworkRegistry("ExtraAttributeNames.xml");
assertLoggedMessagePattern(
"Mappings for unknown attribute\\(s\\) \\[extra\\] "
+ "\\(for element data-item at .*\\) have been ignored\\.");
List l = r.getConfiguration("hivemind.test.config.ExtraAttributeNames");
assertEquals(1, l.size());
DataItem d = (DataItem) l.get(0);
assertEquals("lamb", d.getName());
assertEquals(95, d.getCount());
ServiceImplementationFactory builderFactory =
(ServiceImplementationFactory) r.getService(
"hivemind.BuilderFactory",
ServiceImplementationFactory.class);
assertSame(builderFactory, d.getFactory());
}
}
1.1
jakarta-commons-sandbox/hivemind/framework/src/test/hivemind/test/config/Basics2.xml
Index: Basics2.xml
===================================================================
<?xml version="1.0"?>
<!-- $Id: Basics2.xml,v 1.1 2004/03/01 01:08:02 hlship Exp $ -->
<module id="hivemind.test.config" version="1.0.0">
<configuration-point id="Basics2">
<schema>
<element name="data-item">
<attribute name="name" required="true"/>
<attribute name="count"/>
<attribute name="factory"/>
<conversion class="hivemind.test.config.DataItem">
<map attribute="factory" translator="service"/>
</conversion>
</element>
</schema>
</configuration-point>
<contribution configuration-id="Basics2">
<data-item name="underworld" count="18"
factory="hivemind.BuilderFactory"/>
</contribution>
</module>
1.30 +101 -2 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.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- descriptor.xml 26 Feb 2004 23:07:34 -0000 1.29
+++ descriptor.xml 1 Mar 2004 01:08:02 -0000 1.30
@@ -145,6 +145,55 @@
</section>
+ <section name="conversion">
+
+ <p>&_conversion; is an alternative to &rules; that is generally
simpler and more concise.
+ An &element; should contain &_conversion; or &_rules; but not
both.
+ </p>
+
+ <p>
+ &_conversion; is geared towards the typical case; a straight-forward
mapping of the element
+ to an instance of a Java class,
+ and a mapping of the element's attributes to the properties of the
Java object.
+ </p>
+
+ <table>
+ <tr>
+ <th>Attribute</th>
+ <th>Type</th>
+ <th>Required ?</th>
+ <th>Description</th>
+ </tr>
+
+ <tr>
+
+ <td>class</td>
+ <td>string</td>
+ <td>yes</td>
+ <td>
+
+ The fully qualified name of a Java class to
instantiate.
+
+ </td>
+
+ </tr>
+
+ <tr>
+ <td>parentMethod</td>
+ <td>string</td>
+ <td>no</td>
+ <td>The name of a method of the parent object
used to add the created object
+ to the parent. The default,
<code>addElement</code>, is appropriate for
+ top-level &_element;s.</td>
+ </tr>
+ </table>
+
+ <p>
+ Contains: ↦
+ </p>
+
+ </section>
+
<section name="create-instance">
<p> &_create-instance; is used, within &service-point; and
&implementation;
to create the core service implementation for a service
@@ -197,7 +246,7 @@
</table>
<p>
- Contains: &attribute;, &description;, &element;, &rules;
+ Contains: &attribute;, &conversion;, &description;, &element;, &rules;
</p>
@@ -311,6 +360,56 @@
in accordance with the factory's schema, and provided to the
factory.
</p>
+ </section>
+
+ <section name="map">
+
+ <p>The &_map; element appears within &conversion;
+ to override the default mapping from an attribute to a
property. By default, the
+ property name is expected to match the attribute name,
and attribute value
+ is converted in accordance to the property type. When
the property type is
+ not a primitive type, or the attribute should be
interpreted specially (as
+ a reference to a service, perhaps), then translator
should be specified.
+
+ </p>
+
+ <table>
+ <tr>
+ <th>Attribute</th>
+ <th>Type</th>
+ <th>Required ?</th>
+ <th>Description</th>
+ </tr>
+
+ <tr>
+ <td>attribute</td> <td>string</td>
<td>yes</td>
+ <td>
+ The name of the attribute, which should match
a name defined
+ by an &attribute; (of the enclosing
&element;).
+ </td>
+ </tr>
+
+ <tr>
+ <td>property</td> <td>string</td>
<td>no</td>
+ <td>
+ The corresponding property (of the Java object
specified by the
+ enclosing &conversion;). If not specified, the
property name
+ will match the attribute name.
+ </td>
+ </tr>
+
+ <tr>
+ <td>translator</td> <td>string</td> <td>no</td>
+ <td>
+ The <a
href="&projectroot;rules.html#Translators">translator</a>
+ used to convert the attribute value to a
property value.
+ If not specified, then the default translator
will automatically convert
+ the attribute value to a Java primitive type
(or leave it as a string).
+ </td>
+
+ </tr>
+ </table>
+
</section>
<section name="module">
1.16 +9 -9 jakarta-commons-sandbox/hivemind/xdocs/rules.xml
Index: rules.xml
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/xdocs/rules.xml,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- rules.xml 29 Feb 2004 20:57:09 -0000 1.15
+++ rules.xml 1 Mar 2004 01:08:02 -0000 1.16
@@ -362,8 +362,7 @@
</p>
<p>
-A null input value returns null. Invalid input, such as an unknown configuration
point id, will be logged as an error and
-null will be returned.
+A blank input value returns null.
</p>
</subsection>
@@ -374,7 +373,7 @@
The double translator converts the input into an double precision floating point
value.
It recognizes three initializer values:
<ul>
-<li>default: the default value (normally 0) to use when the input is null or
invalid</li>
+<li>default: the default value (normally 0) to use when the input is blank</li>
<li>min: a minimum acceptible value</li>
<li>max: a maximum acceptible value</li>
</ul>
@@ -416,7 +415,7 @@
<p>
The int translator converts the input into an integer value. It recognizes three
initializer values:
<ul>
-<li>default: the default value (normally 0) to use when the input is null or
invalid</li>
+<li>default: the default value (normally 0) to use when the input is blank</li>
<li>min: a minimum acceptible value</li>
<li>max: a maximum acceptible value</li>
</ul>
@@ -430,7 +429,7 @@
<p>
The long translator converts the input into an long integer (64 bit) value. It
recognizes three initializer values:
<ul>
-<li>default: the default value (normally 0) to use when the input is null or
invalid</li>
+<li>default: the default value (normally 0) to use when the input is blank</li>
<li>min: a minimum acceptible value</li>
<li>max: a maximum acceptible value</li>
</ul>
@@ -456,7 +455,7 @@
</p>
<p>
-If the file doesn't exist, then an error is logged (and null is returned). If a
localization of the
+If the file doesn't exist, then an error is logged. If a localization of the
file exists, then the Resource for that localization is returned.
</p>
@@ -475,13 +474,14 @@
<p>
The smart translator attempts an automatic conversion from a string value (the XML
attribute value or element
-content) to a particular type. It makes use of the JavaBeans's PropertyEditor class
for the conversion, which allows easy
+content) to a particular type. It determines the type from the property to which
the value will
+be assigned. Smart translator makes use of the JavaBeans's PropertyEditor class
for the conversion, which allows easy
this translator to be used with most common primitive types, such as int, short
and boolean. See
the <a href="&apiroot;/schema/rules/SmartTranslator.html">SmartTranslator</a>
documentation for more details.
</p>
<p>
-In general, the smart translator is the most useful for most ordinary Java type
properties, unless you want to specify
+In general, the smart translator is the useful for most ordinary Java type
properties, unless you want to specify
range constraints.
</p>
1.1
jakarta-commons-sandbox/hivemind/framework/src/java/org/apache/hivemind/parse/ConversionDescriptor.java
Index: ConversionDescriptor.java
===================================================================
// Copyright 2004 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package org.apache.hivemind.parse;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hivemind.HiveMind;
import org.apache.hivemind.Location;
import org.apache.hivemind.impl.BaseLocatable;
import org.apache.hivemind.schema.AttributeModel;
import org.apache.hivemind.schema.Translator;
import org.apache.hivemind.schema.impl.ElementModelImpl;
import org.apache.hivemind.schema.rules.CreateObjectRule;
import org.apache.hivemind.schema.rules.InvokeParentRule;
import org.apache.hivemind.schema.rules.ReadAttributeRule;
/**
* Descriptor for the <conversion> module descriptor element.
*
* @author Howard Lewis Ship
* @version $Id: ConversionDescriptor.java,v 1.1 2004/03/01 01:08:02 hlship Exp $
*/
public class ConversionDescriptor extends BaseLocatable
{
private static final Log LOG = LogFactory.getLog(ConversionDescriptor.class);
private ElementModelImpl _elementModel;
private Translator _defaultTranslator;
private String _className;
private String _parentMethodName = "addElement";
private Map _attributeMappings = new HashMap();
public ConversionDescriptor(
ElementModelImpl elementModel,
Translator defaultTranslator,
Location location)
{
_elementModel = elementModel;
_defaultTranslator = defaultTranslator;
setLocation(location);
}
public void addAttributeMapping(AttributeMappingDescriptor descriptor)
{
String attributeName = descriptor.getAttributeName();
AttributeMappingDescriptor existing =
(AttributeMappingDescriptor) _attributeMappings.get(attributeName);
if (existing != null)
{
LOG.error(
HiveMind.format(
"ConversionDescriptor.dupe-attribute-mapping",
attributeName,
descriptor.getLocation(),
existing.getLocation()));
return;
}
_attributeMappings.put(attributeName, descriptor);
}
public void setClassName(String string)
{
_className = string;
}
public void setParentMethodName(String string)
{
_parentMethodName = string;
}
public void addRulesForModel()
{
_elementModel.addRule(new CreateObjectRule(_className));
addAttributeRules();
_elementModel.addRule(new InvokeParentRule(_parentMethodName));
}
private void addAttributeRules()
{
Iterator i = _elementModel.getAttributeModels().iterator();
while (i.hasNext())
{
AttributeModel am = (AttributeModel) i.next();
String attributeName = am.getName();
AttributeMappingDescriptor amd =
(AttributeMappingDescriptor) _attributeMappings.get(attributeName);
if (amd == null)
{
_elementModel.addRule(
new ReadAttributeRule(
attributeName,
attributeName,
_defaultTranslator,
getLocation()));
}
else
{
String propertyName = amd.getPropertyName();
if (propertyName == null)
propertyName = attributeName;
_elementModel.addRule(
new ReadAttributeRule(
attributeName,
propertyName,
amd.getTranslator(),
amd.getLocation()));
_attributeMappings.remove(attributeName);
}
}
if (!_attributeMappings.isEmpty())
LOG.error(
HiveMind.format(
"ConversionDescriptor.extra-mappings",
_attributeMappings.keySet(),
_elementModel.getElementName(),
getLocation()));
}
}
1.1
jakarta-commons-sandbox/hivemind/framework/src/java/org/apache/hivemind/parse/AttributeMappingDescriptor.java
Index: AttributeMappingDescriptor.java
===================================================================
// Copyright 2004 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package org.apache.hivemind.parse;
import org.apache.hivemind.impl.BaseLocatable;
import org.apache.hivemind.schema.Translator;
/**
* Descriptor for the <map> element, nested within a <conversion> module
descriptor
* element.
*
* @author Howard Lewis Ship
* @version $Id: AttributeMappingDescriptor.java,v 1.1 2004/03/01 01:08:02 hlship
Exp $
*/
public class AttributeMappingDescriptor extends BaseLocatable
{
private String _attributeName;
private String _propertyName;
private Translator _translator;
public String getAttributeName()
{
return _attributeName;
}
public String getPropertyName()
{
return _propertyName;
}
public Translator getTranslator()
{
return _translator;
}
public void setAttributeName(String string)
{
_attributeName = string;
}
public void setPropertyName(String string)
{
_propertyName = string;
}
public void setTranslator(Translator translator)
{
_translator = translator;
}
}
1.3 +11 -1
jakarta-commons-sandbox/hivemind/framework/src/java/org/apache/hivemind/schema/rules/InvokeParentRule.java
Index: InvokeParentRule.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/hivemind/framework/src/java/org/apache/hivemind/schema/rules/InvokeParentRule.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- InvokeParentRule.java 28 Feb 2004 00:34:36 -0000 1.2
+++ InvokeParentRule.java 1 Mar 2004 01:08:02 -0000 1.3
@@ -36,6 +36,16 @@
private String _methodName;
private int _depth = 1;
+ public InvokeParentRule()
+ {
+
+ }
+
+ public InvokeParentRule(String methodName)
+ {
+ _methodName = methodName;
+ }
+
/**
* Invokes the named method on the parent object (using reflection).
*/
1.2 +1 -6
jakarta-commons-sandbox/hivemind/framework/src/java/org/apache/hivemind/schema/rules/SetParentRule.java
Index: SetParentRule.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/hivemind/framework/src/java/org/apache/hivemind/schema/rules/SetParentRule.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SetParentRule.java 26 Feb 2004 23:07:42 -0000 1.1
+++ SetParentRule.java 1 Mar 2004 01:08:02 -0000 1.2
@@ -30,11 +30,6 @@
{
private String _propertyName;
- public String getPropertyName()
- {
- return _propertyName;
- }
-
public void setPropertyName(String string)
{
_propertyName = string;
1.3 +19 -6
jakarta-commons-sandbox/hivemind/framework/src/java/org/apache/hivemind/schema/rules/ReadAttributeRule.java
Index: ReadAttributeRule.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/hivemind/framework/src/java/org/apache/hivemind/schema/rules/ReadAttributeRule.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ReadAttributeRule.java 29 Feb 2004 20:57:08 -0000 1.2
+++ ReadAttributeRule.java 1 Mar 2004 01:08:02 -0000 1.3
@@ -18,6 +18,7 @@
import org.apache.commons.logging.LogFactory;
import org.apache.hivemind.Element;
import org.apache.hivemind.HiveMind;
+import org.apache.hivemind.Location;
import org.apache.hivemind.schema.SchemaProcessor;
import org.apache.hivemind.schema.Translator;
import org.apache.hivemind.util.PropertyUtils;
@@ -39,6 +40,23 @@
private boolean _skipIfNull = true;
private Translator _translator;
+ public ReadAttributeRule()
+ {
+ }
+
+ public ReadAttributeRule(
+ String attributeName,
+ String propertyName,
+ Translator translator,
+ Location location)
+ {
+ _attributeName = attributeName;
+ _propertyName = propertyName;
+ _translator = translator;
+
+ setLocation(location);
+ }
+
public void begin(SchemaProcessor processor, Element element)
{
String rawValue = element.getAttributeValue(_attributeName);
@@ -76,11 +94,6 @@
LOG.error(message, ex);
}
- }
-
- public Translator getTranslator()
- {
- return _translator;
}
public void setTranslator(Translator translator)
1.7 +1 -2
jakarta-commons-sandbox/hivemind/framework/src/test/hivemind/test/rules/TestObjectTranslator.java
Index: TestObjectTranslator.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/hivemind/framework/src/test/hivemind/test/rules/TestObjectTranslator.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- TestObjectTranslator.java 29 Feb 2004 20:57:09 -0000 1.6
+++ TestObjectTranslator.java 1 Mar 2004 01:08:02 -0000 1.7
@@ -21,7 +21,6 @@
import org.apache.hivemind.ApplicationRuntimeException;
import org.apache.hivemind.Location;
import org.apache.hivemind.Registry;
-import org.apache.hivemind.impl.BaseLocatable;
import org.apache.hivemind.impl.ElementImpl;
import org.apache.hivemind.impl.LocationImpl;
import org.apache.hivemind.schema.rules.ClassTranslator;
1.8 +3 -7
jakarta-commons-sandbox/hivemind/framework/src/descriptor/META-INF/hivemodule.xml
Index: hivemodule.xml
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/hivemind/framework/src/descriptor/META-INF/hivemodule.xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- hivemodule.xml 29 Feb 2004 20:57:09 -0000 1.7
+++ hivemodule.xml 1 Mar 2004 01:08:02 -0000 1.8
@@ -88,12 +88,8 @@
</description>
</attribute>
- <rules>
- <create-object
class="org.apache.hivemind.service.impl.FactoryDefault"/>
- <read-attribute attribute="symbol"
property="symbol"/>
- <read-attribute attribute="value"
property="value"/>
- <invoke-parent method="addElement"/>
- </rules>
+ <conversion
class="org.apache.hivemind.service.impl.FactoryDefault"/>
+
</element>
</schema>
1.19 +7 -1 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.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- links.xml 26 Feb 2004 23:08:04 -0000 1.18
+++ links.xml 1 Mar 2004 01:08:02 -0000 1.19
@@ -31,6 +31,12 @@
<!ENTITY _configuration-point '<code><configuration-point></code>'>
<!ENTITY configuration-point '<a
href="&projectroot;descriptor.html#configuration-point">&_configuration-point;</a>'>
+<!ENTITY _conversion '<code><conversion></code>'>
+<!ENTITY conversion '<a
href="&projectroot;descriptor.html#conversion">&_conversion;</a>'>
+
+<!ENTITY _map '<code><map></code>'>
+<!ENTITY map '<a href="&projectroot;descriptor.html#map">&_map;</a>'>
+
<!ENTITY _create-instance '<code><create-instance></code>'>
<!ENTITY create-instance '<a
href="&projectroot;descriptor.html#create-instance">&_create-instance;</a>'>
1.23 +9 -4 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.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- hivemind.xsl 26 Feb 2004 23:08:01 -0000 1.22
+++ hivemind.xsl 1 Mar 2004 01:08:02 -0000 1.23
@@ -15,6 +15,10 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
+<!--
+TODO: <schema>s can now be referenced across modules. Need a UID for them
+and new rules for creating cross-module links to schemas.
+-->
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common" extension-element-prefixes="exsl">
@@ -268,15 +272,15 @@
</xsl:for-each>
- <xsl:if test="rules">
+ <xsl:if test="rules|conversion">
<tr>
<td/>
<td colspan="2">
- <h3>Rules</h3>
+ <h3>XML Conversion Rules</h3>
<ul>
- <xsl:apply-templates
select="rules/*" mode="raw"/>
+ <xsl:apply-templates
select="conversion|rules/*" mode="raw"/>
</ul>
</td>
@@ -285,6 +289,7 @@
</xsl:if>
+
<xsl:if test="element">
1.4 +7 -8
jakarta-commons-sandbox/hivemind/library/src/descriptor/META-INF/hivemodule.xml
Index: hivemodule.xml
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/hivemind/library/src/descriptor/META-INF/hivemodule.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- hivemodule.xml 26 Feb 2004 23:08:04 -0000 1.3
+++ hivemodule.xml 1 Mar 2004 01:08:02 -0000 1.4
@@ -84,13 +84,12 @@
</description>
</attribute>
- <rules>
- <create-object
class="org.apache.hivemind.lib.impl.EJBProxyParameters"/>
- <read-attribute property="jndiName"
attribute="jndi-name"/>
- <read-attribute
property="homeInterfaceClassName" attribute="home-interface"/>
- <read-attribute property="nameLookup"
attribute="name-lookup-service-id" translator="service"/>
- <invoke-parent method="addElement"/>
- </rules>
+ <conversion
class="org.apache.hivemind.lib.impl.EJBProxyParameters">
+ <map attribute="jndi-name"
property="jndiName"/>
+ <map attribute="home-interface"
property="homeInterfaceClassName"/>
+ <map attribute="name-lookup-service-id"
property="nameLookup" translator="service"/>
+ </conversion>
+
</element>
</parameters-schema>
1.4 +4 -1
jakarta-commons-sandbox/hivemind/framework/src/java/org/apache/hivemind/HiveMindMessages.properties
Index: HiveMindMessages.properties
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/hivemind/framework/src/java/org/apache/hivemind/HiveMindMessages.properties,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- HiveMindMessages.properties 29 Feb 2004 20:57:09 -0000 1.3
+++ HiveMindMessages.properties 1 Mar 2004 01:08:03 -0000 1.4
@@ -62,6 +62,9 @@
DescriptorParser.invalid-id-format=Attribute {0} ({1}) of element {2} (at {3}) is
not a valid id.
DescriptorParser.unable-to-resolve-schema=Unable to resolve reference to schema
''{0}'' at {1}.
+ConversionDescriptor.dupe-attribute-mapping=Mapping for attribute {0} (at {1})
conflicts with a previous mapping (at {2}) as has been ignored.
+ConversionDescriptor.extra-mappings=Mappings for unknown attribute(s) {0} (for
element {1} at {2}) have been ignored.
+
ExternalParser.missing-resource=Unable to locate {0}.
ServiceExtensionPoint.bad-interface=Unable to find interface {0} (for service {1}).
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]