mcconnell 2004/01/04 05:37:42
Modified:
merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl
DefaultContextModel.java
DefaultDeploymentContext.java Resources.properties
Log:
System context handling additions.
Revision Changes Path
1.4 +26 -5
avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultContextModel.java
Index: DefaultContextModel.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultContextModel.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DefaultContextModel.java 1 Jan 2004 23:34:45 -0000 1.3
+++ DefaultContextModel.java 4 Jan 2004 13:37:42 -0000 1.4
@@ -167,10 +167,31 @@
}
catch( ContextException e )
{
- final String error =
- REZ.getString(
- "context.non-standard-avalon-key.error", key );
- throw new ModelException( error );
+ if( entry.isRequired() )
+ {
+ final String error =
+ REZ.getString(
+ "context.non-standard-avalon-key.error", key );
+ throw new ModelException( error );
+ }
+ }
+ }
+ else if( key.startsWith( "urn:merlin:" ) )
+ {
+ try
+ {
+ Object value = m_context.getSystemContext().get( key );
+ m_map.put( key, value );
+ }
+ catch( ContextException e )
+ {
+ if( entry.isRequired() )
+ {
+ final String error =
+ REZ.getString(
+ "context.non-standard-avalon-key.error", key );
+ throw new ModelException( error );
+ }
}
}
else
1.3 +7 -3
avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultDeploymentContext.java
Index: DefaultDeploymentContext.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultDeploymentContext.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultDeploymentContext.java 28 Oct 2003 20:21:00 -0000 1.2
+++ DefaultDeploymentContext.java 4 Jan 2004 13:37:42 -0000 1.3
@@ -339,8 +339,12 @@
{
key = entry.getKey();
}
-
- if( key.equals( NAME_KEY ) )
+
+ if( key.startsWith( "urn:merlin:" ) )
+ {
+ return getSystemContext().get( key );
+ }
+ else if( key.equals( NAME_KEY ) )
{
return getName();
}
1.3 +1 -0
avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/Resources.properties
Index: Resources.properties
===================================================================
RCS file:
/home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/Resources.properties,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Resources.properties 7 Oct 2003 17:41:36 -0000 1.2
+++ Resources.properties 4 Jan 2004 13:37:42 -0000 1.3
@@ -88,6 +88,7 @@
context.strategy.custom=custom strategy: {0}
context.strategy.avalon=avalon strategy
context.non-standard-avalon-key.error=The component has requested a Avalon context
entry that is not know within the family of standard Avalon context keys. The
offending key is: {0}.
+context.unknown-system-key.error=The component has requested a system context entry
that is not know within the family of standard Merlin context keys. The offending key
is: {0}.
context.missing-directive.error=The component has requested a non-avalon context
entry. The container cannot resolve this request because no entry directive can be
found the matches the key: {0}.
context.unsupported-directive.error=The component has requested a context entry
under the key [{0}]. The container cannot resolve this request because the entry
directive type [{1}] is not supported at this time.
context.non-compliance-constructor.error="Custom context class [{0}] does not
implement a constructor pattern <init>( org.apache.avalon.framework.Context ).
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]