hlship 2004/09/27 07:38:01
Modified: library/src/java/org/apache/hivemind/lib/factory
BeanFactoryImpl.java FactoryStrings.properties
FactoryMessages.java
library/src/descriptor/META-INF hivemodule.xml
src/documentation/content/xdocs descriptor.xml
library/src/test/org/apache/hivemind/lib/factory
TestBeanFactoryImpl.java
Log:
HIVEMIND-58: Add visibility attribute to the <schema> element.
Revision Changes Path
1.4 +2 -18
jakarta-hivemind/library/src/java/org/apache/hivemind/lib/factory/BeanFactoryImpl.java
Index: BeanFactoryImpl.java
===================================================================
RCS file:
/home/cvs/jakarta-hivemind/library/src/java/org/apache/hivemind/lib/factory/BeanFactoryImpl.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- BeanFactoryImpl.java 19 Aug 2004 13:46:42 -0000 1.3
+++ BeanFactoryImpl.java 27 Sep 2004 14:38:01 -0000 1.4
@@ -94,24 +94,8 @@
null);
continue;
}
-
- String name = c.getName();
-
- BeanFactoryContribution existing = (BeanFactoryContribution)
_contributions.get(name);
-
- if (existing != null)
- {
- _errorHandler.error(
- _log,
- FactoryMessages.dupeContribution(existing),
- existing.getLocation(),
- null);
- continue;
- }
-
- // Passed the checks, good to go.
-
- _contributions.put(name, c);
+
+ _contributions.put(c.getName(), c);
}
}
1.3 +0 -1
jakarta-hivemind/library/src/java/org/apache/hivemind/lib/factory/FactoryStrings.properties
Index: FactoryStrings.properties
===================================================================
RCS file:
/home/cvs/jakarta-hivemind/library/src/java/org/apache/hivemind/lib/factory/FactoryStrings.properties,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- FactoryStrings.properties 15 Jun 2004 13:42:33 -0000 1.2
+++ FactoryStrings.properties 27 Sep 2004 14:38:01 -0000 1.3
@@ -15,7 +15,6 @@
wrong-contribution-type=Contribution ''{0}'' (class {1}) is not assignable
to {2} and has been ignored.
invalid-contribution-class=Contribution ''{0}'' is for {1} which is
inappropriate for an object factory. The contribution has been ignored.
-dupe-contribution=Contribution ''{0}'' duplicates a previous contribution
(at {1}) and has been ignored.
unknown-contribution=No object factory contribution named ''{0}''.
unable-to-instantiate=Unable to instantiate instance of class {0}: {1}
invalid-bean-translator-format=''{0}'' is not formatted correctly, it should
be ''service-id:name[,initializer]''.
1.6 +0 -8
jakarta-hivemind/library/src/java/org/apache/hivemind/lib/factory/FactoryMessages.java
Index: FactoryMessages.java
===================================================================
RCS file:
/home/cvs/jakarta-hivemind/library/src/java/org/apache/hivemind/lib/factory/FactoryMessages.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- FactoryMessages.java 18 Jun 2004 13:49:16 -0000 1.5
+++ FactoryMessages.java 27 Sep 2004 14:38:01 -0000 1.6
@@ -40,14 +40,6 @@
ClassFabUtils.getJavaClassName(c.getBeanClass()));
}
- public static String dupeContribution(BeanFactoryContribution existing)
- {
- return _formatter.format(
- "dupe-contribution",
- existing.getName(),
- HiveMind.getLocationString(existing));
- }
-
public static String unknownContribution(String name)
{
return _formatter.format("unknown-contribution", name);
1.14 +1 -1
jakarta-hivemind/library/src/descriptor/META-INF/hivemodule.xml
Index: hivemodule.xml
===================================================================
RCS file:
/home/cvs/jakarta-hivemind/library/src/descriptor/META-INF/hivemodule.xml,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- hivemodule.xml 25 Sep 2004 17:08:35 -0000 1.13
+++ hivemodule.xml 27 Sep 2004 14:38:01 -0000 1.14
@@ -125,7 +125,7 @@
<element name="bean">
Define one class of bean that may be vended. Beans must have either a
public constructor that takes no arguments,
or a public constructor that takes a single string argument (or both).
- <attribute name="name" required="true">A unique name for the
bean.</attribute>
+ <attribute name="name" required="true" unique="true">A unique name for
the bean.</attribute>
<attribute name="class" required="true" translator="class">The bean
class that will be instantiated by the factory.</attribute>
<attribute name="cacheable" translator="boolean">Defines whether
instances of the bean may be cached; the default is specified by the
factory.</attribute>
<conversion
class="org.apache.hivemind.lib.factory.BeanFactoryContribution">
1.14 +11 -2
jakarta-hivemind/src/documentation/content/xdocs/descriptor.xml
Index: descriptor.xml
===================================================================
RCS file:
/home/cvs/jakarta-hivemind/src/documentation/content/xdocs/descriptor.xml,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- descriptor.xml 25 Sep 2004 17:08:35 -0000 1.13
+++ descriptor.xml 27 Sep 2004 14:38:01 -0000 1.14
@@ -497,6 +497,15 @@
<td>yes</td>
<td>Assigns a local id to the schema
that may be referenced elsewhere.</td>
</tr>
+ <tr>
+ <td>visibility</td>
+ <td><code>public | private</code></td>
+ <td>no</td>
+ <td>
+ If <code>private</code> is specified, then the schema may only
be referenced
+ from within the same module. The default is <code>public</code>.
+ </td>
+ </tr>
</table>
<p>Contains: &element; </p>
<p>At a future time, the &_schema; element will be
extended to provide
@@ -504,8 +513,8 @@
be provided in an &_contribution;. At this
time, a &_schema; is simply a
list of &_element; elements.</p>
<warning>When &_schema; appears directly within
&configuration-point;, or &_parameters-schema;
- appears directly within &service-point;, then
the <code>id</code>
- attribute is not allowed.</warning>
+ appears directly within &service-point;, then
the <code>id</code> and <code>visibility</code>
+ attributes are not allowed.</warning>
</section>
<section>
<title>service-point</title>
1.7 +0 -25
jakarta-hivemind/library/src/test/org/apache/hivemind/lib/factory/TestBeanFactoryImpl.java
Index: TestBeanFactoryImpl.java
===================================================================
RCS file:
/home/cvs/jakarta-hivemind/library/src/test/org/apache/hivemind/lib/factory/TestBeanFactoryImpl.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- TestBeanFactoryImpl.java 19 Aug 2004 13:46:42 -0000 1.6
+++ TestBeanFactoryImpl.java 27 Sep 2004 14:38:01 -0000 1.7
@@ -129,31 +129,6 @@
verifyControls();
}
- public void testDupeName()
- {
- List l = new ArrayList();
- l.add(build("list", ArrayList.class));
- l.add(build("list", LinkedList.class));
-
- ErrorHandler eh = (ErrorHandler) newMock(ErrorHandler.class);
-
- eh.error(
- null,
- "Contribution 'list' duplicates a previous contribution (at
unknown location) and has been ignored.",
- null,
- null);
-
- replayControls();
-
- BeanFactoryImpl f = new BeanFactoryImpl(null, eh, Collection.class,
l, true);
-
- Object o = f.get("list");
-
- assertTrue(o instanceof ArrayList);
-
- verifyControls();
- }
-
public void testTranslator()
{
List l = Collections.singletonList(build("string", String.class));
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]