Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2944 - in development/main: magic/core magic/core/src/main/net/dpml/magic/builder magic/core/src/test/net/dpml/magic/builder/test transit transit/core transit/core/etc transit/core/handler/src/main/net/dpml/transit transit/core/handler/src/main/net/dpml/transit/link transit/core/handler/src/main/net/dpml/transit/util transit/core/handler/src/test/net/dpml/transit/util transit/core/tools/src/main/net/dpml/transit/tools transit/etc

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell AT dpml.net
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r2944 - in development/main: magic/core magic/core/src/main/net/dpml/magic/builder magic/core/src/test/net/dpml/magic/builder/test transit transit/core transit/core/etc transit/core/handler/src/main/net/dpml/transit transit/core/handler/src/main/net/dpml/transit/link transit/core/handler/src/main/net/dpml/transit/util transit/core/handler/src/test/net/dpml/transit/util transit/core/tools/src/main/net/dpml/transit/tools transit/etc
  • Date: Fri, 01 Jul 2005 01:25:39 -0400

Author: mcconnell AT dpml.net
Date: Fri Jul 1 01:25:38 2005
New Revision: 2944

Added:
development/main/transit/core/handler/src/test/net/dpml/transit/util/

development/main/transit/core/handler/src/test/net/dpml/transit/util/PropertyResolverTestCase.java
development/main/transit/etc/standard.template.link
Removed:

development/main/magic/core/src/main/net/dpml/magic/builder/PropertyResolver.java

development/main/magic/core/src/test/net/dpml/magic/builder/test/PropertyResolverTestCase.java
Modified:
development/main/magic/core/build.xml

development/main/magic/core/src/main/net/dpml/magic/builder/ElementHelper.java
development/main/transit/build.xml
development/main/transit/core/build.xml
development/main/transit/core/etc/project.module.link

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

development/main/transit/core/handler/src/main/net/dpml/transit/link/ArtifactLinkManager.java

development/main/transit/core/handler/src/main/net/dpml/transit/util/PropertyResolver.java

development/main/transit/core/tools/src/main/net/dpml/transit/tools/ImportArtifactTask.java
development/main/transit/standard.xml
Log:
o Remove the non-versioned usage of artifact:template:dpml/transit/standard.
o Remove duplicate PropertyResolver class from Magic.
o Add possibility to declare links that contain unresolved symbols.
o Fix bug in Transit distribution build.
o Move PropertyResolver task case down to Transit.

Modified: development/main/magic/core/build.xml
==============================================================================
--- development/main/magic/core/build.xml (original)
+++ development/main/magic/core/build.xml Fri Jul 1 01:25:38 2005
@@ -21,7 +21,7 @@
<project name="dpml-magic-core" default="install" basedir="."
xmlns:transit="antlib:net.dpml.transit">

- <transit:import uri="artifact:template:dpml/transit/standard"/>
+ <transit:import uri="link:template:dpml/transit/standard"/>

<target name="init" depends="standard.init">
<property name="dpml-magic-core.uri"

Modified:
development/main/magic/core/src/main/net/dpml/magic/builder/ElementHelper.java
==============================================================================
---
development/main/magic/core/src/main/net/dpml/magic/builder/ElementHelper.java
(original)
+++
development/main/magic/core/src/main/net/dpml/magic/builder/ElementHelper.java
Fri Jul 1 01:25:38 2005
@@ -27,6 +27,8 @@
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

+import net.dpml.transit.util.PropertyResolver;
+
import org.apache.tools.ant.BuildException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

Modified: development/main/transit/build.xml
==============================================================================
--- development/main/transit/build.xml (original)
+++ development/main/transit/build.xml Fri Jul 1 01:25:38 2005
@@ -80,16 +80,19 @@
<property name="local" value="${share}/local"/>
<echo>Creating local repository ${local}</echo>

- <!-- build the library -->
+ <!-- put ant jars into the library -->
<mkdir dir="${local}/ant/jars"/>
+ <copy file="${dpml.cache}/ant/jars/${ant.junit.filename}"
+ tofile="${local}/ant/jars/${ant.junit.filename}"/>
+ <copy file="${dpml.cache}/ant/jars/${transit-ant.filename}"
+ tofile="${local}/ant/jars/${transit-ant.filename}"/>
+
+ <!-- put ant junit into the library -->
<mkdir dir="${local}/junit/jars"/>
<copy file="${dpml.cache}/junit/jars/${junit.filename}"
tofile="${local}/junit/jars/${junit.filename}"/>
- <copy file="${dpml.cache}/ant/jars/${ant.junit.filename}"
- tofile="${local}/junit/jars/${ant.junit.filename}"/>
- <copy file="${dpml.cache}/ant/jars/${transit-ant.filename}"
- tofile="${local}/junit/jars/${transit-ant.filename}"/>

