mcconnell 2003/09/14 06:10:17
Modified: merlin/kernel/bootstrap maven.xml
merlin/kernel/bootstrap/src/java Merlin.java
Log:
Update the bootstrap to support seperation of system and user repositories.
Revision Changes Path
1.3 +11 -1 avalon-sandbox/merlin/kernel/bootstrap/maven.xml
Index: maven.xml
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/kernel/bootstrap/maven.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- maven.xml 20 Aug 2003 11:57:13 -0000 1.2
+++ maven.xml 14 Sep 2003 13:10:17 -0000 1.3
@@ -1,4 +1,4 @@
-<project default="jar:install" xmlns:maven="jelly:maven" xmlns:j="jelly:core"
xmlns:util="jelly:util">
+<project default="jar:install" xmlns:maven="jelly:maven" xmlns:j="jelly:core"
xmlns:util="jelly:util" xmlns:ant="jelly:ant">
<property name="maven.jar.manifest" value="${basedir}/src/etc/project.mf"/>
<property name="maven.jar.manifest.extensions.add" value="false"/>
@@ -11,4 +11,14 @@
dest="${maven.build.dir}/classes"/>
</preGoal>
+ <goal name="build" prereqs="jar:install">
+ <ant:property environment="env"/>
+ <ant:property name="merlinEnvironment" value="${env.MERLIN_HOME}"/>
+ <j:if test="${merlinEnvironment != ''}">
+ <ant:property name="merlin.home" value="${merlinEnvironment}"/>
+ </j:if>
+ <ant:property name="merlin.home" value="${user.home}/.merlin"/>
+ <copy toDir="${merlin.home}/bin/lib"
file="${maven.build.dir}/${maven.final.name}.jar"/>
+ </goal>
+
</project>
1.14 +38 -17 avalon-sandbox/merlin/kernel/bootstrap/src/java/Merlin.java
Index: Merlin.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/kernel/bootstrap/src/java/Merlin.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- Merlin.java 12 Sep 2003 21:10:55 -0000 1.13
+++ Merlin.java 14 Sep 2003 13:10:17 -0000 1.14
@@ -65,6 +65,7 @@
import java.util.Locale;
import java.util.Map;
import java.util.Properties;
+import java.util.StringTokenizer;
import org.apache.avalon.repository.Repository;
import org.apache.avalon.repository.impl.DefaultFileRepository;
@@ -78,14 +79,18 @@
// static
//--------------------------------------------------------------------------
- private static final String REPOSITORY = "http://www.ibiblio.org/maven";
+ private static final String REPOSITORY_PATH =
+ "http://dpml.net/repository/,http://www.ibiblio.org/maven/";
private static final String MERLIN_HOME_KEY =
"merlin.home";
- private static final String MERLIN_LOCAL_KEY =
- "merlin.repository.local";
- private static final String MERLIN_REPOSITORY_REMOTE_KEY =
- "merlin.repository.remote";
+
+ private static final String MERLIN_SYSTEM_REPOSITORY_KEY =
+ "merlin.system.repository";
+
+ private static final String MERLIN_SYSTEM_REMOTE_REPOSITORY_PATH_KEY =
+ "merlin.system.remote-repository.path";
+
private static final String MERLIN_BOOTSTRAP_CLASSNAME_KEY =
"merlin.bootstrap.class";
private static final String MERLIN_API_CLASSPATH_KEY =
@@ -121,9 +126,15 @@
//
String fallback = System.getProperty( "user.home" ) + "/.merlin";
- String system = System.getProperty( MERLIN_HOME_KEY, fallback );
- String local = System.getProperty( MERLIN_LOCAL_KEY, system );
- File base = new File( local, "repository" );
+ String home = System.getProperty( MERLIN_HOME_KEY, fallback );
+ File merlinHome = new File( home );
+ File merlinDefaultSystemRepository = new File( merlinHome, "system" );
+ String merlinSystemRepositoryPath =
+ System.getProperty(
+ MERLIN_SYSTEM_REPOSITORY_KEY,
+ merlinDefaultSystemRepository.toString() );
+
+ File base = new File( merlinSystemRepositoryPath );
if( !base.exists() )
{
@@ -135,28 +146,26 @@
if( debug )
{
- System.out.println( "MERLIN BOOTSTRAP REPOSITORY: " + base );
+ System.out.println( "MERLIN SYSTEM REPOSITORY: " + base );
}
//
// Establish the repository. If a system property corresponding to
// MERLIN_REPOSITORY_REMOTE_KEY is not null then setup the repository
// so that it dynamcally downloads content. If the value is null then
- // the repository is restricted to local content (and as such is more
- // secure).
+ // default values.
//
Repository repository = null;
- String remote =
- System.getProperty( MERLIN_REPOSITORY_REMOTE_KEY, REPOSITORY );
+ String remotePath =
+ System.getProperty( MERLIN_SYSTEM_REMOTE_REPOSITORY_PATH_KEY,
REPOSITORY_PATH );
if( debug )
{
- System.out.println( "MERLIN BOOTSTRAP REMOTE: " + remote );
+ System.out.println( "system remote repositories: " + remotePath );
}
- URL remoteURL = new URL( remote );
- repository =
- new DefaultFileRepository( base, null, new URL[]{ remoteURL } );
+ URL[] remote = getRemoteURLs( remotePath );
+ repository = new DefaultFileRepository( base, null, remote );
//
// get the set of URLs for the bootstrap classloader from the
@@ -295,6 +304,18 @@
System.err.println( msg );
return;
}
+ }
+
+ private static URL[] getRemoteURLs( String path ) throws Exception
+ {
+ ArrayList list = new ArrayList();
+ StringTokenizer tokenizer = new StringTokenizer( path, "," );
+ while( tokenizer.hasMoreElements() )
+ {
+ String token = tokenizer.nextToken();
+ list.add( new URL( token ) );
+ }
+ return (URL[]) list.toArray( new URL[0] );
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]