Skip to Content.
Sympa Menu

notify-dpml - svn commit: r1784 - in development/main/home: . transit/handler/src/main/net/dpml/transit transit/handler/src/main/net/dpml/transit/artifact transit/handler/src/main/net/dpml/transit/monitors transit/tools/src/main/net/dpml/transit/tools

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell AT netcompartner.com
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r1784 - in development/main/home: . transit/handler/src/main/net/dpml/transit transit/handler/src/main/net/dpml/transit/artifact transit/handler/src/main/net/dpml/transit/monitors transit/tools/src/main/net/dpml/transit/tools
  • Date: Tue, 15 Feb 2005 00:12:37 +0100

Author: mcconnell
Date: Tue Feb 15 00:12:36 2005
New Revision: 1784

Added:

development/main/home/transit/handler/src/main/net/dpml/transit/monitors/ConsoleMonitor.java
Removed:

development/main/home/transit/handler/src/main/net/dpml/transit/monitors/ConsoleSystemMonitor.java

development/main/home/transit/handler/src/main/net/dpml/transit/monitors/SilentSystemMonitor.java
Modified:
development/main/home/build.xml
development/main/home/transit/handler/src/main/net/dpml/transit/Main.java

development/main/home/transit/handler/src/main/net/dpml/transit/Transit.java

development/main/home/transit/handler/src/main/net/dpml/transit/artifact/ClassicResourceHost.java

development/main/home/transit/handler/src/main/net/dpml/transit/artifact/ResourceHost.java

development/main/home/transit/handler/src/main/net/dpml/transit/artifact/ResourceHostFactory.java

development/main/home/transit/handler/src/main/net/dpml/transit/artifact/SecuredTransitContext.java

development/main/home/transit/handler/src/main/net/dpml/transit/monitors/NullMonitor.java

development/main/home/transit/handler/src/main/net/dpml/transit/monitors/SystemMonitor.java

development/main/home/transit/tools/src/main/net/dpml/transit/tools/ImportArtifactTask.java
Log:
housekeeping

Modified: development/main/home/build.xml
==============================================================================
--- development/main/home/build.xml (original)
+++ development/main/home/build.xml Tue Feb 15 00:12:36 2005
@@ -54,7 +54,7 @@
</copy>
</target>

- <target name="build"
depends="standard.build,install.junit,install.ant.junit">
+ <target name="build" depends="standard.build,transit.setup">

<delete dir="${bundle}"/>

@@ -93,19 +93,14 @@
</copy>

<!-- build the library -->
- <mkdir dir="${local}/${transit-ant.parent}"/>
- <copy todir="${local}/${transit-ant.parent}">
- <fileset dir="${dpml.cache}/${transit-ant.parent}">
- <include name="${transit-ant.filename}"/>
- <include name="${ant.junit.filename}"/>
- </fileset>
- </copy>
+ <mkdir dir="${local}/ant/jars"/>
+ <get xmlns="antlib:net.dpml.transit" property="localAntJUnitPath"
uri="${ant.junit.uri}"/>
+ <copy file="${localAntJUnitPath}"
tofile="${local}/ant/jars/${transit-ant.filename}"/>
+ <get xmlns="antlib:net.dpml.transit" property="localAntPath"
uri="${ant.uri}"/>
+ <copy file="${localAntPath}"
tofile="${local}/ant/jars/${transit-ant.filename}"/>
<mkdir dir="${local}/junit/jars"/>
- <copy todir="${local}/junit/jars">
- <fileset dir="${dpml.cache}/junit/jars">
- <include name="${junit.filename}"/>
- </fileset>
- </copy>
+ <get xmlns="antlib:net.dpml.transit" property="localJUnitPath"
uri="${junit.uri}"/>
+ <copy file="${localJUnitPath}"
tofile="${local}/junit/jars/${junit.filename}"/>
<copy todir="${local}/dpml/util">
<fileset dir="${basedir}/util/target/deliverables"/>
<fileset dir="${basedir}/util/cli/target/deliverables"/>
@@ -130,7 +125,7 @@
<fileset dir="${basedir}/transit/plugin/target/bin"/>
</copy>
<mkdir dir="${bin}/win32"/>
- <copy toDir="${bin}/win32/">
+ <copy toDir="${bin}">
<fileset dir="${basedir}/transit/handler/target">
<include name="win32/**"/>
</fileset>

Modified:
development/main/home/transit/handler/src/main/net/dpml/transit/Main.java
==============================================================================
--- development/main/home/transit/handler/src/main/net/dpml/transit/Main.java
(original)
+++ development/main/home/transit/handler/src/main/net/dpml/transit/Main.java
Tue Feb 15 00:12:36 2005
@@ -37,8 +37,8 @@
import net.dpml.transit.monitors.CacheMonitor;
import net.dpml.transit.monitors.NetworkMonitor;
import net.dpml.transit.monitors.SystemMonitor;
-import net.dpml.transit.monitors.ConsoleSystemMonitor;
-import net.dpml.transit.monitors.SilentSystemMonitor;
+import net.dpml.transit.monitors.ConsoleMonitor;
+import net.dpml.transit.monitors.SystemMonitor;
import net.dpml.transit.util.Dictionary;