+ <!-- put transit module and link into the library -->
<mkdir dir="${local}/dpml/transit"/>
<copy todir="${local}/dpml/transit">
<fileset dir="${basedir}/core/target/deliverables"/>
@@ -109,8 +112,8 @@
<property name="templates" value="${local}/dpml/transit/templates"/>
<echo>Adding build template to ${templates}</echo>
<mkdir dir="${templates}"/>
- <copy tofile="${templates}/standard.template"
file="${basedir}/standard.xml"/>
-
+ <copy file="${basedir}/standard.xml"
tofile="${templates}/standard-${project.version}.template" />
+ <copy file="${basedir}/target/standard.template.link"
toDir="${templates}"/>
</target>

<target name="install" depends="standard.install">
@@ -120,8 +123,9 @@

#----------------------------------------------------------------------------------
</echo>
<mkdir dir="${dpml.cache}/dpml/transit/templates"/>
- <copy toFile="${dpml.cache}/dpml/transit/templates/standard.template"
- file="${basedir}/standard.xml"/>
+ <copy toDir="${dpml.cache}/dpml/transit/templates">
+ <fileset dir="${templates}"/>
+ </copy>
<mkdir dir="${dpml.docs}/api"/>
<copy todir="${dpml.docs}/api" preservelastmodified="true">
<fileset dir="${api}"/>

Modified: development/main/transit/core/build.xml
==============================================================================
--- development/main/transit/core/build.xml (original)
+++ development/main/transit/core/build.xml Fri Jul 1 01:25:38 2005
@@ -49,8 +49,9 @@
tofile="${module.file}"/>
<checksum fileext=".md5" file="${module.file}"/>
<antcall target="module.asc"/>
- <copy file="${basedir}/target/project.module.link"
-
tofile="${basedir}/target/deliverables/modules/dpml-transit.module.link"/>
+ <property name="module.link"
location="${basedir}/target/deliverables/modules/dpml-transit.module.link"/>
+ <move file="${basedir}/target/project.module.link"
+ tofile="${module.link}"/>
</target>

<target name="module.asc" if="gpg.declared">

Modified: development/main/transit/core/etc/project.module.link
==============================================================================
--- development/main/transit/core/etc/project.module.link (original)
+++ development/main/transit/core/etc/project.module.link Fri Jul 1
01:25:38 2005
@@ -1 +1 @@
-artifact:module:dpml/transit/dpml-transit-@PROJECT-VERSION@
\ No newline at end of file
+artifact:module:dpml/transit/dpml-transit#${dpml.transit.version}
\ No newline at end of file

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/Transit.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/Transit.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/Transit.java
Fri Jul 1 01:25:38 2005
@@ -133,6 +133,7 @@
System.setProperty( HOME_KEY, DPML_HOME.getAbsolutePath() );
System.setProperty( DATA_KEY, DPML_DATA.getAbsolutePath() );
System.setProperty( PREFS_KEY, DPML_PREFS.getAbsolutePath() );
+ System.setProperty( "dpml.transit.version", "@PROJECT-VERSION@" );
}

/**

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/link/ArtifactLinkManager.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/link/ArtifactLinkManager.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/link/ArtifactLinkManager.java
Fri Jul 1 01:25:38 2005
@@ -31,9 +31,12 @@
import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
+import java.util.logging.Logger;
+import java.util.logging.Level;

import net.dpml.transit.NullArgumentException;
import net.dpml.transit.artifact.ArtifactNotFoundException;
+import net.dpml.transit.util.PropertyResolver;

/**
* The LinkManager is responsible for storing the mapping between a Link
@@ -51,11 +54,6 @@
public class ArtifactLinkManager
implements LinkManager
{
-
- public ArtifactLinkManager()
- {
- }
-
/** Sets the URI for the provided Link.
* The LinkManager is required to persist this information between
* JVM restarts and should be persisted on a scope larger than a
@@ -132,13 +130,14 @@
InputStream in = store.openConnection().getInputStream();
StreamUtils.copyStream( in, out, true );
String target = out.toString( "ISO8859-1" );
- URI value = URI.create( target );
+ String path = PropertyResolver.resolve( target );
+ URI value = URI.create( path );
return value ;
}
}
);
return result;
- }
+ }
catch( PrivilegedActionException e )
{
Exception exception = e.getException();
@@ -152,4 +151,5 @@
}
}
}
+
}

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/util/PropertyResolver.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/util/PropertyResolver.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/util/PropertyResolver.java
Fri Jul 1 01:25:38 2005
@@ -32,6 +32,19 @@
//
------------------------------------------------------------------------

/**
+ * System property symbol substitution from properties.
+ * Replace any occurances of ${[key]} with the value of the property
+ * assigned to the [key] in the system properties.
+ * @param value a string containing possibly multiple ${[value]} sequences
+ * @return the expanded string
+ */
+ public static String resolve( String value )
+ {
+ Properties properties = System.getProperties();
+ return resolve( properties, value );
+ }
+
+ /**
* Symbol substitution from properties.
* Replace any occurances of ${[key]} with the value of the property
* assigned to the [key] in the supplied properties argument.

Added:
development/main/transit/core/handler/src/test/net/dpml/transit/util/PropertyResolverTestCase.java
==============================================================================
--- (empty file)
+++
development/main/transit/core/handler/src/test/net/dpml/transit/util/PropertyResolverTestCase.java
Fri Jul 1 01:25:38 2005
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2004 Apache Software Foundation
+ * 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 junit.framework.TestCase;
+
+import java.util.Properties;
+
+/**
+ * Testcases for the PropertyResolver
+ *
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
+ * @version CVS $ Revision: 1.1 $
+ */
+public class PropertyResolverTestCase extends TestCase
+{
+ private Properties m_Properties;
+
+ public void setUp()
+ {
+ m_Properties = new Properties();
+ m_Properties.put( "abc", "def" );
+ m_Properties.put( "def", "Hi" );
+ m_Properties.put( "mama", "abc" );
+ m_Properties.put( "papa", "def" );
+ m_Properties.put( "child", "ghi" );
+ m_Properties.put( "some.abc.def.ghi.value", "All that." );
+ }
+
+ public PropertyResolverTestCase( String name )
+ {
+ super( name );
+ }
+
+ public void testSimple1() throws Exception
+ {
+ String src = "${abc}";
+ String result = PropertyResolver.resolve( m_Properties, src );
+ String expected = "def";
+ assertEquals( expected, result );
+ }
+
+ public void testSimple2() throws Exception
+ {
+ String src = "Def = ${abc} is it.";
+ String result = PropertyResolver.resolve( m_Properties, src );
+ String expected = "Def = def is it.";
+ assertEquals( expected, result );
+ }
+
+ public void testSimple3() throws Exception
+ {
+ String src = "def = ${abc} = ${def}";
+ String result = PropertyResolver.resolve( m_Properties, src );
+ String expected = "def = def = Hi";
+ assertEquals( expected, result );
+ }
+
+ public void testComplex1() throws Exception
+ {
+ String src = "${${abc}}";
+ String result = PropertyResolver.resolve( m_Properties, src );
+ String expected = "Hi";
+ assertEquals( expected, result );
+ }
+
+ public void testComplex2() throws Exception
+ {
+ String src = "${some.${mama}.${papa}.${child}.value}";
+ String result = PropertyResolver.resolve( m_Properties, src );
+ String expected = "All that.";
+ assertEquals( expected, result );
+ }
+}

