CVS: plexus-container-new/src/java/org/apache/plexus/util ContextMapAdapter.java,NONE,1.1

[email protected]
Newsgroups gmane.comp.java.plexus.devel
Message-ID <[email protected]>
Update of /cvsroot/plexus/plexus-container-new/src/java/org/apache/plexus/util
In directory eng.werken.com:/tmp/cvs-serv7788/src/java/org/apache/plexus/util

Added Files:
	ContextMapAdapter.java 
Log Message:
o Clarifying name of the container host.
o Using the context as the source of values for the configuration resource
  interpolation. As a result I cleaned up anything to do with configuration
  variables as this is redundant given the existence of the context.
o Created a simple adapter so that a context can be used as a Map in the
  InterpolationFilterReader.
o Added test cases for the ContextMapAdapter and the InterpolationFilterReader
  using the adapter.


--- NEW FILE: ContextMapAdapter.java ---
package org.apache.plexus.util;

import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.context.ContextException;

import java.util.HashMap;

public class ContextMapAdapter
    extends HashMap
{
    private Context context;

    public ContextMapAdapter( Context context )
    {
        this.context = context;
    }

    public Object get( Object key )
    {
        try
        {
            return context.get( key );
        }
        catch ( ContextException e )
        {
            return null;
        }
    }
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.