Skip to Content.
Sympa Menu

notify-dpml - svn commit: r1758 - in development/main/home: . transit/handler/src/main/net/dpml/transit transit/handler/src/main/net/dpml/transit/artifact transit/plugin transit/plugin/etc/bin 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: r1758 - in development/main/home: . transit/handler/src/main/net/dpml/transit transit/handler/src/main/net/dpml/transit/artifact transit/plugin transit/plugin/etc/bin transit/tools/src/main/net/dpml/transit/tools
  • Date: Wed, 09 Feb 2005 03:48:42 +0100

Author: mcconnell
Date: Wed Feb 9 03:48:40 2005
New Revision: 1758

Modified:
development/main/home/build.xml
development/main/home/standard.xml

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

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

development/main/home/transit/handler/src/main/net/dpml/transit/artifact/FileCacheHandler.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/artifact/XMLHostsBuilder.java
development/main/home/transit/plugin/build.xml
development/main/home/transit/plugin/etc/bin/transit.bat

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

development/main/home/transit/tools/src/main/net/dpml/transit/tools/MainTask.java

development/main/home/transit/tools/src/main/net/dpml/transit/tools/PluginTask.java
Log:
Two things - (a) updated Transit main to improve debug information (you can
now get internal setup depug traces in and when using the -Ddpl.transit.debug
argument); and (b) update the Windows procedures and the Tansit core to
recognize the environment variable DPML_SYSTEM_HOME (with a default value of
DPML_HOEM) that allows separation of immutable content from the rest. In
principal these changes should go unnoticed if a clean build is performed.


Modified: development/main/home/build.xml
==============================================================================
--- development/main/home/build.xml (original)
+++ development/main/home/build.xml Wed Feb 9 03:48:40 2005
@@ -195,20 +195,20 @@
</taskdef>
</target>

- <target name="install.junit.check" depends="init">
- <available property="junit.available"
file="${dpml.cache}/junit/jars/${junit.filename}"/>
+ <target name="install.junit.check" depends="transit.setup">
+ <available property="cache.junit.available"
file="${dpml.cache}/junit/jars/${junit.filename}"/>
</target>

- <target name="install.junit" depends="install.junit.check,transit.setup"
unless="junit.available">
+ <target name="install.junit" depends="install.junit.check"
unless="cache.junit.available">
<get xmlns="antlib:net.dpml.transit" property="junit.path"
uri="${junit.uri}"/>
</target>

- <target name="install.ant.junit.check" depends="init">
+ <target name="install.ant.junit.check" depends="transit.setup">
<available property="ant.junit.available"
file="${dpml.cache}/ant/jars/${ant.junit.filename}"/>
</target>

- <target name="install.ant.junit"
depends="install.ant.junit.check,transit.setup">
+ <target name="install.ant.junit" depends="install.ant.junit.check"
unless="ant.junit.available">
<get xmlns="antlib:net.dpml.transit" property="ant-junit.path"
uri="${ant.junit.uri}"/>
</target>

Modified: development/main/home/standard.xml
==============================================================================
--- development/main/home/standard.xml (original)
+++ development/main/home/standard.xml Wed Feb 9 03:48:40 2005
@@ -53,10 +53,10 @@
</target>

<target name="dpml-home-create">
- <property name="dpml.cache" value="${dpml.home}/cache"/>
- <property name="dpml.docs" value="${dpml.home}/docs"/>
- <property name="dpml.dist" value="${dpml.home}/dist"/>
<mkdir dir="${dpml.home}"/>
+ <property name="dpml.cache" location="${dpml.home}/cache"/>
+ <property name="dpml.docs" location="${dpml.home}/docs"/>
+ <property name="dpml.dist" location="${dpml.home}/dist"/>
<mkdir dir="${dpml.cache}"/>
<mkdir dir="${dpml.docs}"/>
<mkdir dir="${dpml.dist}"/>
@@ -95,7 +95,7 @@

