mcconnell 2002/12/27 08:13:38
Modified: assembly/src/java/org/apache/avalon/assembly/locator
DefaultLocator.java
Log:
General upgrade to seperate resolution and alias management.
Revision Changes Path
1.2 +31 -3
avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/locator/DefaultLocator.java
Index: DefaultLocator.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/locator/DefaultLocator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultLocator.java 23 Dec 2002 00:13:35 -0000 1.1
+++ DefaultLocator.java 27 Dec 2002 16:13:38 -0000 1.2
@@ -96,6 +96,11 @@
private final Locator m_parent;
/**
+ * A map of data values keyed by entry label.
+ */
+ private final Dictionary m_dictionary;
+
+ /**
* The readonly state of the locator.
*/
private boolean m_readOnly;
@@ -148,8 +153,31 @@
*/
public DefaultLocator( final Map data, final Locator parent )
{
- m_parent = parent;
+ this( data, parent, new Dictionary() );
+ }
+
+ /**
+ * Create a Locator with specified data and parent locator.
+ *
+ * @param data the locator data
+ * @param parent the parent Locator (may be null)
+ * @exception NullPointerException if either the supplied dictionary or
+ * data arguments are null
+ */
+ public DefaultLocator( final Map data, final Locator parent, final Dictionary
dictionary )
+ throws NullPointerException
+ {
+ if( data == null )
+ {
+ throw new NullPointerException( "data" );
+ }
+ if( dictionary == null )
+ {
+ throw new NullPointerException( "dictionary" );
+ }
m_data = data;
+ m_dictionary = dictionary;
+ m_parent = parent;
}
//--------------------------------------------------------------------
@@ -165,7 +193,7 @@
{
try
{
- get( key );
+ get( m_dictionary.translate( key ) );
return true;
}
catch( LocatorException le )
@@ -228,7 +256,7 @@
throws LocatorException
{
- final Object data = get( key );
+ final Object data = get( m_dictionary.translate( key ) );
if( data instanceof Reclaimable )
{
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>