notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
r1789 - in trunk: . central/apis/src/docs/api/dpml main/depot main/depot/library/src/main/net/dpml/library/impl main/lang/component/etc main/metro main/metro/component/src/main/net/dpml/component main/metro/model/etc/data/components main/metro/model/src/main/net/dpml/metro main/metro/model/src/main/net/dpml/metro/builder main/metro/model/src/main/net/dpml/metro/data main/metro/model/src/main/net/dpml/metro/info main/metro/model/src/test/net/dpml/metro/builder main/metro/model/src/test/net/dpml/metro/data/test main/metro/runtime/src/main/net/dpml/metro/runtime main/planet main/planet/http main/station main/transit main/transit/core/src/main/net/dpml/lang main/transit/core/src/main/net/dpml/util main/transit/core/src/test/net/dpml/transit main/transit/core/src/test/net/dpml/transit/test
- From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
- To: notify-dpml AT lists.ibiblio.org
- Subject: r1789 - in trunk: . central/apis/src/docs/api/dpml main/depot main/depot/library/src/main/net/dpml/library/impl main/lang/component/etc main/metro main/metro/component/src/main/net/dpml/component main/metro/model/etc/data/components main/metro/model/src/main/net/dpml/metro main/metro/model/src/main/net/dpml/metro/builder main/metro/model/src/main/net/dpml/metro/data main/metro/model/src/main/net/dpml/metro/info main/metro/model/src/test/net/dpml/metro/builder main/metro/model/src/test/net/dpml/metro/data/test main/metro/runtime/src/main/net/dpml/metro/runtime main/planet main/planet/http main/station main/transit main/transit/core/src/main/net/dpml/lang main/transit/core/src/main/net/dpml/util main/transit/core/src/test/net/dpml/transit main/transit/core/src/test/net/dpml/transit/test
- Date: Thu, 30 Nov 2006 22:08:49 +0100
Author: mcconnell
Date: 2006-11-30 22:08:46 +0100 (Thu, 30 Nov 2006)
New Revision: 1789
Added:
trunk/main/metro/model/etc/data/components/nested-context.xml
trunk/main/metro/model/src/test/net/dpml/metro/builder/NestedContextTestCase.java
trunk/main/transit/core/src/test/net/dpml/transit/PropertyResolverTestCase.java
Removed:
trunk/main/transit/core/src/test/net/dpml/transit/test/PropertyResolverTestCase.java
Modified:
trunk/central/apis/src/docs/api/dpml/index.xml
trunk/central/apis/src/docs/api/dpml/navigation.xml
trunk/index.xml
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultDictionary.java
trunk/main/depot/module.xml
trunk/main/lang/component/etc/component.xsd
trunk/main/metro/component/src/main/net/dpml/component/Provider.java
trunk/main/metro/component/src/main/net/dpml/component/Status.java
trunk/main/metro/model/src/main/net/dpml/metro/PartsManager.java
trunk/main/metro/model/src/main/net/dpml/metro/builder/ComponentDecoder.java
trunk/main/metro/model/src/main/net/dpml/metro/data/ContextDirective.java
trunk/main/metro/model/src/main/net/dpml/metro/info/CollectionPolicy.java
trunk/main/metro/model/src/test/net/dpml/metro/data/test/ContextDirectiveTestCase.java
trunk/main/metro/module.xml
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComponentHandler.java
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComponentModel.java
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultPartsManager.java
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultProvider.java
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/PartsInvocationHandler.java
trunk/main/planet/http/module.xml
trunk/main/planet/module.xml
trunk/main/station/module.xml
trunk/main/transit/core/src/main/net/dpml/lang/PartDecoder.java
trunk/main/transit/core/src/main/net/dpml/lang/ValueDecoder.java
trunk/main/transit/core/src/main/net/dpml/util/ElementHelper.java
trunk/main/transit/core/src/main/net/dpml/util/PropertyResolver.java
trunk/main/transit/module.xml
Log:
update to SDK 1.1.0
Modified: trunk/central/apis/src/docs/api/dpml/index.xml
===================================================================
--- trunk/central/apis/src/docs/api/dpml/index.xml 2006-11-24 15:09:28
UTC (rev 1788)
+++ trunk/central/apis/src/docs/api/dpml/index.xml 2006-11-30 21:08:46
UTC (rev 1789)
@@ -46,6 +46,11 @@
<td><a href="1.0.5/index.html">1.0.5</a></td>
<td>Updates SE6 support with resolution of JMX issue when running
under SE5.</td>
</tr>
+ <tr>
+ <td><a href="1.1.0/index.html">1.1.0</a></td>
+ <td>Updates SE6 support related to garbage collection semantics
and improved
+ support for symbolic properties in component part
definitions.</td>
+ </tr>
</table>
</section>
Modified: trunk/central/apis/src/docs/api/dpml/navigation.xml
===================================================================
--- trunk/central/apis/src/docs/api/dpml/navigation.xml 2006-11-24 15:09:28
UTC (rev 1788)
+++ trunk/central/apis/src/docs/api/dpml/navigation.xml 2006-11-30 21:08:46
UTC (rev 1789)
@@ -31,6 +31,7 @@
<item name="1.0.3" href="1.0.3/index.html"/>
<item name="1.0.4" href="1.0.4/index.html"/>
<item name="1.0.5" href="1.0.5/index.html"/>
+ <item name="1.1.0" href="1.1.0/index.html"/>
</menu>
</body>
Modified: trunk/index.xml
===================================================================
--- trunk/index.xml 2006-11-24 15:09:28 UTC (rev 1788)
+++ trunk/index.xml 2006-11-30 21:08:46 UTC (rev 1789)
@@ -17,8 +17,8 @@
<property name="project.svn.host"
value="svn://svn.berlios.de/dpml/trunk/main"/>
<property name="project.javadoc.linksource" value="true"/>
<property name="project.major.version" value="1"/>
- <property name="project.minor.version" value="0"/>
- <property name="project.micro.version" value="5"/>
+ <property name="project.minor.version" value="1"/>
+ <property name="project.micro.version" value="0"/>
</properties>
<module name="dpml" basedir="main">
Modified:
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultDictionary.java
===================================================================
---
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultDictionary.java
2006-11-24 15:09:28 UTC (rev 1788)
+++
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultDictionary.java
2006-11-30 21:08:46 UTC (rev 1789)
@@ -153,6 +153,7 @@
return value;
}
}
+
/**
* Evaluate and expand any symbolic references in the supplied value.
* @param value the value to resolve
Modified: trunk/main/depot/module.xml
===================================================================
--- trunk/main/depot/module.xml 2006-11-24 15:09:28 UTC (rev 1788)
+++ trunk/main/depot/module.xml 2006-11-30 21:08:46 UTC (rev 1789)
@@ -5,17 +5,14 @@
xmlns:part="link:xsd:dpml/lang/dpml-part#1.0">
<properties>
- <property name="project.micro.version" value="4"/>
+ <property name="project.minor.version" value="2"/>
+ <property name="project.micro.version" value="0"/>
</properties>
<project name="dpml-library" basedir="library">
<info title="DPML Project Management Library">
<description>Module, project and resource management
system.</description>
</info>
- <properties>
- <property name="project.minor.version" value="1"/>
- <property name="project.micro.version" value="2"/>
- </properties>
<types>
<type id="jar"/>
</types>
@@ -40,10 +37,6 @@
<info title="DPML Depot Build Tool">
<description>Multi-project build automation tool.</description>
</info>
- <properties>
- <property name="project.minor.version" value="1"/>
- <property name="project.micro.version" value="4"/>
- </properties>
<types>
<type id="jar"/>
<part:plugin alias="true"
class="net.dpml.library.console.BuilderPlugin"/>
@@ -74,7 +67,6 @@
<property name="depot.short.filename" value="${project.name}.jar"/>
<property name="transit.short.filename" value="dpml-transit-main.jar"/>
<property name="project.jar.main.class" value="net.dpml.depot.Main"/>
- <property name="project.micro.version" value="3"/>
</properties>
<types>
<type id="jar"/>
@@ -107,10 +99,6 @@
<info title="DPML Depot Toolkit">
<description>Antlib supporting Depot-based build
automation.</description>
</info>
- <properties>
- <property name="project.minor.version" value="1"/>
- <property name="project.micro.version" value="3"/>
- </properties>
<types>
<type id="jar"/>
<part:plugin alias="true" class="net.dpml.tools.impl.StandardBuilder"/>
@@ -148,10 +136,6 @@
<info title="DPML Checkstyle Plugin">
<description>Checkstyle plugin for Depot.</description>
</info>
- <properties>
- <property name="project.minor.version" value="1"/>
- <property name="project.micro.version" value="4"/>
- </properties>
<types>
<type id="jar"/>
<part:resource alias="true" urn="dpml:checkstyle"
path="net/dpml/tools/checkstyle/antlib.xml"/>
@@ -176,9 +160,6 @@
<info title="DPML Java to HTML Converter">
<description>Checkstyle plugin for Depot.</description>
</info>
- <properties>
- <property name="project.micro.version" value="3"/>
- </properties>
<types>
<type id="jar"/>
<part:resource alias="true" urn="dpml:convert"
path="net/dpml/tools/convert/antlib.xml"/>
Modified: trunk/main/lang/component/etc/component.xsd
===================================================================
--- trunk/main/lang/component/etc/component.xsd 2006-11-24 15:09:28 UTC (rev
1788)
+++ trunk/main/lang/component/etc/component.xsd 2006-11-30 21:08:46 UTC (rev
1789)
@@ -14,6 +14,7 @@
<element name="category" type="this:CategoryType"/>
<element name="categories" type="this:CategoriesType"
substitutionGroup="this:category"/>
<element name="entry" type="this:EntryType"/>
+ <element name="context" type="this:ContextEntryType"
substitutionGroup="this:entry"/>
<element name="param" type="part:ValueType"
substitutionGroup="part:param"/>
<complexType name="component">
@@ -60,11 +61,20 @@
<complexType name="EntryType">
<complexContent>
<extension base="part:TaggedValueType">
+ <sequence>
+ <element ref="this:entry" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
<attribute name="lookup" type="string"/>
</extension>
</complexContent>
</complexType>
+ <complexType name="ContextEntryType">
+ <complexContent>
+ <extension base="this:EntryType"/>
+ </complexContent>
+ </complexType>
+
<complexType name="PartsType">
<choice minOccurs="0" maxOccurs="unbounded">
<element name="component" type="this:TaggedComponent" minOccurs="0"
maxOccurs="unbounded"/>
Modified: trunk/main/metro/component/src/main/net/dpml/component/Provider.java
===================================================================
--- trunk/main/metro/component/src/main/net/dpml/component/Provider.java
2006-11-24 15:09:28 UTC (rev 1788)
+++ trunk/main/metro/component/src/main/net/dpml/component/Provider.java
2006-11-30 21:08:46 UTC (rev 1789)
@@ -33,7 +33,7 @@
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
-public interface Provider extends Remote
+public interface Provider extends Remote, Commissionable
{
/**
* Return a parent provider.
Modified: trunk/main/metro/component/src/main/net/dpml/component/Status.java
===================================================================
--- trunk/main/metro/component/src/main/net/dpml/component/Status.java
2006-11-24 15:09:28 UTC (rev 1788)
+++ trunk/main/metro/component/src/main/net/dpml/component/Status.java
2006-11-30 21:08:46 UTC (rev 1789)
@@ -59,15 +59,20 @@
public static final Status DECOMMISSIONING = new Status(
"decommissioning" );
/**
- * The provider is not longer available.
+ * The provider has completed local decommissioning.
*/
+ public static final Status DECOMMISSIONED = new Status( "decommissioned"
);
+
+ /**
+ * The provider is decommissioned not longer available.
+ */
public static final Status DISPOSED = new Status( "disposed" );
-
+
/**
* Array of static status enumeration values.
*/
private static final Status[] ENUM_VALUES =
- new Status[]{INSTANTIATED, COMMISSIONING, AVAILABLE, DECOMMISSIONING,
DISPOSED};
+ new Status[]{INSTANTIATED, COMMISSIONING, AVAILABLE, DECOMMISSIONING,
DECOMMISSIONED, DISPOSED};
/**
* Returns an array of activation enum values.
@@ -110,6 +115,10 @@
{
return DECOMMISSIONING;
}
+ else if( DECOMMISSIONED.getName().equalsIgnoreCase( value ) )
+ {
+ return DECOMMISSIONED;
+ }
else if( DISPOSED.getName().equalsIgnoreCase( value ) )
{
return DISPOSED;
Added: trunk/main/metro/model/etc/data/components/nested-context.xml
===================================================================
--- trunk/main/metro/model/etc/data/components/nested-context.xml
2006-11-24 15:09:28 UTC (rev 1788)
+++ trunk/main/metro/model/etc/data/components/nested-context.xml
2006-11-30 21:08:46 UTC (rev 1789)
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+
+<component xmlns="@COMPONENT-XSD-URI@"
+ type="net.dpml.test.context.NestedTestComponent">
+ <context>
+ <context key="alpha">
+ <entry key="abc" value="xyz"/>
+ </context>
+ </context>
+</component>
+
Modified: trunk/main/metro/model/src/main/net/dpml/metro/PartsManager.java
===================================================================
--- trunk/main/metro/model/src/main/net/dpml/metro/PartsManager.java
2006-11-24 15:09:28 UTC (rev 1788)
+++ trunk/main/metro/model/src/main/net/dpml/metro/PartsManager.java
2006-11-30 21:08:46 UTC (rev 1789)
@@ -18,6 +18,7 @@
package net.dpml.metro;
+import net.dpml.component.Provider;
import net.dpml.component.ControlException;
import net.dpml.lang.UnknownKeyException;
@@ -52,6 +53,26 @@
ComponentHandler[] getComponentHandlers();
/**
+ * Return an array of all component handlers.
+ * @return the local component handler array
+ */
+ Provider[] getProviders();
+
+ /**
+ * Return an array of component handlers to the supplied service.
+ * @param service the service class to match against
+ * @return the local component handler array
+ */
+ Provider[] getProviders( Class service );
+
+ /**
+ * Return a component handler.
+ * @param key the internal component key
+ * @return the local component handler
+ */
+ Provider getProvider( String key ) throws UnknownKeyException;
+
+ /**
* Return an array of component handlers assignable to the supplied
service.
* @param service the service class to match against
* @return the local component handler array
Modified:
trunk/main/metro/model/src/main/net/dpml/metro/builder/ComponentDecoder.java
===================================================================
---
trunk/main/metro/model/src/main/net/dpml/metro/builder/ComponentDecoder.java
2006-11-24 15:09:28 UTC (rev 1788)
+++
trunk/main/metro/model/src/main/net/dpml/metro/builder/ComponentDecoder.java
2006-11-30 21:08:46 UTC (rev 1789)
@@ -81,8 +81,9 @@
{
final Document document = DOCUMENT_BUILDER.parse( uri );
final Element root = document.getDocumentElement();
- Resolver resolver = new SimpleResolver();
- return buildComponent( root, resolver );
+ //Resolver resolver = new SimpleResolver();
+ //return buildComponent( root, resolver );
+ return buildComponent( root, null );
}
catch( Throwable e )
{
@@ -126,13 +127,13 @@
private ComponentDirective createComponentDirective(
Element element, Resolver resolver ) throws DecodingException
{
- String classname = buildComponentClassname( element );
- String name = buildComponentName( element );
- ActivationPolicy activation = buildActivationPolicy( element );
- CollectionPolicy collection = buildCollectionPolicy( element );
- LifestylePolicy lifestyle = buildLifestylePolicy( element );
- CategoriesDirective categories = getNestedCategoriesDirective(
element );
- ContextDirective context = getNestedContextDirective( element );
+ String classname = buildComponentClassname( element, resolver );
+ String name = buildComponentName( element, resolver );
+ ActivationPolicy activation = buildActivationPolicy( element,
resolver );
+ CollectionPolicy collection = buildCollectionPolicy( element,
resolver );
+ LifestylePolicy lifestyle = buildLifestylePolicy( element, resolver
);
+ CategoriesDirective categories = getNestedCategoriesDirective(
element, resolver );
+ ContextDirective context = getNestedContextDirective( element,
resolver );
PartReference[] parts = getNestedParts( element, resolver );
URI base = getBaseURI( element, resolver );
@@ -171,7 +172,7 @@
private URI getBaseURI( Element element, Resolver resolver ) throws
DecodingException
{
- String base = ElementHelper.getAttribute( element, "uri" );
+ String base = ElementHelper.getAttribute( element, "uri", null,
resolver );
if( null == base )
{
return null;
@@ -192,14 +193,14 @@
}
}
- private String buildComponentClassname( Element element ) throws
DecodingException
+ private String buildComponentClassname( Element element, Resolver
resolver ) throws DecodingException
{
- return ElementHelper.getAttribute( element, "type" );
+ return ElementHelper.getAttribute( element, "type", null, resolver );
}
- private ActivationPolicy buildActivationPolicy( Element element ) throws
DecodingException
+ private ActivationPolicy buildActivationPolicy( Element element,
Resolver resolver ) throws DecodingException
{
- String policy = ElementHelper.getAttribute( element, "activation" );
+ String policy = ElementHelper.getAttribute( element, "activation",
null, resolver );
if( null == policy )
{
return null;
@@ -210,9 +211,9 @@
}
}
- private LifestylePolicy buildLifestylePolicy( Element element ) throws
DecodingException
+ private LifestylePolicy buildLifestylePolicy( Element element, Resolver
resolver ) throws DecodingException
{
- String policy = ElementHelper.getAttribute( element, "lifestyle",
null );
+ String policy = ElementHelper.getAttribute( element, "lifestyle",
null, resolver );
if( null != policy )
{
return LifestylePolicy.parse( policy );
@@ -223,11 +224,11 @@
}
}
- private CollectionPolicy buildCollectionPolicy( Element element ) throws
DecodingException
+ private CollectionPolicy buildCollectionPolicy( Element element,
Resolver resolver ) throws DecodingException
{
- String policy = ElementHelper.getAttribute( element, "collection" );
+ String policy = ElementHelper.getAttribute( element, "collection",
null, resolver );
if( null != policy )
- {
+ {
return CollectionPolicy.parse( policy );
}
else
@@ -236,12 +237,12 @@
}
}
- private String buildComponentName( Element element )
+ private String buildComponentName( Element element, Resolver resolver )
{
- return ElementHelper.getAttribute( element, "name" );
+ return ElementHelper.getAttribute( element, "name", null, resolver );
}
- private CategoriesDirective getNestedCategoriesDirective( Element root )
+ private CategoriesDirective getNestedCategoriesDirective( Element root,
Resolver resolver )
{
Element element = ElementHelper.getChild( root, "categories" );
if( null == element )
@@ -250,11 +251,11 @@
}
else
{
- return createCategoriesDirective( element );
+ return createCategoriesDirective( element, resolver );
}
}
- private CategoriesDirective createCategoriesDirective( Element element )
+ private CategoriesDirective createCategoriesDirective( Element element,
Resolver resolver )
{
if( null == element )
{
@@ -262,23 +263,23 @@
}
else
{
- String name = ElementHelper.getAttribute( element, "name" );
- Priority priority = createPriority( element );
- String target = ElementHelper.getAttribute( element, "target" );
- CategoryDirective[] categories = createCategoryDirectiveArray(
element );
+ String name = ElementHelper.getAttribute( element, "name", null,
resolver );
+ Priority priority = createPriority( element, resolver );
+ String target = ElementHelper.getAttribute( element, "target",
null, resolver );
+ CategoryDirective[] categories = createCategoryDirectiveArray(
element, resolver );
return new CategoriesDirective( name, priority, target,
categories );
}
}
- private CategoryDirective createCategoryDirective( Element element )
+ private CategoryDirective createCategoryDirective( Element element,
Resolver resolver )
{
- String name = ElementHelper.getAttribute( element, "name" );
- Priority priority = createPriority( element );
- String target = ElementHelper.getAttribute( element, "target" );
+ String name = ElementHelper.getAttribute( element, "name", null,
resolver );
+ Priority priority = createPriority( element, resolver);
+ String target = ElementHelper.getAttribute( element, "target", null,
resolver );
return new CategoryDirective( name, priority, target );
}
- private CategoryDirective[] createCategoryDirectiveArray( Element
element )
+ private CategoryDirective[] createCategoryDirectiveArray( Element
element, Resolver resolver )
{
Element[] children = ElementHelper.getChildren( element );
CategoryDirective[] categories = new CategoryDirective[
children.length ];
@@ -287,19 +288,19 @@
Element elem = children[i];
if( "category".equals( elem.getTagName() ) )
{
- categories[i] = createCategoryDirective( elem );
+ categories[i] = createCategoryDirective( elem, resolver );
}
else
{
- categories[i] = createCategoriesDirective( elem );
+ categories[i] = createCategoriesDirective( elem, resolver );
}
}
return categories;
}
- private Priority createPriority( Element element )
+ private Priority createPriority( Element element, Resolver resolver )
{
- String priority = ElementHelper.getAttribute( element, "priority" );
+ String priority = ElementHelper.getAttribute( element, "priority",
null, resolver );
if( null == priority )
{
return null;
@@ -310,7 +311,7 @@
}
}
- private ContextDirective getNestedContextDirective( Element root )
throws DecodingException
+ private ContextDirective getNestedContextDirective( Element root,
Resolver resolver ) throws DecodingException
{
Element context = ElementHelper.getChild( root, "context" );
if( null == context )
@@ -319,27 +320,27 @@
}
else
{
- return createContextDirective( context );
+ return createContextDirective( context, resolver );
}
}
- private ContextDirective createContextDirective( Element element )
throws DecodingException
+ private ContextDirective createContextDirective( Element element,
Resolver resolver ) throws DecodingException
{
- String classname = ElementHelper.getAttribute( element, "class" );
+ String classname = ElementHelper.getAttribute( element, "class",
null, resolver );
Element[] children = ElementHelper.getChildren( element );
PartReference[] entries = new PartReference[ children.length ];
for( int i=0; i<children.length; i++ )
{
Element elem = children[i];
- entries[i] = createContextEntryPartReference( elem );
+ entries[i] = createContextEntryPartReference( elem, resolver );
}
return new ContextDirective( classname, entries );
}
- private PartReference createContextEntryPartReference( Element element )
throws DecodingException
+ private PartReference createContextEntryPartReference( Element element,
Resolver resolver ) throws DecodingException
{
- String key = ElementHelper.getAttribute( element, "key" );
- String spec = ElementHelper.getAttribute( element, "lookup" );
+ String key = ElementHelper.getAttribute( element, "key", null,
resolver );
+ String spec = ElementHelper.getAttribute( element, "lookup", null,
resolver );
if( null != spec )
{
LookupDirective directive = new LookupDirective( spec );
@@ -350,14 +351,14 @@
String name = element.getTagName();
if( "entry".equals( name ) )
{
- ValueDirective directive = buildValueDirective( element );
+ ValueDirective directive = buildValueDirective( element,
resolver );
return new PartReference( key, directive );
}
- //else if( "component".equals( name ) )
- //{
- // ComponentDirective directive = buildComponent( element );
- // return new PartReference( key, directive );
- //}
+ else if( "context".equals( name ) )
+ {
+ ContextDirective directive = createContextDirective(
element, resolver );
+ return new PartReference( key, directive );
+ }
else
{
final String error =
@@ -372,19 +373,19 @@
* @param element the DOM element
* @return the value directive
*/
- protected ValueDirective buildValueDirective( Element element )
+ protected ValueDirective buildValueDirective( Element element, Resolver
resolver )
{
- String classname = ElementHelper.getAttribute( element, "class" );
- String method = ElementHelper.getAttribute( element, "method" );
+ String classname = ElementHelper.getAttribute( element, "class",
null, resolver );
+ String method = ElementHelper.getAttribute( element, "method", null,
resolver );
Element[] elements = ElementHelper.getChildren( element, "param" );
if( elements.length > 0 )
{
- Value[] values = VALUE_DECODER.decodeValues( elements );
+ Value[] values = VALUE_DECODER.decodeValues( elements, resolver
);
return new ValueDirective( classname, method, values );
}
else
{
- String value = ElementHelper.getAttribute( element, "value" );
+ String value = ElementHelper.getAttribute( element, "value",
null, resolver );
return new ValueDirective( classname, method, value );
}
}
@@ -417,8 +418,8 @@
private PartReference createPartReference( Element element, Resolver
resolver ) throws DecodingException
{
String tag = element.getTagName();
- String key = ElementHelper.getAttribute( element, "key" );
- int priority = getPriority( element );
+ String key = ElementHelper.getAttribute( element, "key", null,
resolver );
+ int priority = getPriority( element, resolver );
if( "component".equals( tag ) )
{
ComponentDirective directive = buildComponent( element, resolver
);
@@ -434,9 +435,9 @@
}
}
- private int getPriority( Element element ) throws DecodingException
+ private int getPriority( Element element, Resolver resolver ) throws
DecodingException
{
- String priority = ElementHelper.getAttribute( element, "priority",
"0" );
+ String priority = ElementHelper.getAttribute( element, "priority",
"0", resolver );
try
{
return Integer.parseInt( priority );
Modified:
trunk/main/metro/model/src/main/net/dpml/metro/data/ContextDirective.java
===================================================================
--- trunk/main/metro/model/src/main/net/dpml/metro/data/ContextDirective.java
2006-11-24 15:09:28 UTC (rev 1788)
+++ trunk/main/metro/model/src/main/net/dpml/metro/data/ContextDirective.java
2006-11-30 21:08:46 UTC (rev 1789)
@@ -48,7 +48,7 @@
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
-public final class ContextDirective extends AbstractDirective
+public final class ContextDirective extends AbstractDirective implements
Directive
{
//--------------------------------------------------------------------------
// static
@@ -97,7 +97,7 @@
}
/**
- * Creation of a new file target.
+ * Creation of context directive.
* @param classname the context implementation class
* @param entries the set of entry descriptors
*/
Modified:
trunk/main/metro/model/src/main/net/dpml/metro/info/CollectionPolicy.java
===================================================================
--- trunk/main/metro/model/src/main/net/dpml/metro/info/CollectionPolicy.java
2006-11-24 15:09:28 UTC (rev 1788)
+++ trunk/main/metro/model/src/main/net/dpml/metro/info/CollectionPolicy.java
2006-11-30 21:08:46 UTC (rev 1789)
@@ -79,6 +79,15 @@
{
super( label );
}
+
+ /**
+ * Return a string representation of this enumeration.
+ * @return the string value
+ */
+ public String toString()
+ {
+ return getName().toUpperCase();
+ }
/**
* Parse the supplied name.
Added:
trunk/main/metro/model/src/test/net/dpml/metro/builder/NestedContextTestCase.java
===================================================================
---
trunk/main/metro/model/src/test/net/dpml/metro/builder/NestedContextTestCase.java
2006-11-24 15:09:28 UTC (rev 1788)
+++
trunk/main/metro/model/src/test/net/dpml/metro/builder/NestedContextTestCase.java
2006-11-30 21:08:46 UTC (rev 1789)
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2005-2006 Stephen J. McConnell.
+ *
+ * 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 net.dpml.metro.builder;
+
+import java.io.File;
+import java.net.URI;
+
+import net.dpml.component.Directive;
+import net.dpml.lang.Value;
+
+import net.dpml.metro.info.PartReference;
+import net.dpml.metro.data.ContextDirective;
+import net.dpml.metro.data.ComponentDirective;
+import net.dpml.metro.data.ValueDirective;
+
+import junit.framework.TestCase;
+
+/**
+ * Default array argument in context.
+ *
+ * @author <a href="http://www.dpml.net">The Digital Product Meta Library</a>
+ */
+public class NestedContextTestCase extends TestCase
+{
+ private ComponentDecoder m_builder;
+
+ /**
+ * Testcase setup.
+ * @exception Exception if a setup error occurs
+ */
+ public void setUp() throws Exception
+ {
+ m_builder = new ComponentDecoder();
+ }
+
+ /**
+ * Test nested context.
+ * @exception Exception if an error occurs
+ */
+ public void testNestedContext() throws Exception
+ {
+ String testPath = System.getProperty( "project.test.dir" );
+ File test = new File( testPath );
+ File example = new File( test, "components/nested-context.xml" );
+ URI uri = example.toURI();
+ ComponentDirective component = m_builder.loadComponentDirective( uri
);
+ ContextDirective context = component.getContextDirective();
+ PartReference[] entries = context.getDirectives();
+ if( entries.length != 1 )
+ {
+ fail( "Number of entries is not equal to 1" );
+ }
+ else
+ {
+ PartReference entry = entries[0];
+ String key = entry.getKey();
+ if( "alpha".equals( key ) )
+ {
+ Directive directive = entry.getDirective();
+ assertEquals( "Context directive class",
ContextDirective.class, directive.getClass() );
+ ContextDirective cd = (ContextDirective) directive;
+ PartReference[] nestedEntries = cd.getDirectives();
+ if( nestedEntries.length != 1 )
+ {
+ fail( "Number of nested entries is not equal to 1" );
+ }
+ else
+ {
+ PartReference e = nestedEntries[0];
+ String k = e.getKey();
+ assertEquals( "Nested value entry key:", "abc", k );
+ Directive d = e.getDirective();
+ assertEquals( "Nest value class", ValueDirective.class,
d.getClass() );
+ }
+ }
+ else
+ {
+ fail( "Nested context key is not equal to 'alpha'" );
+ }
+ }
+ }
+}
+
+
+
Modified:
trunk/main/metro/model/src/test/net/dpml/metro/data/test/ContextDirectiveTestCase.java
===================================================================
---
trunk/main/metro/model/src/test/net/dpml/metro/data/test/ContextDirectiveTestCase.java
2006-11-24 15:09:28 UTC (rev 1788)
+++
trunk/main/metro/model/src/test/net/dpml/metro/data/test/ContextDirectiveTestCase.java
2006-11-30 21:08:46 UTC (rev 1789)
@@ -66,4 +66,19 @@
(ContextDirective) executeEncodingTest( m_context );
assertEquals( "encoded-equality", m_context, result );
}
+
+ /**
+ * Test the nexted context directive encoding/decoding.
+ * @exception Exception if an error occurs
+ */
+ public void testNestedContextEncoding() throws Exception
+ {
+ ContextDirective c = new ContextDirective( new PartReference[0] );
+ PartReference ref = new PartReference( "fred", c );
+ ContextDirective directive = new ContextDirective( new
PartReference[]{ref} );
+ ContextDirective result =
+ (ContextDirective) executeEncodingTest( directive );
+ assertEquals( "encoded-equality", directive, result );
+ }
+
}
Modified: trunk/main/metro/module.xml
===================================================================
--- trunk/main/metro/module.xml 2006-11-24 15:09:28 UTC (rev 1788)
+++ trunk/main/metro/module.xml 2006-11-30 21:08:46 UTC (rev 1789)
@@ -5,7 +5,8 @@
xmlns:part="link:xsd:dpml/lang/dpml-part#1.0">
<properties>
- <property name="project.micro.version" value="4"/>
+ <property name="project.minor.version" value="2"/>
+ <property name="project.micro.version" value="0"/>
</properties>
<project name="dpml-metro-state" basedir="state">
@@ -136,10 +137,6 @@
type and deployment data management.
</description>
</info>
- <properties>
- <property name="project.minor.version" value="1"/>
- <property name="project.micro.version" value="3"/>
- </properties>
<types>
<type id="jar"/>
<part:resource alias="true" urn="dpml:metro"
@@ -165,11 +162,6 @@
<project name="dpml-metro-test" basedir="test">
<info title="Internal Test Package"/>
- <properties>
- <property name="project.javadoc.exclude" value="true"/>
- <property name="project.minor.version" value="1"/>
- <property name="project.micro.version" value="3"/>
- </properties>
<types>
<type id="jar"/>
</types>
Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComponentHandler.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComponentHandler.java
2006-11-24 15:09:28 UTC (rev 1788)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComponentHandler.java
2006-11-30 21:08:46 UTC (rev 1789)
@@ -132,6 +132,7 @@
//--------------------------------------------------------------------------
private boolean m_active = false;
+ private Object m_singleton = null;
//--------------------------------------------------------------------------
// constructor
@@ -154,10 +155,10 @@
m_flag = flag;
String classname = model.getImplementationClassName();
- if( getLogger().isTraceEnabled() )
- {
- getLogger().trace( "creating new component handler [" + m_path +
"] for class [" + classname + "]" );
- }
+ //if( getLogger().isTraceEnabled() )
+ //{
+ // getLogger().trace( "creating new component handler [" + m_path
+ "]" );
+ //}
m_support = new PropertyChangeSupport( this );
model.addModelListener( this );
@@ -174,6 +175,14 @@
throw new ControllerException( error, e );
}
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug(
+ "loaded ["
+ + classname
+ + "]" );
+ }
+
try
{
m_type = control.loadType( m_class );
@@ -254,9 +263,7 @@
getLogger().debug(
"established "
+ lifestyleName
- + " lifestyle handler for ["
- + classname
- + "]" );
+ + " lifestyle handler." );
}
}
@@ -463,6 +470,11 @@
getLogger().debug( "activating" );
m_holder.getProvider().getValue( false );
}
+ //else if( m_model.getActivationPolicy().equals(
ActivationPolicy.SYSTEM ) && ( null != m_parent ) )
+ //{
+ // getLogger().debug( "activating" );
+ // m_holder.getProvider().getValue( false );
+ //}
m_active = true;
}
catch( RemoteException e )
@@ -512,7 +524,7 @@
if( getLogger().isTraceEnabled() )
{
- getLogger().trace( "decommissioning" );
+ getLogger().trace( "decommissioning handler" );
}
//
@@ -521,7 +533,6 @@
m_holder.decommission();
m_active = false;
- getLogger().debug( "decommissioned" );
}
/**
@@ -616,9 +627,9 @@
{
synchronized( getLock() )
{
- if( getLogger().isDebugEnabled() )
+ if( getLogger().isTraceEnabled() )
{
- getLogger().debug( "initiating disposal" );
+ getLogger().trace( "initiating disposal" );
}
decommission();
try
@@ -641,10 +652,6 @@
}
}
super.dispose();
- if( getLogger().isDebugEnabled() )
- {
- getLogger().debug( "disposal complete" );
- }
}
}
@@ -712,14 +719,6 @@
}
}
- protected void finalize() throws Throwable
- {
- if( getLogger().isTraceEnabled() )
- {
- getLogger().trace( "finalizing component handler" );
- }
- }
-
//--------------------------------------------------------------------------
// utilities
//--------------------------------------------------------------------------
@@ -825,7 +824,10 @@
{
if( getLogger().isTraceEnabled() )
{
- getLogger().trace( "assigning hard (system)
collection policy" );
+ getLogger().trace(
+ "asserting "
+ + CollectionPolicy.HARD
+ + " (system) collection policy" );
}
m_collection = CollectionPolicy.HARD;
}
@@ -833,21 +835,19 @@
{
if( getLogger().isTraceEnabled() )
{
- getLogger().trace( "assigning soft (system)
collection policy" );
+ getLogger().trace(
+ "asserting "
+ + CollectionPolicy.SOFT
+ + " (default) collection policy" );
}
m_collection = CollectionPolicy.SOFT;
}
}
else
{
- if( getLogger().isDebugEnabled() )
- {
- String name = policy.getName();
- getLogger().debug( "assigning " + name + " collection
policy" );
- }
m_collection = policy;
}
-
+
m_reference = createReference( null );
}
@@ -894,7 +894,7 @@
String getName()
{
- return "singleton";
+ return "SINGLETON:" + m_collection;
}
/**
@@ -963,7 +963,7 @@
String getName()
{
- return "transient";
+ return "TRANSIENT";
}
private DefaultProvider[] getAllProviders()
@@ -1002,7 +1002,7 @@
String getName()
{
- return "per-thread";
+ return "THREAD";
}
private DefaultProvider[] getAllProviders()
Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComponentModel.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComponentModel.java
2006-11-24 15:09:28 UTC (rev 1788)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComponentModel.java
2006-11-30 21:08:46 UTC (rev 1789)
@@ -158,7 +158,14 @@
else
{
ComponentDirective base = directive.getBaseDirective();
- return getCollectionPolicy( base );
+ if( null != base )
+ {
+ return getCollectionPolicy( base );
+ }
+ else
+ {
+ return m_type.getInfo().getCollectionPolicy();
+ }
}
}
@@ -289,10 +296,6 @@
*/
public void addModelListener( ModelListener listener )
{
- if( getLogger().isTraceEnabled() )
- {
- getLogger().trace( "adding component model listener [" +
listener + "]" );
- }
super.addListener( listener );
//m_context.addModelListener( listener ); // ???? why not directly
on context model ??
}
@@ -303,10 +306,6 @@
*/
public void removeModelListener( ModelListener listener )
{
- if( getLogger().isTraceEnabled() )
- {
- getLogger().trace( "removing component model listener [" +
listener + "]" );
- }
super.removeListener( listener );
//m_context.removeListener( listener ); // ???? why not directly on
context model ??
}
Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultPartsManager.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultPartsManager.java
2006-11-24 15:09:28 UTC (rev 1788)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultPartsManager.java
2006-11-30 21:08:46 UTC (rev 1789)
@@ -29,6 +29,7 @@
import net.dpml.component.Service;
import net.dpml.component.Directive;
import net.dpml.component.Disposable;
+import net.dpml.component.Provider;
import net.dpml.lang.Classpath;
import net.dpml.lang.UnknownKeyException;
@@ -51,6 +52,7 @@
private final DefaultProvider m_provider;
private final String[] m_keys;
private final ComponentHandler[] m_components;
+ private final Provider[] m_providers;
private boolean m_commissioned;
@@ -66,6 +68,7 @@
PartReference[] references = model.getPartReferences();
m_keys = new String[ references.length ];
m_components = new ComponentHandler[ references.length ];
+ m_providers = new Provider[ references.length ];
if( references.length > 0 )
{
@@ -118,6 +121,26 @@
throw new UnsupportedOperationException( error );
}
}
+
+ for( int i=0; i < references.length; i++ )
+ {
+ String k = m_keys[i];
+ ComponentHandler h = m_components[i];
+ try
+ {
+ m_providers[i] = h.getProvider();
+ }
+ catch( Exception e )
+ {
+ final String error =
+ "Internal error while attempting to create a subsidiary
part ["
+ + k
+ + "] in ["
+ + h
+ + "]";
+ throw new ControllerRuntimeException( error, e );
+ }
+ }
}
//-------------------------------------------------------------------
@@ -227,8 +250,67 @@
}
throw new UnknownKeyException( key );
}
+
+ /**
+ * Return an array of all component handlers.
+ * @return the local component handler array
+ */
+ public Provider[] getProviders()
+ {
+ return m_providers;
+ }
/**
+ * Return an array of component handlers to the supplied service.
+ * @param clazz the service class to match against
+ * @return the local component handler array
+ */
+ public Provider[] getProviders( Class clazz )
+ {
+ Service service = new DefaultService( clazz, Version.parse( "-1" ) );
+ ArrayList list = new ArrayList();
+ ComponentHandler[] components = getComponentHandlers();
+ for( int i=0; i<components.length; i++ )
+ {
+ ComponentHandler component = components[i];
+ try
+ {
+ if( component.isaCandidate( service ) )
+ {
+ Provider provider = m_providers[i];
+ list.add( provider );
+ }
+ }
+ catch( RemoteException e )
+ {
+ final String error =
+ "Unexpected remote exception raised during subsidiary
component evaluation."
+ + "\nProvider: " + m_provider;
+ throw new ControllerRuntimeException( error, e );
+ }
+ }
+ return (Provider[]) list.toArray( new Provider[0] );
+ }
+
+ /**
+ * Return a component handler.
+ * @param key the internal component key
+ * @return the local component handler
+ */
+ public Provider getProvider( String key ) throws UnknownKeyException
+ {
+ for( int i=0; i<m_keys.length; i++ )
+ {
+ String k = m_keys[i];
+ if( k.equals( key ) )
+ {
+ return m_providers[i];
+ }
+ }
+ throw new UnknownKeyException( key );
+ }
+
+ /**
* Return the commissioned state of the part collection.
* @return true if commissioned else false
*/
Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultProvider.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultProvider.java
2006-11-24 15:09:28 UTC (rev 1788)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultProvider.java
2006-11-30 21:08:46 UTC (rev 1789)
@@ -84,8 +84,6 @@
* The proxied instance.
*/
private final Object m_proxy;
-
- //private final StateEventPropergator m_propergator;
//-------------------------------------------------------------------
// mutable state
@@ -102,7 +100,7 @@
* Tag used within logging messages.
*/
private String m_tag;
-
+
//-------------------------------------------------------------------
// constructor
//-------------------------------------------------------------------
@@ -125,15 +123,13 @@
m_handler = handler;
- if( getLogger().isTraceEnabled() )
- {
- getLogger().trace( "provider instantiation" );
- }
+ //if( getLogger().isTraceEnabled() )
+ //{
+ // getLogger().trace( "provider instantiation" );
+ //}
State graph = m_handler.getStateGraph();
m_machine = new DefaultStateMachine( queue, logger, graph );
- //m_propergator = new StateEventPropergator();
- //m_machine.addPropertyChangeListener( m_propergator );
m_parts = new DefaultPartsManager( this );
ClassLoader classloader = m_handler.getClassLoader();
@@ -148,6 +144,49 @@
}
}
+ public void commission() throws Exception
+ {
+ if( Status.INSTANTIATED.equals( m_status ) )
+ {
+ initialize();
+ }
+ }
+
+ public void decommission()
+ {
+ synchronized( m_status )
+ {
+ if( Status.DISPOSED.equals( m_status ) )
+ {
+ return;
+ }
+ else if( Status.DECOMMISSIONING.equals( m_status ) )
+ {
+ return;
+ }
+ else if( Status.DECOMMISSIONED.equals( m_status ) )
+ {
+ return;
+ }
+ else
+ {
+ synchronized( this )
+ {
+ m_status = Status.DECOMMISSIONING;
+ if( getLogger().isTraceEnabled() )
+ {
+ getLogger().trace( "decommissioning " + m_tag );
+ }
+ if( null != m_value )
+ {
+ m_machine.terminate( m_value );
+ }
+ m_status = Status.DECOMMISSIONED;
+ }
+ }
+ }
+ }
+
void initialize()
throws RemoteException, ControlException, InvocationTargetException
{
@@ -218,7 +257,7 @@
{
if( getLogger().isTraceEnabled() )
{
- getLogger().trace( "adding state listener [" + listener + "] to
" + m_tag );
+ getLogger().trace( "adding state listener in " + m_tag );
}
m_machine.addStateListener( listener );
}
@@ -231,7 +270,7 @@
{
if( getLogger().isTraceEnabled() )
{
- getLogger().trace( "removing state listener [" + listener + "]
to " + m_tag );
+ getLogger().trace( "removing state listener in " + m_tag );
}
m_machine.removeStateListener( listener );
}
@@ -246,25 +285,23 @@
{
synchronized( m_status )
{
- if( Status.INSTANTIATED.equals( m_status ) )
+ try
{
- try
- {
- initialize();
- }
- catch( Exception e )
- {
- final String error =
- "Initialization failure.";
- throw new ControllerRuntimeException( error, e );
- }
+ commission();
}
- checkAvailable();
+ catch( Exception e )
+ {
+ final String error =
+ "Commissioning failure.";
+ throw new ControllerRuntimeException( error, e );
+ }
+
+ //checkAvailable();
if( isolate && ( null != m_proxy ) )
{
if( getLogger().isTraceEnabled() )
{
- getLogger().trace( "returning proxied service " + m_tag
);
+ getLogger().trace( "returning proxy in " + m_tag );
}
return m_proxy;
}
@@ -272,7 +309,7 @@
{
if( getLogger().isTraceEnabled() )
{
- getLogger().trace( "returning service instance " + m_tag
);
+ getLogger().trace( "returning instance in " + m_tag );
}
return m_value;
}
@@ -347,7 +384,6 @@
return m_machine.invoke( value, method, args );
}
-
/**
* Return a handler capable of supporting the requested service.
* @param service the service definition
@@ -451,16 +487,53 @@
protected void finalize() throws Throwable
{
- if( getLogger().isTraceEnabled() )
+ synchronized( m_parts )
{
- getLogger().trace( "initiating finalization in " + m_tag );
+
+ decommission();
}
- String tag = m_tag;
- dispose();
- if( getLogger().isTraceEnabled() )
+
+ /*
+ synchronized( this )
{
- getLogger().trace( "finalization completed in " + tag );
+ if( Status.AVAILABLE.equals( m_status ) )
+ {
+ synchronized( m_value )
+ {
+ if( getLogger().isTraceEnabled() )
+ {
+ getLogger().trace( "initiating synchronized
finalization in " + m_tag );
+ }
+ String tag = m_tag;
+ dispose();
+ if( getLogger().isTraceEnabled() )
+ {
+ getLogger().trace( "finalization completed in " +
tag );
+ }
+ }
+ }
+ else if( !Status.DISPOSED.equals( m_status ) )
+ {
+ try
+ {
+ if( getLogger().isTraceEnabled() )
+ {
+ getLogger().trace( "initiating finalization in " +
m_tag );
+ }
+ String tag = m_tag;
+ dispose();
+ if( getLogger().isTraceEnabled() )
+ {
+ getLogger().trace( "finalization completed in " +
tag );
+ }
+ }
+ finally
+ {
+ super.finalize();
+ }
+ }
}
+ */
}
public String toString()
@@ -506,6 +579,34 @@
{
synchronized( getLock() )
{
+ if( Status.DISPOSED.equals( m_status ) )
+ {
+ return;
+ }
+ else
+ {
+ decommission();
+ if( getLogger().isTraceEnabled() )
+ {
+ getLogger().trace( "initiating disposal of " + m_tag );
+ }
+ m_machine.terminate( m_value );
+ m_parts.decommission();
+ m_machine.dispose();
+ if( m_parts instanceof Disposable )
+ {
+ Disposable disposable = (Disposable) m_parts;
+ disposable.dispose();
+ }
+ super.dispose();
+ m_status = Status.DISPOSED;
+ if( getLogger().isTraceEnabled() )
+ {
+ getLogger().trace( "disposal of " + m_tag + " complete");
+ }
+ }
+
+ /*
if( Status.DECOMMISSIONING.equals( m_status ) ||
Status.DISPOSED.equals( m_status ) )
{
return;
@@ -518,7 +619,6 @@
m_machine.terminate( m_value );
m_parts.decommission();
- //m_machine.removePropertyChangeListener( m_propergator );
m_machine.dispose();
if( m_parts instanceof Disposable )
{
@@ -527,12 +627,13 @@
}
super.dispose();
m_status = Status.DISPOSED;
- if( getLogger().isDebugEnabled() )
+ if( getLogger().isTraceEnabled() )
{
- getLogger().debug( "instance disposal " + m_tag );
+ getLogger().trace( "disposal of " + m_tag + " complete");
}
- m_tag = null;
- m_value = null;
+ //m_tag = null;
+ //m_value = null;
+ */
}
}
@@ -559,7 +660,7 @@
public Object invoke( final Object proxy, final Method method, final
Object[] args )
throws InvocationTargetException, IllegalAccessException
{
- checkAvailable();
+ //checkAvailable();
return method.invoke( m_value, args );
}
}
Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/PartsInvocationHandler.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/PartsInvocationHandler.java
2006-11-24 15:09:28 UTC (rev 1788)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/PartsInvocationHandler.java
2006-11-30 21:08:46 UTC (rev 1789)
@@ -347,10 +347,23 @@
protected void finalize() throws Throwable
{
- if( m_provider.getLogger().isTraceEnabled() )
+ synchronized( m_provider )
{
- m_provider.getLogger().trace( "finalizing parts invocation
handler" );
}
+ /*
+ try
+ {
+ if( m_provider.getLogger().isTraceEnabled() )
+ {
+ m_provider.getLogger().trace( "finalizing parts invocation
handler" );
+ }
+ //m_provider.dispose();
+ }
+ finally
+ {
+ super.finalize();
+ }
+ */
}
public static final int GET = 1;
Modified: trunk/main/planet/http/module.xml
===================================================================
--- trunk/main/planet/http/module.xml 2006-11-24 15:09:28 UTC (rev 1788)
+++ trunk/main/planet/http/module.xml 2006-11-30 21:08:46 UTC (rev 1789)
@@ -6,8 +6,6 @@
<property name="jasper.version" value="5.5.15"/>
<property name="sl4j.version" value="1.0.1"/>
<property name="project.major.version" value="0"/>
- <property name="project.minor.version" value="0"/>
- <property name="project.micro.version" value="4"/>
</properties>
<project name="dpml-http-impl" basedir="impl">
Modified: trunk/main/planet/module.xml
===================================================================
--- trunk/main/planet/module.xml 2006-11-24 15:09:28 UTC (rev 1788)
+++ trunk/main/planet/module.xml 2006-11-30 21:08:46 UTC (rev 1789)
@@ -4,8 +4,8 @@
<properties>
<property name="project.major.version" value="0"/>
- <property name="project.minor.version" value="0"/>
- <property name="project.micro.version" value="4"/>
+ <property name="project.minor.version" value="2"/>
+ <property name="project.micro.version" value="0"/>
</properties>
<module file="http/module.xml"/>
Modified: trunk/main/station/module.xml
===================================================================
--- trunk/main/station/module.xml 2006-11-24 15:09:28 UTC (rev 1788)
+++ trunk/main/station/module.xml 2006-11-30 21:08:46 UTC (rev 1789)
@@ -5,7 +5,8 @@
xmlns:part="link:xsd:dpml/lang/dpml-part#1.0">
<properties>
- <property name="project.micro.version" value="5"/>
+ <property name="project.minor.version" value="2"/>
+ <property name="project.micro.version" value="0"/>
</properties>
<project name="dpml-station-info" basedir="info">
Modified: trunk/main/transit/core/src/main/net/dpml/lang/PartDecoder.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/lang/PartDecoder.java
2006-11-24 15:09:28 UTC (rev 1788)
+++ trunk/main/transit/core/src/main/net/dpml/lang/PartDecoder.java
2006-11-30 21:08:46 UTC (rev 1789)
@@ -261,7 +261,7 @@
}
String classname = ElementHelper.getAttribute( strategy,
"class" );
Element[] elements = ElementHelper.getChildren( strategy );
- Value[] values = VALUE_DECODER.decodeValues( elements );
+ Value[] values = VALUE_DECODER.decodeValues( elements,
resolver );
Part part = new Plugin( logger, information, classpath,
classname, values );
if( logger.isTraceEnabled() )
{
Modified: trunk/main/transit/core/src/main/net/dpml/lang/ValueDecoder.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/lang/ValueDecoder.java
2006-11-24 15:09:28 UTC (rev 1788)
+++ trunk/main/transit/core/src/main/net/dpml/lang/ValueDecoder.java
2006-11-30 21:08:46 UTC (rev 1789)
@@ -19,6 +19,7 @@
package net.dpml.lang;
import net.dpml.util.ElementHelper;
+import net.dpml.util.Resolver;
import org.w3c.dom.Element;
@@ -37,10 +38,20 @@
*/
public Value[] decodeValues( Element[] elements )
{
+ return decodeValues( elements, null );
+ }
+
+ /**
+ * Build an array of values for the supplied element array.
+ * @param elements the elements
+ * @return the resolved values
+ */
+ public Value[] decodeValues( Element[] elements, Resolver resolver )
+ {
Value[] values = new Value[ elements.length ];
for( int i=0; i<elements.length; i++ )
{
- values[i] = decodeValue( elements[i] );
+ values[i] = decodeValue( elements[i], resolver );
}
return values;
}
@@ -52,17 +63,27 @@
*/
public Value decodeValue( Element element )
{
- String classname = ElementHelper.getAttribute( element, "class" );
- String method = ElementHelper.getAttribute( element, "method" );
+ return decodeValue( element, null );
+ }
+
+ /**
+ * Build a single value instance from a supplied element.
+ * @param element the element
+ * @return the resolved value
+ */
+ public Value decodeValue( Element element, Resolver resolver )
+ {
+ String classname = ElementHelper.getAttribute( element, "class",
null, resolver );
+ String method = ElementHelper.getAttribute( element, "method", null,
resolver );
Element[] elements = ElementHelper.getChildren( element, "param" );
if( elements.length > 0 )
{
- Value[] values = decodeValues( elements );
+ Value[] values = decodeValues( elements, resolver );
return new Construct( classname, method, values );
}
else
{
- String value = ElementHelper.getAttribute( element, "value" );
+ String value = ElementHelper.getAttribute( element, "value",
null, resolver );
return new Construct( classname, method, value );
}
}
Modified: trunk/main/transit/core/src/main/net/dpml/util/ElementHelper.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/util/ElementHelper.java
2006-11-24 15:09:28 UTC (rev 1788)
+++ trunk/main/transit/core/src/main/net/dpml/util/ElementHelper.java
2006-11-30 21:08:46 UTC (rev 1789)
@@ -41,6 +41,8 @@
*/
public final class ElementHelper
{
+ private static final Resolver SIMPLE_RESOLVER = new SimpleResolver();
+
private ElementHelper()
{
// utility class
@@ -193,6 +195,16 @@
*/
public static String getValue( final Element node )
{
+ return getValue( node, null );
+ }
+
+ /**
+ * Return the value of an element.
+ * @param node the DOM node
+ * @return the node value
+ */
+ public static String getValue( final Element node, Resolver resolver )
+ {
if( null == node )
{
return null;
@@ -206,8 +218,7 @@
{
value = node.getNodeValue();
}
- //return normalize( value );
- return value;
+ return normalize( resolver, value );
}
/**
@@ -230,6 +241,18 @@
*/
public static String getAttribute( final Element node, final String key,
final String def )
{
+ return getAttribute( node, key, def, null );
+ }
+
+ /**
+ * Return the value of an element attribute.
+ * @param node the DOM node
+ * @param key the attribute key
+ * @param def the default value if the attribute is undefined
+ * @return the attribute value or the default value if undefined
+ */
+ public static String getAttribute( final Element node, final String key,
final String def, Resolver resolver )
+ {
if( null == node )
{
return def;
@@ -238,9 +261,8 @@
{
return def;
}
- //final String value = node.getAttribute( key );
- //return normalize( value );
- return node.getAttribute( key );
+ String v = node.getAttribute( key );
+ return normalize( resolver, v );
}
/**
@@ -263,6 +285,19 @@
*/
public static boolean getBooleanAttribute( final Element node, final
String key, final boolean def )
{
+ return getBooleanAttribute( node, key, def, null );
+ }
+
+ /**
+ * Return the value of an element attribute as a boolean.
+ * @param node the DOM node
+ * @param key the attribute key
+ * @param def the default value if the attribute is undefined
+ * @return the attribute value or the default value if undefined
+ */
+ public static boolean getBooleanAttribute(
+ final Element node, final String key, final boolean def, Resolver
resolver )
+ {
if( null == node )
{
return def;
@@ -274,7 +309,7 @@
}
String value = node.getAttribute( key );
- value = normalize( value );
+ value = normalize( resolver, value );
if( value.equals( "" ) )
{
return def;
@@ -299,10 +334,27 @@
*/
static String normalize( String value )
{
- return normalize( value, System.getProperties() );
+ return SIMPLE_RESOLVER.resolve( value );
}
-
+
/**
+ * Parse the value for any property tokens relative to system properties.
+ * @param value the value to parse
+ * @return the normalized string
+ */
+ static String normalize( Resolver resolver, String value )
+ {
+ if( null != resolver )
+ {
+ return resolver.resolve( value );
+ }
+ else
+ {
+ return value;
+ }
+ }
+
+ /**
* Parse the value for any property tokens relative to the supplied
properties.
* @param value the value to parse
* @param props the reference properties
Modified: trunk/main/transit/core/src/main/net/dpml/util/PropertyResolver.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/util/PropertyResolver.java
2006-11-24 15:09:28 UTC (rev 1788)
+++ trunk/main/transit/core/src/main/net/dpml/util/PropertyResolver.java
2006-11-30 21:08:46 UTC (rev 1789)
@@ -1,4 +1,5 @@
/*
+ * Copyright 2006 Stephen McConnell
* Copyright 2004 Niclas Hedhman
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -93,7 +94,7 @@
{
return null;
}
-
+
// optimization for common case.
if( value.indexOf( '$' ) < 0 )
{
@@ -111,7 +112,6 @@
while ( st.hasMoreTokens() )
{
String token = st.nextToken();
-
if( token.equals( "}" ) )
{
String name = (String) stack.pop();
@@ -119,7 +119,7 @@
if( open.equals( "${" ) )
{
String propValue = System.getProperty( name );
- if( propValue == null )
+ if( ( propValue == null ) && ( null != props ) )
{
propValue = props.getProperty( name );
}
@@ -156,7 +156,7 @@
}
return result;
}
-
+
/**
* Pushes a value on a stack
* @param stack the stack
@@ -167,8 +167,12 @@
if( stack.size() > 0 )
{
String data = (String) stack.pop();
- if( data.equals( "${" ) )
+ if( data.equals( "$" ) && !"{".equals( value ) )
{
+ stack.push( value );
+ }
+ else if( data.equals( "${" ) )
+ {
stack.push( data );
stack.push( value );
}
Copied:
trunk/main/transit/core/src/test/net/dpml/transit/PropertyResolverTestCase.java
(from rev 1785,
trunk/main/transit/core/src/test/net/dpml/transit/test/PropertyResolverTestCase.java)
===================================================================
---
trunk/main/transit/core/src/test/net/dpml/transit/test/PropertyResolverTestCase.java
2006-11-22 12:24:55 UTC (rev 1785)
+++
trunk/main/transit/core/src/test/net/dpml/transit/PropertyResolverTestCase.java
2006-11-30 21:08:46 UTC (rev 1789)
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2004 Apache Software Foundation
+ * Copyright 2005-2006 Stephen J. McConnell.
+ *
+ * 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 net.dpml.transit;
+
+import junit.framework.TestCase;
+
+import java.util.Properties;
+
+import net.dpml.util.PropertyResolver;
+
+/**
+ * Testcases for the PropertyResolver
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public class PropertyResolverTestCase extends TestCase
+{
+ private Properties m_properties;
+
+ /**
+ * Testcase setup.
+ */
+ public void setUp()
+ {
+ m_properties = new Properties();
+ m_properties.put( "abc", "def" );
+ m_properties.put( "def", "Hi" );
+ m_properties.put( "mama", "abc" );
+ m_properties.put( "papa", "def" );
+ m_properties.put( "child", "ghi" );
+ m_properties.put( "some.abc.def.ghi.value", "All that." );
+ }
+
+ /**
+ * Testcase constructor.
+ * @param name the testcase name
+ */
+ public PropertyResolverTestCase( String name )
+ {
+ super( name );
+ }
+
+ /**
+ * Test simple property resolution.
+ * @exception Exception if an error occurs
+ */
+ public void testSimple1() throws Exception
+ {
+ String src = "${abc}";
+ String result = PropertyResolver.resolve( m_properties, src );
+ String expected = "def";
+ assertEquals( expected, result );
+ }
+
+ /**
+ * Test simple property resolution.
+ * @exception Exception if an error occurs
+ */
+ public void testSimple2() throws Exception
+ {
+ String src = "Def = ${abc} is it.";
+ String result = PropertyResolver.resolve( m_properties, src );
+ String expected = "Def = def is it.";
+ assertEquals( expected, result );
+ }
+
+ /**
+ * Test simple property resolution.
+ * @exception Exception if an error occurs
+ */
+ public void testSimple3() throws Exception
+ {
+ String src = "def = ${abc} = ${def}";
+ String result = PropertyResolver.resolve( m_properties, src );
+ String expected = "def = def = Hi";
+ assertEquals( expected, result );
+ }
+
+ /**
+ * Test complex property resolution.
+ * @exception Exception if an error occurs
+ */
+ public void testComplex1() throws Exception
+ {
+ String src = "${${abc}}";
+ String result = PropertyResolver.resolve( m_properties, src );
+ String expected = "Hi";
+ assertEquals( expected, result );
+ }
+
+ /**
+ * Test complex property resolution.
+ * @exception Exception if an error occurs
+ */
+ public void testComplex2() throws Exception
+ {
+ String src = "${some.${mama}.${papa}.${child}.value}";
+ String result = PropertyResolver.resolve( m_properties, src );
+ String expected = "All that.";
+ assertEquals( expected, result );
+ }
+
+ /**
+ * Test escaped property resolution.
+ * @exception Exception if an error occurs
+ */
+ public void testEscapedSymbol() throws Exception
+ {
+ String src = "$${alpha}";
+ String result = PropertyResolver.resolve( m_properties, src );
+ String expected = "${alpha}";
+ assertEquals( expected, result );
+ }
+}
Deleted:
trunk/main/transit/core/src/test/net/dpml/transit/test/PropertyResolverTestCase.java
===================================================================
---
trunk/main/transit/core/src/test/net/dpml/transit/test/PropertyResolverTestCase.java
2006-11-24 15:09:28 UTC (rev 1788)
+++
trunk/main/transit/core/src/test/net/dpml/transit/test/PropertyResolverTestCase.java
2006-11-30 21:08:46 UTC (rev 1789)
@@ -1,120 +0,0 @@
-/*
- * Copyright 2004 Apache Software Foundation
- * Copyright 2005-2006 Stephen J. McConnell.
- *
- * 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 net.dpml.transit.test;
-
-import junit.framework.TestCase;
-
-import java.util.Properties;
-
-import net.dpml.util.PropertyResolver;
-
-/**
- * Testcases for the PropertyResolver
- *
- * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
- * @version @PROJECT-VERSION@
- */
-public class PropertyResolverTestCase extends TestCase
-{
- private Properties m_properties;
-
- /**
- * Testcase setup.
- */
- public void setUp()
- {
- m_properties = new Properties();
- m_properties.put( "abc", "def" );
- m_properties.put( "def", "Hi" );
- m_properties.put( "mama", "abc" );
- m_properties.put( "papa", "def" );
- m_properties.put( "child", "ghi" );
- m_properties.put( "some.abc.def.ghi.value", "All that." );
- }
-
- /**
- * Testcase constructor.
- * @param name the testcase name
- */
- public PropertyResolverTestCase( String name )
- {
- super( name );
- }
-
- /**
- * Test simple property resolution.
- * @exception Exception if an error occurs
- */
- public void testSimple1() throws Exception
- {
- String src = "${abc}";
- String result = PropertyResolver.resolve( m_properties, src );
- String expected = "def";
- assertEquals( expected, result );
- }
-
- /**
- * Test simple property resolution.
- * @exception Exception if an error occurs
- */
- public void testSimple2() throws Exception
- {
- String src = "Def = ${abc} is it.";
- String result = PropertyResolver.resolve( m_properties, src );
- String expected = "Def = def is it.";
- assertEquals( expected, result );
- }
-
- /**
- * Test simple property resolution.
- * @exception Exception if an error occurs
- */
- public void testSimple3() throws Exception
- {
- String src = "def = ${abc} = ${def}";
- String result = PropertyResolver.resolve( m_properties, src );
- String expected = "def = def = Hi";
- assertEquals( expected, result );
- }
-
- /**
- * Test complex property resolution.
- * @exception Exception if an error occurs
- */
- public void testComplex1() throws Exception
- {
- String src = "${${abc}}";
- String result = PropertyResolver.resolve( m_properties, src );
- String expected = "Hi";
- assertEquals( expected, result );
- }
-
- /**
- * Test complex property resolution.
- * @exception Exception if an error occurs
- */
- public void testComplex2() throws Exception
- {
- String src = "${some.${mama}.${papa}.${child}.value}";
- String result = PropertyResolver.resolve( m_properties, src );
- String expected = "All that.";
- assertEquals( expected, result );
- }
-}
Modified: trunk/main/transit/module.xml
===================================================================
--- trunk/main/transit/module.xml 2006-11-24 15:09:28 UTC (rev 1788)
+++ trunk/main/transit/module.xml 2006-11-30 21:08:46 UTC (rev 1789)
@@ -7,8 +7,8 @@
<properties>
<property name="project.test.fork" value="true"/>
<property name="project.major.version" value="1"/>
- <property name="project.minor.version" value="0"/>
- <property name="project.micro.version" value="4"/>
+ <property name="project.minor.version" value="1"/>
+ <property name="project.micro.version" value="0"/>
</properties>
<project name="dpml-transit-console" basedir="console">
@@ -16,7 +16,7 @@
<description>Transit preferences commandline handler.</description>
</info>
<properties>
- <property name="project.micro.version" value="4"/>
+ <property name="project.micro.version" value="0"/>
</properties>
<types>
<type id="jar"/>
@@ -42,7 +42,7 @@
<description>Transit resource management system.</description>
</info>
<properties>
- <property name="project.micro.version" value="3"/>
+ <property name="project.micro.version" value="0"/>
</properties>
<types>
<type id="jar"/>
@@ -68,7 +68,7 @@
<description>Transit tools for the Ant build system.</description>
</info>
<properties>
- <property name="project.micro.version" value="3"/>
+ <property name="project.micro.version" value="0"/>
</properties>
<types>
<type id="jar"/>
- r1789 - in trunk: . central/apis/src/docs/api/dpml main/depot main/depot/library/src/main/net/dpml/library/impl main/lang/component/etc main/metro main/metro/component/src/main/net/dpml/component main/metro/model/etc/data/components main/metro/model/src/main/net/dpml/metro main/metro/model/src/main/net/dpml/metro/builder main/metro/model/src/main/net/dpml/metro/data main/metro/model/src/main/net/dpml/metro/info main/metro/model/src/test/net/dpml/metro/builder main/metro/model/src/test/net/dpml/metro/data/test main/metro/runtime/src/main/net/dpml/metro/runtime main/planet main/planet/http main/station main/transit main/transit/core/src/main/net/dpml/lang main/transit/core/src/main/net/dpml/util main/transit/core/src/test/net/dpml/transit main/transit/core/src/test/net/dpml/transit/test, mcconnell at BerliOS, 11/30/2006
Archive powered by MHonArc 2.6.24.