<property name="project.name" value="UNKNOWN"/>
<property name="project.type" value="jar"/>
- <property name="project.dir" value="${basedir}/target/test"/>
+ <property name="project.dir" location="${basedir}/target/test"/>

<condition property="signature.declared" value="false">
<isset property="dpml.release.signature"/>
@@ -281,7 +281,7 @@
</javac>
</target>

- <target name="package.setup" depends="prepare" if="src.main.available">
+ <target name="package.setup" depends="build" if="src.main.available">
<available file="${target.classes.dir}"
property="target.classes.available"/>
</target>

@@ -325,7 +325,7 @@
Compile the tests using the classes as the classpath and
place results into the target/test-classes directory.
-->
- <target name="build-tests" depends="prepare,build" if="src.test.available">
+ <target name="build-tests" depends="package" if="src.test.available">
<mkdir dir="${target.test-classes.dir}"/>
<javac srcdir="${target.build.test.dir}"
destdir="${target.test-classes.dir}"
@@ -361,11 +361,11 @@
<fail message="There were unittest errors." if="junit.error" />
</target>

- <target name="install.setup" depends="prepare">
+ <target name="install.setup" depends="test">
<available file="${target.deliverables.dir}"
property="deliverables.available"/>
</target>

- <target name="install" depends="package,test,install.setup"
if="deliverables.available">
+ <target name="install" depends="install.setup" if="deliverables.available">
<!--
Install any deliverables under the project cache relative to the project
group path.
-->

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
Wed Feb 9 03:48:40 2005
@@ -59,6 +59,16 @@
public static final String HOME_SYMBOL = "DPML_HOME";

/**
+ * Transit system key.
+ */
+ public static final String SYSTEM_KEY = "dpml.system.home";
+
+ /**
+ * DPML environment variable string.
+ */
+ public static final String SYSTEM_SYMBOL = "DPML_SYSTEM_HOME";
+
+ /**
* Transit trace policy system property key.
*/
public static final String TRACE_KEY =
"dpml.transit.trace.policy";
@@ -101,10 +111,18 @@
*/
public static final File DPML_HOME;

+ /**
+ * The Transit system directory. If an environment variable named
DPML_SYSTEM_HOME
+ * is defined, then the assigned value will be returned, otherwise the
+ * DPML_HOME home directory is returned.
+ */
+ public static final File DPML_SYSTEM_HOME;
+

static
{
DPML_HOME = resolveHomeDirectory();
+ DPML_SYSTEM_HOME = resolveSystemDirectory( DPML_HOME );
}

/**
@@ -321,4 +339,22 @@
return new File( user, ".dpml" );
}

+ /**
+ * Resolve the Transit directory.
+ * @return the transit system directory
+ */
+ private static File resolveSystemDirectory( File dir )
+ {
+ String home = System.getProperty( SYSTEM_KEY );
+ if( null != home )
+ {
+ return new File( home );
+ }
+ home = Environment.getEnvVariable( SYSTEM_SYMBOL );
+ if( null != home )
+ {
+ return new File( home );
+ }
+ return dir;
+ }
}

Modified:
development/main/home/transit/handler/src/main/net/dpml/transit/artifact/CacheHandlerFactory.java
==============================================================================
---
development/main/home/transit/handler/src/main/net/dpml/transit/artifact/CacheHandlerFactory.java
(original)
+++
development/main/home/transit/handler/src/main/net/dpml/transit/artifact/CacheHandlerFactory.java
Wed Feb 9 03:48:40 2005
@@ -27,6 +27,7 @@
import java.io.FileNotFoundException;

import net.dpml.transit.TransitException;
+import net.dpml.transit.monitors.Monitor;

/**
* Internal cache handler factory.
@@ -57,6 +58,11 @@
*/
private URL m_authorative;

+ /**
+ * Monitor
+ */
+ private Monitor m_monitor;
+
//
------------------------------------------------------------------------
// constructor
//
------------------------------------------------------------------------
@@ -65,9 +71,10 @@
* Creation of a new cache handler factory.
* @param authorative the authorative base url
*/
- CacheHandlerFactory( URL authorative )
+ CacheHandlerFactory( URL authorative, Monitor monitor )
{
m_authorative = authorative;
+ m_monitor = monitor;
}