Modified:
development/main/transit/core/tools/src/main/net/dpml/transit/tools/ImportArtifactTask.java
==============================================================================
---
development/main/transit/core/tools/src/main/net/dpml/transit/tools/ImportArtifactTask.java
(original)
+++
development/main/transit/core/tools/src/main/net/dpml/transit/tools/ImportArtifactTask.java
Fri Jul 1 01:25:38 2005
@@ -20,6 +20,7 @@

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

import org.apache.tools.ant.Project;
import org.apache.tools.ant.BuildException;
@@ -27,7 +28,7 @@

import net.dpml.transit.Transit;
import net.dpml.transit.TransitAlreadyInitializedException;
-import net.dpml.transit.artifact.Handler;
+import net.dpml.transit.artifact.Artifact;
import net.dpml.transit.monitors.Monitor;
import net.dpml.transit.model.Logger;
import net.dpml.transit.model.TransitModel;
@@ -63,11 +64,12 @@
* @exception BuildException if an error occurs while attempting to
* resolve the artifact uri
*/
- public void setUri( String uri ) throws BuildException
+ public void setUri( URI uri ) throws BuildException
{
try
{
- URL url = new URL( null, uri, new Handler() );
+ Artifact artifact = Artifact.createArtifact( uri );
+ URL url = artifact.toURL();
File local = (File) url.getContent( new Class[]{File.class} );
super.setFile( local.getAbsolutePath() );
}

Added: development/main/transit/etc/standard.template.link
==============================================================================
--- (empty file)
+++ development/main/transit/etc/standard.template.link Fri Jul 1 01:25:38
2005
@@ -0,0 +1 @@
+artifact:template:dpml/transit/standard#${dpml.transit.version}
\ No newline at end of file

Modified: development/main/transit/standard.xml
==============================================================================
--- development/main/transit/standard.xml (original)
+++ development/main/transit/standard.xml Fri Jul 1 01:25:38 2005
@@ -143,7 +143,7 @@
# to include the junit file within ant's classloader please restart the
build.

#----------------------------------------------------------------------------------
</echo>
- <fail status="99" message="Ant lib updated. Please restart build
procedure."/>
+ <fail status="99" message="Ant lib updated (restart may be required)."/>
</target>

<!-- project setup -->



  • svn commit: r2944 - in development/main: magic/core magic/core/src/main/net/dpml/magic/builder magic/core/src/test/net/dpml/magic/builder/test transit transit/core transit/core/etc transit/core/handler/src/main/net/dpml/transit transit/core/handler/src/main/net/dpml/transit/link transit/core/handler/src/main/net/dpml/transit/util transit/core/handler/src/test/net/dpml/transit/util transit/core/tools/src/main/net/dpml/transit/tools transit/etc, mcconnell, 07/01/2005

Archive powered by MHonArc 2.6.24.

Top of Page