notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
svn commit: r1185 - in development/main: metro/private/system/impl/src/main/net/dpml/system/impl metro/private/system/impl/src/main/net/dpml/system/monitors metro/private/system/test/src/test/net/dpml/system/impl/test metro/tools metro/tools/main/src/main/net/dpml/metro transit/handler/src/main/net/dpml/transit transit/handler/src/main/net/dpml/transit/monitors transit/handler/src/main/net/dpml/transit/util transit/plugin/src/main/net/dpml/transit/control util/criteria/src/main/net/dpml/criteria
- From: mcconnell AT netcompartner.com
- To: notify-dpml AT lists.ibiblio.org
- Subject: svn commit: r1185 - in development/main: metro/private/system/impl/src/main/net/dpml/system/impl metro/private/system/impl/src/main/net/dpml/system/monitors metro/private/system/test/src/test/net/dpml/system/impl/test metro/tools metro/tools/main/src/main/net/dpml/metro transit/handler/src/main/net/dpml/transit transit/handler/src/main/net/dpml/transit/monitors transit/handler/src/main/net/dpml/transit/util transit/plugin/src/main/net/dpml/transit/control util/criteria/src/main/net/dpml/criteria
- Date: Thu, 16 Dec 2004 01:53:46 +0100
Author: mcconnell
Date: Thu Dec 16 01:53:46 2004
New Revision: 1185
Added:
development/main/transit/handler/src/main/net/dpml/transit/util/Dictionary.java
(contents, props changed)
Removed:
development/main/util/criteria/src/main/net/dpml/criteria/Dictionary.java
Modified:
development/main/metro/private/system/impl/src/main/net/dpml/system/impl/DefaultSystemContextFactory.java
development/main/metro/private/system/impl/src/main/net/dpml/system/monitors/CacheMonitorLoggerAdapter.java
development/main/metro/private/system/impl/src/main/net/dpml/system/monitors/ConnectionMonitorLoggerAdapter.java
development/main/metro/private/system/impl/src/main/net/dpml/system/monitors/NetworkMonitorLoggerAdapter.java
development/main/metro/private/system/impl/src/main/net/dpml/system/monitors/RepositoryMonitorLoggerAdapter.java
development/main/metro/private/system/test/src/test/net/dpml/system/impl/test/SystemContextFactoryTestCase.java
development/main/metro/tools/index.xml
development/main/metro/tools/main/src/main/net/dpml/metro/Metro.java
development/main/transit/handler/src/main/net/dpml/transit/Main.java
development/main/transit/handler/src/main/net/dpml/transit/monitors/Monitor.java
development/main/transit/plugin/src/main/net/dpml/transit/control/CommandHandler.java
Log:
Correct the debug handling in metro thought revision of the parameter
handling approach in transit. This is an initial change - more work needed
to get is nice and clean.
Modified:
development/main/metro/private/system/impl/src/main/net/dpml/system/impl/DefaultSystemContextFactory.java
==============================================================================
---
development/main/metro/private/system/impl/src/main/net/dpml/system/impl/DefaultSystemContextFactory.java
(original)
+++
development/main/metro/private/system/impl/src/main/net/dpml/system/impl/DefaultSystemContextFactory.java
Thu Dec 16 01:53:46 2004
@@ -94,17 +94,25 @@
private final File m_home;
private boolean m_DebugMode;
private boolean m_InfoMode;
+ private Map m_params;
//
------------------------------------------------------------------------
// constructors
//
------------------------------------------------------------------------
public DefaultSystemContextFactory(
- Repository repository, Monitor[] monitors, String[] args )
+ Map map, Repository repository, Monitor[] monitors, String[] args )
throws Exception
{
assertNotNull( "repository", repository );
assertNotNull( "args", args );
+ assertNotNull( "map", map );
+
+ m_params = map;
+
+ Boolean debug = (Boolean) map.get( "urn:transit.debug.policy" );
+ assertNotNull( "urn:transit.debug.policy", debug );
+ m_DebugMode = debug.booleanValue();
Options options = buildCommandLineOptions();
ArgumentHandler handler = new ArgumentHandler( args );
@@ -112,7 +120,7 @@
String[] arguments = pair.getSelection();
CommandLineParser parser = new GnuParser();
m_line = parser.parse( options, arguments, false );
- m_DebugMode = m_line.hasOption( "debug" );
+ //m_DebugMode = m_line.hasOption( "debug" );
m_InfoMode = m_line.hasOption( "info" );
m_remainder = pair.getRemainder();
@@ -314,7 +322,8 @@
transit.getRepositoryMonitorRouter().addMonitor(
new RepositoryMonitorLoggerAdapter( repository ) );
- Monitor repositoryMonitor = getMonitor( m_monitors,
RepositoryMonitor.class );
+
+ Monitor repositoryMonitor = (Monitor) m_params.get(
"urn:transit.repository.monitor" );
if( null != repositoryMonitor )
{
transit.getRepositoryMonitorRouter().removeMonitor(
repositoryMonitor );
@@ -323,7 +332,7 @@
Logger cache = logger.getChildLogger( "cache" );
transit.getCacheMonitorRouter().addMonitor(
new CacheMonitorLoggerAdapter( cache ) );
- Monitor cacheMonitor = getMonitor( m_monitors,
CacheMonitor.class );
+ Monitor cacheMonitor = (Monitor) m_params.get(
"urn:transit.cache.monitor" );
if( null != cacheMonitor )
{
transit.getCacheMonitorRouter().removeMonitor( cacheMonitor
);
@@ -332,7 +341,7 @@
Logger network = logger.getChildLogger( "network" );
transit.getNetworkMonitorRouter().addMonitor(
new NetworkMonitorLoggerAdapter( cache ) );
- Monitor netMonitor = getMonitor( m_monitors,
NetworkMonitor.class );
+ Monitor netMonitor = (Monitor) m_params.get(
"urn:transit.network.monitor" );
if( null != netMonitor )
{
transit.getNetworkMonitorRouter().removeMonitor( netMonitor
);
Modified:
development/main/metro/private/system/impl/src/main/net/dpml/system/monitors/CacheMonitorLoggerAdapter.java
==============================================================================
---
development/main/metro/private/system/impl/src/main/net/dpml/system/monitors/CacheMonitorLoggerAdapter.java
(original)
+++
development/main/metro/private/system/impl/src/main/net/dpml/system/monitors/CacheMonitorLoggerAdapter.java
Thu Dec 16 01:53:46 2004
@@ -48,13 +48,26 @@
m_logger = logger;
}
+ public boolean isTraceEnabled()
+ {
+ return getLogger().isDebugEnabled();
+ }
+
+ public void trace( String message )
+ {
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug( message );
+ }
+ }
+
public void resourceRequested( Artifact artifact )
{
}
public void addedToLocalCache( URL resource, File localFile )
{
- getLogger().debug( "added [" + resource + "] to cache as [" +
localFile + "]" );
+ //getLogger().debug( "added [" + resource + "] to cache as [" +
localFile + "]" );
}
public void updatedLocalCache( URL resource, File localFile )
@@ -63,7 +76,7 @@
public void removedFromLocalCache( URL resource, File localFile )
{
- getLogger().debug( "removed [" + localFile + "] representing [" +
resource + "]" );
+ //getLogger().debug( "removed [" + localFile + "] representing [" +
resource + "]" );
}
public void failedDownloadFromHost( String host, Artifact artifact,
Exception e )
Modified:
development/main/metro/private/system/impl/src/main/net/dpml/system/monitors/ConnectionMonitorLoggerAdapter.java
==============================================================================
---
development/main/metro/private/system/impl/src/main/net/dpml/system/monitors/ConnectionMonitorLoggerAdapter.java
(original)
+++
development/main/metro/private/system/impl/src/main/net/dpml/system/monitors/ConnectionMonitorLoggerAdapter.java
Thu Dec 16 01:53:46 2004
@@ -45,9 +45,23 @@
m_logger = logger;
}
+ public boolean isTraceEnabled()
+ {
+ return getLogger().isDebugEnabled();
+ }
+
+
+ public void trace( String message )
+ {
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug( message );
+ }
+ }
+
public void connectionOpened( URL url )
{
- getLogger().debug( "opened connection: " + url );
+ //getLogger().debug( "opened connection: " + url );
}
public void connectStarted( URL url )
@@ -56,7 +70,7 @@
public void connectCompleted( URL url )
{
- getLogger().debug( "closed connection: " + url );
+ //getLogger().debug( "closed connection: " + url );
}
private Logger getLogger()
Modified:
development/main/metro/private/system/impl/src/main/net/dpml/system/monitors/NetworkMonitorLoggerAdapter.java
==============================================================================
---
development/main/metro/private/system/impl/src/main/net/dpml/system/monitors/NetworkMonitorLoggerAdapter.java
(original)
+++
development/main/metro/private/system/impl/src/main/net/dpml/system/monitors/NetworkMonitorLoggerAdapter.java
Thu Dec 16 01:53:46 2004
@@ -46,6 +46,20 @@
m_logger = logger;
}
+ public boolean isTraceEnabled()
+ {
+ return getLogger().isDebugEnabled();
+ }
+
+
+ public void trace( String message )
+ {
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug( message );
+ }
+ }
+
/**
* Notify the monitor of the update in the download status.
*
Modified:
development/main/metro/private/system/impl/src/main/net/dpml/system/monitors/RepositoryMonitorLoggerAdapter.java
==============================================================================
---
development/main/metro/private/system/impl/src/main/net/dpml/system/monitors/RepositoryMonitorLoggerAdapter.java
(original)
+++
development/main/metro/private/system/impl/src/main/net/dpml/system/monitors/RepositoryMonitorLoggerAdapter.java
Thu Dec 16 01:53:46 2004
@@ -38,6 +38,21 @@
m_logger = logger;
}
+ public boolean isTraceEnabled()
+ {
+ return getLogger().isDebugEnabled();
+ }
+
+
+ public void trace( String message )
+ {
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug( message );
+ }
+ }
+
+
public void sequenceInfo( String info )
{
getLogger().debug( info );
Modified:
development/main/metro/private/system/test/src/test/net/dpml/system/impl/test/SystemContextFactoryTestCase.java
==============================================================================
---
development/main/metro/private/system/test/src/test/net/dpml/system/impl/test/SystemContextFactoryTestCase.java
(original)
+++
development/main/metro/private/system/test/src/test/net/dpml/system/impl/test/SystemContextFactoryTestCase.java
Thu Dec 16 01:53:46 2004
@@ -19,6 +19,8 @@
package net.dpml.system.impl.test;
import java.net.URI;
+import java.util.Map;
+import java.util.Hashtable;
import junit.framework.TestCase;
import net.dpml.system.Factory;
@@ -46,9 +48,11 @@
// create the system context
//
+ Map data = new Hashtable();
+ data.put( "urn:transit.debug.policy", new Boolean( false ) );
URI uri = new URI( "@SYSTEM-PLUGIN-URI@" );
ClassLoader classloader =
SystemContextFactoryTestCase.class.getClassLoader();
- Object[] params = new Object[0];
+ Object[] params = new Object[]{data};
Object object = repository.getPlugin( classloader, uri, params );
Factory systemfactory = (Factory) object;
m_context = (SystemContext) systemfactory.create();
Modified: development/main/metro/tools/index.xml
==============================================================================
--- development/main/metro/tools/index.xml (original)
+++ development/main/metro/tools/index.xml Thu Dec 16 01:53:46 2004
@@ -74,9 +74,10 @@
<include key="dpml-logging-spi" tag="spi"/>
<include key="dpml-util-i18n"/>
<include key="dpml-util-exception"/>
+ <include key="dpml-util-criteria"/>
+ <include key="dpml-util-cli"/>
<include key="dpml-system-impl" build="false"/>
<include key="dpml-composition-impl" build="false"/>
- <include key="dpml-util-cli"/>
<include key="commons-cli"/>
</dependencies>
</project>
Modified: development/main/metro/tools/main/src/main/net/dpml/metro/Metro.java
==============================================================================
--- development/main/metro/tools/main/src/main/net/dpml/metro/Metro.java
(original)
+++ development/main/metro/tools/main/src/main/net/dpml/metro/Metro.java
Thu Dec 16 01:53:46 2004
@@ -29,6 +29,7 @@
import java.util.ArrayList;
import java.util.Properties;
import java.util.StringTokenizer;
+import java.util.Map;
import net.dpml.activity.Startable;
import net.dpml.cli.ArgumentHandler;
@@ -114,23 +115,22 @@
* Creation of a new metro instance using a supplied bootstrap repository
* plugin descriptor and commandline arguments.
*
+ * @param map transit deployment parameters
* @param repository the bootstrap system repository
* @param descriptor the descriptor of this plugin
* @param args command line arguments
*/
- public Metro( Repository repository, Plugin descriptor, Monitor[]
monitors, String[] args )
+ public Metro( Map map, Repository repository, Plugin descriptor,
Monitor[] monitors, String[] args )
throws IOException, ParseException, Exception
{
+ Boolean debug = (Boolean) map.get( "urn:transit.debug.policy" );
+
+ assertNotNull( "urn:transit.debug.policy", debug );
assertNotNull( "repository", repository );
assertNotNull( "descriptor", descriptor );
assertNotNull( "args", args );
//
- // TODO: we need a plain old monitor to log between now and when the
- // system context is established
- //
-
- //
// create the inital context for the application
//
@@ -162,7 +162,7 @@
Properties properties = getInitialProperties();
URI system = getSystemContextURI( properties );
- m_system = loadSystemContext( repository, system, monitors,
pair.getRemainder() );
+ m_system = loadSystemContext( map, repository, system, monitors,
pair.getRemainder() );
m_logger = m_system.getLogger();
getLogger().debug( "system context established" );
@@ -308,13 +308,13 @@
}
private SystemContext loadSystemContext(
- Repository repository, URI uri, Monitor[] monitors, String[] args )
+ Map map, Repository repository, URI uri, Monitor[] monitors, String[]
args )
throws SystemException
{
try
{
ClassLoader classloader = SystemContext.class.getClassLoader();
- Object[] params = new Object[]{ monitors, args };
+ Object[] params = new Object[]{ map, monitors, args };
Object object = repository.getPlugin( classloader, uri, params );
if( object instanceof SystemContextFactory )
{
Modified: development/main/transit/handler/src/main/net/dpml/transit/Main.java
==============================================================================
--- development/main/transit/handler/src/main/net/dpml/transit/Main.java
(original)
+++ development/main/transit/handler/src/main/net/dpml/transit/Main.java
Thu Dec 16 01:53:46 2004
@@ -20,6 +20,8 @@
import java.net.URI;
import java.util.ArrayList;
+import java.util.Map;
+import java.util.Hashtable;
import net.dpml.transit.adapter.Adapter;
import net.dpml.transit.adapter.RepositoryMonitorAdapter;
@@ -31,6 +33,7 @@
import net.dpml.transit.monitors.RepositoryMonitor;
import net.dpml.transit.monitors.CacheMonitor;
import net.dpml.transit.monitors.NetworkMonitor;
+import net.dpml.transit.util.Dictionary;
/**
* CLI hander for the transit package.
@@ -48,11 +51,13 @@
/**
* The main method is the static commandline entry point for transit
enabled
- * applications. The implementation requires a system property named
"dpml.transit.bootstrap.uri"
+ * applications. The implementation requires a cli argument
"-Xbootstrap=[artifact]"
* referencing an artifact uri of a transit plugin to be deployed as the
target
* application. On completion of the establishment of a series of
console based
* monitors, the implementation passes command line arguments to the
application
- * plugin using the transit application deployment service.
+ * plugin using the transit application deployment service. Debug level
trace
+ * messages related to transit initialization can be enabled by including
the
+ * "-Xdebug" commandline option.
*
* @param args command line argument to be passed to the application
* @exception Exception if a deployment error occurs
@@ -150,8 +155,15 @@
String[] arguments = collapseArgs( args );
URI uri = Artifact.createArtifact( path ).toURI();
+
+ Map data = new Hashtable();
+ data.put( "urn:transit.repository.monitor", repoMonitor );
+ data.put( "urn:transit.cache.monitor", cacheMonitor );
+ data.put( "urn:transit.network.monitor", netMonitor );
+ Map map = new Dictionary( data );
+
Monitor[] monitors = new Monitor[]{repoMonitor, cacheMonitor,
netMonitor};
- Object[] params = new Object[]{monitors, arguments};
+ Object[] params = new Object[]{map, monitors, arguments};
adapter.debug( "Starting transit." );
adapter.debug( uri.toString() );
Modified:
development/main/transit/handler/src/main/net/dpml/transit/monitors/Monitor.java
==============================================================================
---
development/main/transit/handler/src/main/net/dpml/transit/monitors/Monitor.java
(original)
+++
development/main/transit/handler/src/main/net/dpml/transit/monitors/Monitor.java
Thu Dec 16 01:53:46 2004
@@ -23,6 +23,8 @@
*/
public interface Monitor
{
+ final Monitor NULL_MONITOR = new NullMonitor();
+
/**
* Test is trace monitoring is enabled.
* @return true if debug trace messages are enabled elese false
Added:
development/main/transit/handler/src/main/net/dpml/transit/util/Dictionary.java
==============================================================================
--- (empty file)
+++
development/main/transit/handler/src/main/net/dpml/transit/util/Dictionary.java
Thu Dec 16 01:53:46 2004
@@ -0,0 +1,263 @@
+/*
+ * Copyright 2004 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.util;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * The dictionary class is a read-only map of keyed values.
+ *
+ * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @version $Id: Criteria.java 259 2004-10-30 07:24:40Z mcconnell $
+ */
+public class Dictionary implements Map
+{
+ //--------------------------------------------------------------
+ // state
+ //--------------------------------------------------------------
+
+ /**
+ * The map backing the dictionary.
+ */
+ private final Map m_map;
+
+ //--------------------------------------------------------------
+ // constructor
+ //--------------------------------------------------------------
+
+ /**
+ * Creation of a new criteria instance.
+ * @param map the key value pairs
+ */
+ public Dictionary( final Map map )
+ {
+ if( null == map )
+ {
+ throw new NullPointerException( "map" );
+ }
+ m_map = map;
+ }
+
+ //--------------------------------------------------------------
+ // Map
+ //--------------------------------------------------------------
+
+ /**
+ * Returns the number of key-value mappings in this map. If the
+ * map contains more than <tt>Integer.MAX_VALUE</tt> elements, returns
+ * <tt>Integer.MAX_VALUE</tt>.
+ *
+ * @return the number of key-value mappings in this map.
+ */
+ public int size()
+ {
+ return m_map.size();
+ }
+
+ /**
+ * Returns <tt>true</tt> if this map contains no key-value mappings.
+ *
+ * @return <tt>true</tt> if this map contains no key-value mappings.
+ */
+ public boolean isEmpty()
+ {
+ return m_map.isEmpty();
+ }
+
+ /**
+ * Returns <tt>true</tt> if this map contains a mapping for the specified
+ * key. More formally, returns <tt>true</tt> if and only if
+ * this map contains at a mapping for a key <tt>k</tt> such that
+ * <tt>(key==null ? k==null : key.equals(k))</tt>. (There can be
+ * at most one such mapping.)
+ *
+ * @param key key whose presence in this map is to be tested.
+ * @return <tt>true</tt> if this map contains a mapping for the specified
+ * key.
+ *
+ * @throws ClassCastException if the key is of an inappropriate type for
+ * this map (optional).
+ * @throws NullPointerException if the key is <tt>null</tt> and this map
+ * does not not permit <tt>null</tt> keys (optional).
+ */
+ public boolean containsKey( Object key ) throws ClassCastException,
NullPointerException
+ {
+ return m_map.containsKey( key );
+ }
+
+ /**
+ * Returns <tt>true</tt> if this map maps one or more keys to the
+ * specified value. More formally, returns <tt>true</tt> if and only if
+ * this map contains at least one mapping to a value <tt>v</tt> such that
+ * <tt>(value==null ? v==null : value.equals(v))</tt>. This operation
+ * will probably require time linear in the map size for most
+ * implementations of the <tt>Map</tt> interface.
+ *
+ * @param value value whose presence in this map is to be tested.
+ * @return <tt>true</tt> if this map maps one or more keys to the
+ * specified value.
+ * @throws ClassCastException if the value is of an inappropriate type
for
+ * this map (optional).
+ * @throws NullPointerException if the value is <tt>null</tt> and this
map
+ * does not not permit <tt>null</tt> values (optional).
+ */
+ public boolean containsValue( Object value ) throws ClassCastException,
NullPointerException
+ {
+ return m_map.containsValue( value );
+ }
+
+ /**
+ * Returns the value to which this map maps the specified key. Returns
+ * <tt>null</tt> if the map contains no mapping for this key. A return
+ * value of <tt>null</tt> does not <i>necessarily</i> indicate that the
+ * map contains no mapping for the key; it's also possible that the map
+ * explicitly maps the key to <tt>null</tt>. The <tt>containsKey</tt>
+ * operation may be used to distinguish these two cases.
+ *
+ * <p>More formally, if this map contains a mapping from a key
+ * <tt>k</tt> to a value <tt>v</tt> such that <tt>(key==null ? k==null :
+ * key.equals(k))</tt>, then this method returns <tt>v</tt>; otherwise
+ * it returns <tt>null</tt>. (There can be at most one such mapping.)
+ *
+ * @param key key whose associated value is to be returned.
+ * @return the value to which this map maps the specified key, or
+ * <tt>null</tt> if the map contains no mapping for this key.
+ *
+ * @throws ClassCastException if the key is of an inappropriate type for
+ * this map (optional).
+ * @throws NullPointerException key is <tt>null</tt> and this map does
not
+ * not permit <tt>null</tt> keys (optional).
+ *
+ * @see #containsKey(Object)
+ */
+ public Object get( Object key ) throws ClassCastException,
NullPointerException
+ {
+ return m_map.get( key );
+ }
+
+ /**
+ * The dictionary class does not support modification of the map and as
+ * such this implementation will allways throw an
UnsupportedOperationException.
+ *
+ * @param key key with which the specified value is to be associated.
+ * @param value value to be associated with the specified key.
+ * @return nothing.
+ *
+ * @throws UnsupportedOperationException in all cases
+ */
+ public Object put( Object key, Object value ) throws
UnsupportedOperationException
+ {
+ throw new UnsupportedOperationException( "put" );
+ }
+
+ /**
+ * The dictionary class does not support modification of the map and as
+ * such this implementation will allways throw an
UnsupportedOperationException.
+ *
+ * @param key key whose mapping is to be removed from the map.
+ * @return nothing
+ *
+ * @throws UnsupportedOperationException in all cases
+ */
+ public Object remove( Object key ) throws UnsupportedOperationException
+ {
+ throw new UnsupportedOperationException( "remove" );
+ }
+
+ /**
+ * The dictionary class does not support modification of the map and as
+ * such this implementation will allways throw an
UnsupportedOperationException.
+ *
+ * @param map Mappings to be stored in this map.
+ *
+ * @throws UnsupportedOperationException in all cases
+ */
+ public void putAll( Map map ) throws UnsupportedOperationException
+ {
+ throw new UnsupportedOperationException( "putAll" );
+ }
+
+ /**
+ * The dictionary class does not support modification of the map and as
+ * such this implementation will allways throw an
UnsupportedOperationException.
+ *
+ * @throws UnsupportedOperationException in all cases
+ */
+ public void clear() throws UnsupportedOperationException
+ {
+ throw new UnsupportedOperationException( "clear" );
+ }
+
+ // Views
+
+ /**
+ * Returns a set view of the keys contained in this map. The set is
+ * backed by the map, so changes to the map are reflected in the set, and
+ * vice-versa. If the map is modified while an iteration over the set is
+ * in progress, the results of the iteration are undefined. The set
+ * supports element removal, which removes the corresponding mapping from
+ * the map, via the <tt>Iterator.remove</tt>, <tt>Set.remove</tt>,
+ * <tt>removeAll</tt> <tt>retainAll</tt>, and <tt>clear</tt> operations.
+ * It does not support the add or <tt>addAll</tt> operations.
+ *
+ * @return a set view of the keys contained in this map.
+ */
+ public Set keySet()
+ {
+ return m_map.keySet();
+ }
+
+ /**
+ * Returns a collection view of the values contained in this map. The
+ * collection is backed by the map, so changes to the map are reflected
in
+ * the collection, and vice-versa. If the map is modified while an
+ * iteration over the collection is in progress, the results of the
+ * iteration are undefined. The collection supports element removal,
+ * which removes the corresponding mapping from the map, via the
+ * <tt>Iterator.remove</tt>, <tt>Collection.remove</tt>,
+ * <tt>removeAll</tt>, <tt>retainAll</tt> and <tt>clear</tt> operations.
+ * It does not support the add or <tt>addAll</tt> operations.
+ *
+ * @return a collection view of the values contained in this map.
+ */
+ public Collection values()
+ {
+ return m_map.values();
+ }
+
+ /**
+ * Returns a set view of the mappings contained in this map. Each
element
+ * in the returned set is a {@link Map.Entry}. The set is backed by the
+ * map, so changes to the map are reflected in the set, and vice-versa.
+ * If the map is modified while an iteration over the set is in progress,
+ * the results of the iteration are undefined. The set supports element
+ * removal, which removes the corresponding mapping from the map, via the
+ * <tt>Iterator.remove</tt>, <tt>Set.remove</tt>, <tt>removeAll</tt>,
+ * <tt>retainAll</tt> and <tt>clear</tt> operations. It does not support
+ * the <tt>add</tt> or <tt>addAll</tt> operations.
+ *
+ * @return a set view of the mappings contained in this map.
+ */
+ public Set entrySet()
+ {
+ return m_map.entrySet();
+ }
+}
Modified:
development/main/transit/plugin/src/main/net/dpml/transit/control/CommandHandler.java
==============================================================================
---
development/main/transit/plugin/src/main/net/dpml/transit/control/CommandHandler.java
(original)
+++
development/main/transit/plugin/src/main/net/dpml/transit/control/CommandHandler.java
Thu Dec 16 01:53:46 2004
@@ -23,6 +23,8 @@
import java.net.URL;
import java.util.ArrayList;
import java.util.StringTokenizer;
+import java.util.Map;
+import java.util.Hashtable;
import net.dpml.cli.ArgumentHandler;
@@ -31,6 +33,7 @@
import net.dpml.transit.repository.Repository;
import net.dpml.transit.repository.RepositoryException;
import net.dpml.transit.artifact.Handler;
+import net.dpml.transit.util.Dictionary;
import net.dpml.exception.ExceptionHelper;
@@ -98,6 +101,11 @@
*/
private final Repository m_repository;
+ /**
+ * The paarameters.
+ */
+ private final Map m_map;
+
//
------------------------------------------------------------------------
// constructors
//
------------------------------------------------------------------------
@@ -105,20 +113,22 @@
/**
* Execution of command line options.
*
+ * @param map the bootstrap parameters
* @param repository the bootstrap system repository
* @param descriptor the descriptor of this plugin
* @param args supplimentary command line arguments
* @exception IOException if an IO related error occurs
* @exception ParseException if a commandline parsing error occurs
-
*/
- public CommandHandler( Repository repository, Plugin descriptor,
String[] args )
+ public CommandHandler( Map map, Repository repository, Plugin
descriptor, String[] args )
throws IOException, ParseException
{
+ assertNotNull( "map", map );
assertNotNull( "repository", repository );
assertNotNull( "descriptor", descriptor );
assertNotNull( "args", args );
+ m_map = map;
m_repository = repository;
//
@@ -266,9 +276,13 @@
*/
private Object loadPluginInstance( String target )
{
+ Map map = new Hashtable( m_map );
+ map.put( "urn:transit.debug.policy", new Boolean( m_debug ) );
+ map.put( "urn:transit.cli.args", m_args );
+ Dictionary dictionary = new Dictionary( map );
+
ClassLoader loader = CommandHandler.class.getClassLoader();
- //TracePolicy trace = new TracePolicy( m_debug );
- Object[] args = new Object[]{m_args};
+ Object[] args = new Object[]{dictionary,m_args};
try
{
URI uri = new URI( target );
- svn commit: r1185 - in development/main: metro/private/system/impl/src/main/net/dpml/system/impl metro/private/system/impl/src/main/net/dpml/system/monitors metro/private/system/test/src/test/net/dpml/system/impl/test metro/tools metro/tools/main/src/main/net/dpml/metro transit/handler/src/main/net/dpml/transit transit/handler/src/main/net/dpml/transit/monitors transit/handler/src/main/net/dpml/transit/util transit/plugin/src/main/net/dpml/transit/control util/criteria/src/main/net/dpml/criteria, mcconnell, 12/15/2004
Archive powered by MHonArc 2.6.24.