//
------------------------------------------------------------------------
@@ -97,11 +104,13 @@
Class cls = getClass().getClassLoader().loadClass( classname );
Class[] params = new Class[]
{
+ Monitor.class,
ResourceHost[].class,
Properties.class
};
Object[] args = new Object[]
{
+ m_monitor,
hosts,
props
};

Modified:
development/main/home/transit/handler/src/main/net/dpml/transit/artifact/FileCacheHandler.java
==============================================================================
---
development/main/home/transit/handler/src/main/net/dpml/transit/artifact/FileCacheHandler.java
(original)
+++
development/main/home/transit/handler/src/main/net/dpml/transit/artifact/FileCacheHandler.java
Wed Feb 9 03:48:40 2005
@@ -30,6 +30,7 @@

import net.dpml.transit.Transit;
import net.dpml.transit.TransitException;
+import net.dpml.transit.monitors.Monitor;

import net.dpml.transit.monitors.CacheMonitorRouter;

@@ -53,6 +54,8 @@
*/
private TreeMap m_resourceHosts;

+ private Monitor m_monitor;
+
//
------------------------------------------------------------------------
// constructor
//
------------------------------------------------------------------------
@@ -62,8 +65,9 @@
* @param hosts the assigned hosts
* @param props the properties against which this instance will be
configured
*/
- public FileCacheHandler( ResourceHost[] hosts, Properties props )
+ public FileCacheHandler( Monitor monitor, ResourceHost[] hosts,
Properties props )
{
+ m_monitor = monitor;
m_resourceHosts = new TreeMap();
for( int i=0; i < hosts.length; i++ )
{
@@ -84,6 +88,7 @@
m_resourceHosts.put( key, hosts[i] );
}
m_cacheDir = createCacheDirectory( props );
+ m_monitor.trace( "created file based cache on: " + m_cacheDir );
}

//
------------------------------------------------------------------------

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
Wed Feb 9 03:48:40 2005
@@ -37,6 +37,7 @@

import net.dpml.transit.Transit;
import net.dpml.transit.TransitException;
+import net.dpml.transit.monitors.Monitor;

/**
* Internal class that handles the creation of resource hosts based on an
XML host
@@ -82,6 +83,11 @@
*/
private URL m_authorative;

+ /**
+ * Monitor
+ */
+ private Monitor m_monitor;
+
//
------------------------------------------------------------------------
// constructor
//
------------------------------------------------------------------------
@@ -90,10 +96,12 @@
* Creation of a new resource host factory using a supplied authoriative
* anchor url.
* @param authorative the authorative anchor
+ * @param monitor the bootstrap monitor
*/
- ResourceHostFactory( URL authorative )
+ ResourceHostFactory( URL authorative, Monitor monitor )
{
m_authorative = authorative;
+ m_monitor = monitor;
}

//
------------------------------------------------------------------------
@@ -535,6 +543,7 @@
Object instance = cons.newInstance( args );
if( instance instanceof ResourceHost )
{
+ m_monitor.trace( "created host: " + instance );
return (ResourceHost) instance;
}
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
Wed Feb 9 03:48:40 2005
@@ -189,9 +189,9 @@
try
{
URL authorative = establishAuthority( monitor );
- ResourceHostFactory rhFactory = new ResourceHostFactory(
authorative );
+ ResourceHostFactory rhFactory = new ResourceHostFactory(
authorative, monitor );
ResourceHost[] hosts = rhFactory.createResourceHosts();
- CacheHandlerFactory chFactory = new CacheHandlerFactory(
authorative );
+ CacheHandlerFactory chFactory = new CacheHandlerFactory(
authorative, monitor );
CacheHandler ch = chFactory.createCacheHandler( hosts );
m_CONTEXT = new SecuredTransitContext( authorative, hosts, ch );
return m_CONTEXT;

Modified:
development/main/home/transit/handler/src/main/net/dpml/transit/artifact/XMLHostsBuilder.java
==============================================================================
---
development/main/home/transit/handler/src/main/net/dpml/transit/artifact/XMLHostsBuilder.java
(original)
+++
development/main/home/transit/handler/src/main/net/dpml/transit/artifact/XMLHostsBuilder.java
Wed Feb 9 03:48:40 2005
@@ -179,7 +179,7 @@
}
else
{
- File dir = new File( Transit.DPML_HOME, path );
+ File dir = new File( Transit.DPML_SYSTEM_HOME, path );
dir.mkdirs();
return dir.toURL();
}