/**
@@ -118,25 +118,12 @@
}

//
- // Setup the system monitor.
- //
-
- boolean silent = false;
- for( int i=0; i < args.length; i++ )
- {
- String arg = args[i];
- if( "-Xsilent".equals( args[i] ) )
- {
- silent = true;
- break;
- }
- }
-
- //
// setup transit
//

- SystemMonitor monitor = getSystemMonitor( silent, debug );
+ ConsoleMonitor console = new ConsoleMonitor( debug );
+ SystemMonitor monitor = new SystemMonitor( console );
+
Transit transit = Transit.getInstance( monitor );
Adapter adapter = new ConsoleAdapter( debug );
RepositoryMonitor repoMonitor = new RepositoryMonitorAdapter(
adapter );
@@ -213,25 +200,6 @@
}

/**
- * Return the system monitor
- *
- * @param silent if TRUE return a silent monitor elese return a console
monitor
- * @param debug the debug policy
- * @return the system monitor
- */
- private static SystemMonitor getSystemMonitor( boolean console, boolean
debug )
- {
- if( console )
- {
- return new ConsoleSystemMonitor( debug );
- }
- else
- {
- return new SilentSystemMonitor( debug );
- }
- }
-
- /**
* Remove any locally handled command line parameters from the supplied
args.
* @param args the commandline args
* @return the applications arugments

Modified:
development/main/home/transit/handler/src/main/net/dpml/transit/Transit.java
==============================================================================
---
development/main/home/transit/handler/src/main/net/dpml/transit/Transit.java
(original)
+++
development/main/home/transit/handler/src/main/net/dpml/transit/Transit.java
Tue Feb 15 00:12:36 2005
@@ -33,6 +33,7 @@
import net.dpml.transit.artifact.SecuredTransitContext;

import net.dpml.transit.monitors.Monitor;
+import net.dpml.transit.monitors.SystemMonitor;
import net.dpml.transit.monitors.RepositoryMonitorRouter;
import net.dpml.transit.monitors.CacheMonitorRouter;
import net.dpml.transit.monitors.NetworkMonitorRouter;
@@ -160,7 +161,7 @@
public static Transit getInstance()
throws TransitException
{
- return Transit.getInstance( new NullMonitor() );
+ return Transit.getInstance( new SystemMonitor() );
}

/**
@@ -171,7 +172,7 @@
* @exception TransitException if an error occurs during establishment
* @exception NullArgumentException if the monitor argument is null.
*/
- public static Transit getInstance( Monitor monitor )
+ public static Transit getInstance( SystemMonitor monitor )
throws TransitException, NullArgumentException
{
if( null == monitor )
@@ -193,7 +194,7 @@
* @param monitor the bootstrap monitor
* @exception TransitException if an establishment error occurs
*/
- private Transit( Monitor monitor )
+ private Transit( SystemMonitor monitor )
throws TransitException
{
try

Modified:
development/main/home/transit/handler/src/main/net/dpml/transit/artifact/ClassicResourceHost.java
==============================================================================
---
development/main/home/transit/handler/src/main/net/dpml/transit/artifact/ClassicResourceHost.java
(original)
+++
development/main/home/transit/handler/src/main/net/dpml/transit/artifact/ClassicResourceHost.java
Tue Feb 15 00:12:36 2005
@@ -200,6 +200,16 @@
return m_baseUrl.getHost();
}

+ /**
+ * Returns the full host url.
+ *
+ * @return the host url
+ */
+ public URL getURL()
+ {
+ return m_baseUrl;
+ }
+
/**
* Return the host priority.
* @return the priority

Modified:
development/main/home/transit/handler/src/main/net/dpml/transit/artifact/ResourceHost.java
==============================================================================
---
development/main/home/transit/handler/src/main/net/dpml/transit/artifact/ResourceHost.java
(original)
+++
development/main/home/transit/handler/src/main/net/dpml/transit/artifact/ResourceHost.java
Tue Feb 15 00:12:36 2005
@@ -20,6 +20,7 @@

import java.io.File;
import java.io.IOException;
+import java.net.URL;

/**
* An interface that represents locations where the artifacts can be
@@ -74,6 +75,13 @@
*/
String getHostName();

+ /**
+ * Returns the full host url.
+ *
+ * @return the host url
+ */
+ URL getURL();
+
/**
* Return true if the resource host has been enabled.
*

Modified:
development/main/home/transit/handler/src/main/net/dpml/transit/artifact/ResourceHostFactory.java
==============================================================================
---
development/main/home/transit/handler/src/main/net/dpml/transit/artifact/ResourceHostFactory.java
(original)
+++
development/main/home/transit/handler/src/main/net/dpml/transit/artifact/ResourceHostFactory.java
Tue Feb 15 00:12:36 2005
@@ -38,6 +38,7 @@
import net.dpml.transit.Transit;
import net.dpml.transit.TransitException;
import net.dpml.transit.monitors.Monitor;
+import net.dpml.transit.monitors.SystemMonitor;

/**
* Internal class that handles the creation of resource hosts based on an
XML host
@@ -86,7 +87,7 @@
/**
* Monitor
*/
- private Monitor m_monitor;
+ private SystemMonitor m_monitor;

//
------------------------------------------------------------------------
// constructor
@@ -98,7 +99,7 @@
* @param authorative the authorative anchor
* @param monitor the bootstrap monitor
*/
- ResourceHostFactory( URL authorative, Monitor monitor )
+ ResourceHostFactory( URL authorative, SystemMonitor monitor )
{
m_authorative = authorative;
m_monitor = monitor;
@@ -543,8 +544,9 @@
Object instance = cons.newInstance( args );
if( instance instanceof ResourceHost )
{
- m_monitor.trace( "created host: " + instance );
- return (ResourceHost) instance;
+ ResourceHost host = (ResourceHost) instance;
+ m_monitor.notifyHostCreation( host );
+ return host;
}
else
{

Modified:
development/main/home/transit/handler/src/main/net/dpml/transit/artifact/SecuredTransitContext.java
==============================================================================
---
development/main/home/transit/handler/src/main/net/dpml/transit/artifact/SecuredTransitContext.java
(original)
+++
development/main/home/transit/handler/src/main/net/dpml/transit/artifact/SecuredTransitContext.java
Tue Feb 15 00:12:36 2005
@@ -34,7 +34,7 @@

import net.dpml.transit.Transit;
import net.dpml.transit.TransitException;
-import net.dpml.transit.monitors.Monitor;
+import net.dpml.transit.monitors.SystemMonitor;
import net.dpml.transit.monitors.NullMonitor;
import net.dpml.io.ResourceHelper;

@@ -158,7 +158,7 @@
public static SecuredTransitContext create()
throws TransitException
{
- return SecuredTransitContext.create( new NullMonitor() );
+ return SecuredTransitContext.create( new SystemMonitor() );
}

/**
@@ -172,7 +172,7 @@
* @exception NullArgumentException if the supplied monitor is null and
an instance
* of this class has not been created already.
*/
- public static SecuredTransitContext create( final Monitor monitor )
+ public static SecuredTransitContext create( final SystemMonitor monitor )
throws TransitException, NullArgumentException
{
if( m_CONTEXT != null )
@@ -190,6 +190,7 @@
try
{
URL authorative = establishAuthority( monitor );
+ monitor.notifyAuthority( authorative );
ResourceHostFactory rhFactory = new ResourceHostFactory(
authorative, monitor );
ResourceHost[] hosts = rhFactory.createResourceHosts();
CacheHandlerFactory chFactory = new CacheHandlerFactory(
authorative, monitor );
@@ -286,7 +287,7 @@
* @return the authorative url
* @exception TransitException if an error occurs during authority url
creation
*/
- private static URL establishAuthority( final Monitor monitor )
+ private static URL establishAuthority( final SystemMonitor monitor )
throws TransitException
{
try

Added:
development/main/home/transit/handler/src/main/net/dpml/transit/monitors/ConsoleMonitor.java
==============================================================================
--- (empty file)
+++
development/main/home/transit/handler/src/main/net/dpml/transit/monitors/ConsoleMonitor.java
Tue Feb 15 00:12:36 2005
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2005 Stephen 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.monitors;
+
+/**
+ * Monitor used to handle debug level trace messages
+ * produced by transit during initialization.
+ */
+ public class ConsoleMonitor implements Monitor
+ {
+ /**
+ * The transit lead tag.
+ */
+ private static final String TAG = "[transit] ";
+
+ /**
+ * The trace enabled state.
+ */
+ private final boolean m_trace;
+
+ /**
+ * Creation of a new trace monitor.
+ * @param trace the trace enable flag
+ */
+ public ConsoleMonitor( boolean trace )
+ {
+ m_trace = trace;
+ }
+
+ /**
+ * Test is trace monitoring is enabled.
+ * @return true if debug trace messages are enabled elese false
+ */
+ public boolean isTraceEnabled()
+ {
+ return m_trace;
+ }
+
+ /**
+ * Process a trace message.
+ *
+ * @param message the trace level message
+ */
+ public void trace( String message )
+ {
+ if( m_trace )
+ {
+ System.out.print( TAG );
+ System.out.println( message );
+ }
+ }
+}
+

Modified:
development/main/home/transit/handler/src/main/net/dpml/transit/monitors/NullMonitor.java
==============================================================================
---
development/main/home/transit/handler/src/main/net/dpml/transit/monitors/NullMonitor.java
(original)
+++
development/main/home/transit/handler/src/main/net/dpml/transit/monitors/NullMonitor.java
Tue Feb 15 00:12:36 2005
@@ -18,6 +18,8 @@

package net.dpml.transit.monitors;

+import java.net.URL;
+
/**
* A null monitor.
*/
@@ -40,4 +42,5 @@
public void trace( final String message )
{
}
+
}

Modified:
development/main/home/transit/handler/src/main/net/dpml/transit/monitors/SystemMonitor.java
==============================================================================
---
development/main/home/transit/handler/src/main/net/dpml/transit/monitors/SystemMonitor.java
(original)
+++
development/main/home/transit/handler/src/main/net/dpml/transit/monitors/SystemMonitor.java
Tue Feb 15 00:12:36 2005
@@ -1,5 +1,5 @@
/*
- * Copyright 2004 Niclas Hedhman.
+ * Copyright 2005 Stephen McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,16 +19,96 @@
package net.dpml.transit.monitors;

import java.net.URL;
+import java.util.List;
+import java.util.ArrayList;
+
+
+import net.dpml.transit.artifact.ResourceHost;

/**
- * Genric interface marking a class as a monitor.
- */
-public interface SystemMonitor extends Monitor
-{
+ * Monitor used to handle debug level trace messages
+ * produced by transit during initialization.
+ */
+ public class SystemMonitor implements Monitor
+ {
+ /**
+ * The trace enabled state.
+ */
+ private final Monitor m_logger;
+
+ private List m_hosts = new ArrayList();
+ private URL m_authority;
+
+ /**
+ * Creation of a new bootstrap monitor.
+ * @param trace the trace enable flag
+ */
+ public SystemMonitor()
+ {
+ this( new NullMonitor() );
+ }
+
+ /**
+ * Creation of a new bootstrap monitor.
+ * @param trace the trace enable flag
+ */
+ public SystemMonitor( Monitor logger )
+ {
+ m_logger = logger;
+ }
+
+ /**
+ * Test is trace monitoring is enabled.
+ * @return true if debug trace messages are enabled elese false
+ */
+ public boolean isTraceEnabled()
+ {
+ return m_logger.isTraceEnabled();
+ }
+
+ /**
+ * Process a trace message.
+ *
+ * @param message the trace level message
+ */
+ public void trace( String message )
+ {
+ m_logger.trace( message );
+ }
+
/**
* Notification of the authority url established by Transit.
* @param authority URL authority url
*/
- void notifyAuthority( URL authority );
+ public void notifyAuthority( URL authority )
+ {
+ m_authority = authority;
+ trace( "authority established on: " + authority );
+ }
+
+ /**
+ * Return the authority url established by Transit.
+ * @return the authority url
+ */
+ public URL getAuthority()
+ {
+ return m_authority;
+ }
+
+ /**
+ * Notification of the creation of a host entry.
+ * @param host the resource host
+ */
+ public void notifyHostCreation( ResourceHost host )
+ {
+ m_hosts.add( host );
+ trace( "host: " + host );
+ }
+
+ public ResourceHost[] getHosts()
+ {
+ return (ResourceHost[]) m_hosts.toArray( new ResourceHost[0] );
+ }
}

+

Modified:
development/main/home/transit/tools/src/main/net/dpml/transit/tools/ImportArtifactTask.java
==============================================================================
---
development/main/home/transit/tools/src/main/net/dpml/transit/tools/ImportArtifactTask.java
(original)
+++
development/main/home/transit/tools/src/main/net/dpml/transit/tools/ImportArtifactTask.java
Tue Feb 15 00:12:36 2005
@@ -28,6 +28,7 @@
import net.dpml.transit.Transit;
import net.dpml.transit.artifact.Handler;
import net.dpml.transit.monitors.Monitor;
+import net.dpml.transit.monitors.SystemMonitor;

/**
* Ant task that provides support for the import of build file templates
@@ -50,7 +51,7 @@

try
{
- Transit.getInstance( this );
+ Transit.getInstance( new SystemMonitor( this ) );
}
catch( Throwable e )
{



  • svn commit: r1784 - in development/main/home: . transit/handler/src/main/net/dpml/transit transit/handler/src/main/net/dpml/transit/artifact transit/handler/src/main/net/dpml/transit/monitors transit/tools/src/main/net/dpml/transit/tools, mcconnell, 02/14/2005

Archive powered by MHonArc 2.6.24.

Top of Page