You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by mc...@apache.org on 2003/09/12 18:43:49 UTC
cvs commit: avalon-sandbox/merlin/merlin-platform/src/repository/merlin/xmls kernel.xml
mcconnell 2003/09/12 09:43:49
Modified: merlin/kernel/impl/conf kernel.xml
merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl
DefaultKernelContext.java
merlin/merlin-platform/src/config debug.xml kernel.xml
merlin/merlin-platform/src/repository/merlin/xmls kernel.xml
Log:
Move from <host>something</host> to <host path="something"/>.
Revision Changes Path
1.4 +4 -4 avalon-sandbox/merlin/kernel/impl/conf/kernel.xml
Index: kernel.xml
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/kernel/impl/conf/kernel.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- kernel.xml 2 Sep 2003 09:03:21 -0000 1.3
+++ kernel.xml 12 Sep 2003 16:43:49 -0000 1.4
@@ -2,14 +2,14 @@
<kernel>
- <logging name="kernel" priority="INFO">
- <category name="" priority="WARN"/>
+ <logging name="kernel" target="default" priority="INFO">
+ <category name="" priority="WARN"/>
</logging>
<repository>
<hosts>
- <host>http://www.ibiblio.org/merlin/repository/</host>
- <host>http://www.ibiblio.org/maven/</host>
+ <host path="http://dpml.net/repository/"/>
+ <host path="http://www.ibiblio.org/maven/"/>
</hosts>
</repository>
1.27 +76 -46 avalon-sandbox/merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/DefaultKernelContext.java
Index: DefaultKernelContext.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/DefaultKernelContext.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- DefaultKernelContext.java 12 Sep 2003 15:26:20 -0000 1.26
+++ DefaultKernelContext.java 12 Sep 2003 16:43:49 -0000 1.27
@@ -156,7 +156,7 @@
/**
* The kernel configuration url.
*/
- private final String m_kernelURL;
+ private String m_kernelURL;
/**
* The block url.
@@ -253,33 +253,51 @@
else
{
String kernelURL = null;
- try
+ File standard = new File( getMerlinHomeDirectory(), "config/kernel.xml" );
+ if( standard.exists() )
{
- URL url = loadKernelDirective( repository );
- kernelURL = url.toString();
- kernelConfig = getKernelConfiguration( url );
- }
- catch( Throwable e )
- {
- kernelURL = "resource:/kernel.xml";
try
{
- final InputStream stream =
- DefaultKernelContext.class.getClassLoader().
- getResourceAsStream( "kernel.xml" );
- final InputSource source =
- new InputSource( stream );
- DefaultConfigurationBuilder builder =
- new DefaultConfigurationBuilder();
- kernelConfig = builder.build( source );
+ m_kernelURL = standard.toURL().toString();
+ kernelConfig = getKernelConfiguration( standard.toURL() );
}
catch( Throwable ee )
{
final String error =
- "Unable to resolve kernel profile.";
+ "Unable to resolve kernel profile: " + standard;
throw new KernelException( error, ee );
}
}
+ else
+ {
+ try
+ {
+ URL url = loadKernelDirective( repository );
+ kernelURL = url.toString();
+ kernelConfig = getKernelConfiguration( url );
+ }
+ catch( Throwable e )
+ {
+ kernelURL = "resource:/kernel.xml";
+ try
+ {
+ final InputStream stream =
+ DefaultKernelContext.class.getClassLoader().
+ getResourceAsStream( "kernel.xml" );
+ final InputSource source =
+ new InputSource( stream );
+ DefaultConfigurationBuilder builder =
+ new DefaultConfigurationBuilder();
+ kernelConfig = builder.build( source );
+ }
+ catch( Throwable ee )
+ {
+ final String error =
+ "Unable to resolve kernel profile.";
+ throw new KernelException( error, ee );
+ }
+ }
+ }
m_kernelURL = kernelURL;
}
@@ -425,23 +443,30 @@
try
{
String path = host.getAttribute( "path", null );
- if(( path == null ) && ( host.getValue( null ) != null ))
- {
- path = host.getValue( null );
- final String warning =
- "Your kernel file container a depricated <host> statement. "
- + "Please replace all <host>...</host> references "
- + "with <host path=\"...\"/>."
- + ConfigurationUtil.list( host )
- + "/nkernel: " + m_kernelURL;
- getLogger().warn( warning );
- }
- else
+ if( path == null )
{
- final String error =
- "Missing host path attribute."
- + ConfigurationUtil.list( host );
- throw new KernelException( error );
+ if( host.getValue( null ) != null )
+ {
+ path = host.getValue( null );
+ final String warning =
+ "\n#"
+ + "\n# WARNING:" + path
+ + "\n# Your kernel file is using a depricated <host> format. "
+ + "\n# Please replace all <host>...</host> references "
+ + "\n# with <host path=\"...\"/>."
+ + "\n#"
+ + "\n# Source kernel defintion: " + m_kernelURL
+ + "\n#"
+ + ConfigurationUtil.list( host );
+ getLogger().warn( warning );
+ }
+ else
+ {
+ final String error =
+ "Missing host path attribute."
+ + ConfigurationUtil.list( host );
+ throw new KernelException( error );
+ }
}
if( !path.endsWith( "/" ) )
{
@@ -669,14 +694,7 @@
{
StringBuffer buffer = new StringBuffer();
buffer.append( " ${user.dir}: " + System.getProperty( "user.dir" ) );
- if( m_system == null )
- {
- buffer.append( "\n ${merlin.home}: " + getMerlinHomeDirectory() );
- }
- else
- {
- buffer.append( "\n ${merlin.home}: " + m_system );
- }
+ buffer.append( "\n ${merlin.home}: " + getMerlinHomeDirectory() );
buffer.append( "\n Version: " + getVersionString() );
buffer.append( "\n Environment: "
+ System.getProperty( "os.name" ) + " "
@@ -895,7 +913,7 @@
return repository.getArtifact( "merlin", "kernel", "", "xml" );
}
- private static File getSystemDefaultDirectory()
+ private File getSystemDefaultDirectory()
{
final String local =
System.getProperty(
@@ -904,11 +922,23 @@
return new File( local );
}
- private static File getMerlinHomeDirectory()
+ private File getMerlinHomeDirectory()
+ {
+ if( m_system == null )
+ {
+ return getDefaultMerlinHomeDirectory();
+ }
+ else
+ {
+ return m_system;
+ }
+ }
+
+ private File getDefaultMerlinHomeDirectory()
{
final String local =
System.getProperty( "merlin.home",
- System.getProperty( "user.home" ) + "/merlin" );
+ System.getProperty( "user.home" ) + "/.merlin" );
return new File( local );
}
}
1.5 +2 -2 avalon-sandbox/merlin/merlin-platform/src/config/debug.xml
Index: debug.xml
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/merlin-platform/src/config/debug.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- debug.xml 12 Sep 2003 14:00:39 -0000 1.4
+++ debug.xml 12 Sep 2003 16:43:49 -0000 1.5
@@ -7,8 +7,8 @@
<repository>
<hosts>
- <host>http://www.dpml.net/repository/</host>
- <host>http://www.ibiblio.org/maven/</host>
+ <host path="http://dpml.net/repository/"/>
+ <host path="http://www.ibiblio.org/maven/"/>
</hosts>
</repository>
1.14 +2 -2 avalon-sandbox/merlin/merlin-platform/src/config/kernel.xml
Index: kernel.xml
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/merlin-platform/src/config/kernel.xml,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- kernel.xml 12 Sep 2003 14:00:39 -0000 1.13
+++ kernel.xml 12 Sep 2003 16:43:49 -0000 1.14
@@ -11,8 +11,8 @@
<repository>
<hosts>
- <host>http://www.dpml.net/repository/</host>
- <host>http://www.ibiblio.org/maven/</host>
+ <host path="http://dpml.net/repository/"/>
+ <host path="http://www.ibiblio.org/maven/"/>
</hosts>
</repository>
1.5 +2 -2 avalon-sandbox/merlin/merlin-platform/src/repository/merlin/xmls/kernel.xml
Index: kernel.xml
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/merlin-platform/src/repository/merlin/xmls/kernel.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- kernel.xml 12 Sep 2003 14:00:39 -0000 1.4
+++ kernel.xml 12 Sep 2003 16:43:49 -0000 1.5
@@ -8,8 +8,8 @@
<repository>
<hosts>
- <host>http://www.dpml.net/repository/</host>
- <host>http://www.ibiblio.org/maven/</host>
+ <host path="http://dpml.net/repository/"/>
+ <host path="http://www.ibiblio.org/maven/"/>
</hosts>
</repository>
---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org