Modified: development/main/home/transit/plugin/build.xml
==============================================================================
--- development/main/home/transit/plugin/build.xml (original)
+++ development/main/home/transit/plugin/build.xml Wed Feb 9 03:48:40
2005
@@ -36,7 +36,7 @@

value="$DPML_HOME/local/${project.version}/dpml/transit/jars/dpml-transit-main-${project.version}.jar"
/>
<filter token="TRANSIT_VERSION" value="${project.version}"/>
<filter token="WINDOWS-CLI-CLASSPATH"
-
value="%DPML_HOME%\local\${project.version}\dpml\transit\jars\dpml-transit-main-${project.version}.jar"
/>
+
value="%DPML_SYSTEM_HOME%\local\${project.version}\dpml\transit\jars\dpml-transit-main-${project.version}.jar"
/>
<filter token="UNIX-CLI-CLASSPATH"

value="$DPML_HOME/local/${project.version}/dpml/transit/jars/dpml-transit-main-${project.version}.jar"
/>
</target>

Modified: development/main/home/transit/plugin/etc/bin/transit.bat
==============================================================================
--- development/main/home/transit/plugin/etc/bin/transit.bat (original)
+++ development/main/home/transit/plugin/etc/bin/transit.bat Wed Feb 9
03:48:40 2005
@@ -16,6 +16,7 @@

:SET_METRO
if "%DPML_HOME%" == "" set DPML_HOME=%USERPROFILE%\.dpml
+if "%DPML_SYSTEM_HOME%" == "" set DPML_SYSTEM_HOME=%DPML_HOME%
if "%DPML_TRANSIT_CLASSPATH%" == "" set
DPML_TRANSIT_CLASSPATH=@WINDOWS-CLI-CLASSPATH@
if "%TRANSIT_PLUGIN%" == "" set TRANSIT_PLUGIN=@TRANSIT-PLUGIN-URI@


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
Wed Feb 9 03:48:40 2005
@@ -21,10 +21,13 @@
import java.io.File;
import java.net.URL;

+import org.apache.tools.ant.Project;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.taskdefs.ImportTask;

+import net.dpml.transit.Transit;
import net.dpml.transit.artifact.Handler;
+import net.dpml.transit.monitors.Monitor;

/**
* Ant task that provides support for the import of build file templates
@@ -32,8 +35,38 @@
*
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
*/
-public class ImportArtifactTask extends ImportTask
+public class ImportArtifactTask extends ImportTask implements Monitor
{
+ /**
+ * The transit lead tag.
+ */
+ private static final String TAG = " [transit] ";
+
+ public void setProject( Project project )
+ {
+ super.setProject( project );
+ m_trace = ( null != project.getProperty( "dpml.transit.debug" ) );
+ try
+ {
+ Transit.getInstance( this );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Internal error while initializing Transit";
+ throw new BuildException( error, e );
+ }
+ }
+
+ /**
+ * A flag indicating that nested directives have been provided.
+ */
+ private boolean m_flag = false;
+
+ /**
+ * Trace enabled status.
+ */
+ private boolean m_trace = false;

//
------------------------------------------------------------------------
// Task
@@ -62,5 +95,28 @@
throw new BuildException( error, e );
}
}
+
+ /**
+ * 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( isTraceEnabled() )
+ {
+ getProject().log( TAG + message );
+ }
+ }
+
}


Modified:
development/main/home/transit/tools/src/main/net/dpml/transit/tools/MainTask.java
==============================================================================
---
development/main/home/transit/tools/src/main/net/dpml/transit/tools/MainTask.java
(original)
+++
development/main/home/transit/tools/src/main/net/dpml/transit/tools/MainTask.java
Wed Feb 9 03:48:40 2005
@@ -35,6 +35,7 @@
import net.dpml.transit.adapter.NetworkMonitorAdapter;
import net.dpml.transit.repository.Repository;
import net.dpml.transit.repository.StandardLoader;
+import net.dpml.transit.monitors.Monitor;

/**
* Task that initializes the Transit sub-system during which a transit
@@ -63,7 +64,7 @@
*
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
*/
-public class MainTask extends Task
+public class MainTask extends Task
{
//
------------------------------------------------------------------------
// static
@@ -115,10 +116,11 @@
public void execute() throws BuildException
{
Project project = getProject();
+
checkProperties( project );
if( !m_INIT )
{
- setupMonitors();
+ setupMonitors( );
File home = Transit.DPML_HOME;
log( "initialization in " + project.getName() );
m_INIT = true;
@@ -138,12 +140,10 @@
private void checkProperties( Project project ) throws BuildException
{
File home = Transit.DPML_HOME;
- File templates = new File( home, "templates" );
File docs = new File( home, "docs" );
File cache = new File( home, "cache" );
File dist = new File( home, "dist" );
updateProperty( project, "dpml.home", home.getAbsolutePath() );
- updateProperty( project, "dpml.templates",
templates.getAbsolutePath() );
updateProperty( project, "dpml.docs", docs.getAbsolutePath() );
updateProperty( project, "dpml.cache", cache.getAbsolutePath() );
updateProperty( project, "dpml.dist", dist.getAbsolutePath() );

Modified:
development/main/home/transit/tools/src/main/net/dpml/transit/tools/PluginTask.java
==============================================================================
---
development/main/home/transit/tools/src/main/net/dpml/transit/tools/PluginTask.java
(original)
+++
development/main/home/transit/tools/src/main/net/dpml/transit/tools/PluginTask.java
Wed Feb 9 03:48:40 2005
@@ -29,6 +29,7 @@

import net.dpml.transit.TransitException;

+import net.dpml.transit.Transit;
import net.dpml.transit.repository.Repository;
import net.dpml.transit.repository.StandardLoader;
import net.dpml.transit.repository.Plugin;
@@ -51,7 +52,7 @@
*/
public class PluginTask extends org.apache.tools.ant.Task
{
- private static final Repository REPOSITORY;
+ private static Repository REPOSITORY;

/**
* The uri of the plugin to load.
@@ -83,12 +84,6 @@
*/
private boolean m_flag = false;

- /** Static initialization sets up the Repository. */
- static
- {
- REPOSITORY = setupRepository();
- }
-
/**
* Create and associate a new antlib urn entry with the plugin.
* @return the new antlib entry
@@ -101,7 +96,6 @@
return antlib;
}

-
/**
* Create and associate a new task entry with the plugin.
* @return the new task entry
@@ -545,12 +539,16 @@
}
}

- private static Repository getRepository()
+ private Repository getRepository()
{
+ if( null == REPOSITORY )
+ {
+ REPOSITORY = setupRepository();
+ }
return REPOSITORY;
}

- private static Repository setupRepository()
+ private Repository setupRepository()
{
try
{
@@ -558,8 +556,9 @@
}
catch( TransitException e )
{
- e.printStackTrace();
- return null;
+ final String error =
+ "Internal error while attemting to resolve Transit
repository.";
+ throw new BuildException( error, e );
}
}
}



  • svn commit: r1758 - in development/main/home: . transit/handler/src/main/net/dpml/transit transit/handler/src/main/net/dpml/transit/artifact transit/plugin transit/plugin/etc/bin transit/tools/src/main/net/dpml/transit/tools, mcconnell, 02/08/2005

Archive powered by MHonArc 2.6.24.

Top of Page