Quick reply - there is something wrong because you should be able to set the anchor independently of the basedir. I'll be looking into this and your patch later this evening.
I think the issue may be related to the SystemContext factory which should be responsible for setting the anchor directly (which is where changes concerning initial parameter management between 3.2.5 and 3.3 will appear).
Cheers, Steve.
Bruno Dumon wrote:
Hi,
I just tried to run my app with Merlin CVS, normally I'm running version 3.2.5.
It seems that it ignores the path I specify with the -library CLI option (though it does show up as merlin.anchor in the environment listing), and instead tries to use the current working directory.
After some digging around in the merlin code I came up with this:
- the "-library" option gets transfered to KernelCriteria.getAnchorDirectory(), which in the API is described as the directory "to be used when resolving library declarations in classload specifications." Further this path gets set as an attribute called "urn:composition:anchor" in the Context object supplied to the SystemContextFactory. This context key doesn't seem to be used anywhere.
- The directory which however seems to be used is SystemContext.getBaseDirectory(), described in the API as "the base
directory from which relative references should be resolved" (doesn't
say 'library' references per se, but from inspecting the usages of that
method I guess that's the purpose). However, the value used for that is
InitialContext.getInitialWorkingDirectory().
I've attached a patch with a possible solution. It simply sets the base directory explicitely on the SystemContextFactory, as is done for the other (home/temp) directories.
If I got it right that base and anchor are the same directories, maybe they would better share the same name?
------------------------------------------------------------------------
Index: composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultSystemContextFactory.java
===================================================================
RCS file: /home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultSystemContextFactory.java,v
retrieving revision 1.8
diff -u -3 -p -u -r1.8 DefaultSystemContextFactory.java
--- composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultSystemContextFactory.java 17 Mar 2004 10:39:10 -0000 1.8
+++ composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultSystemContextFactory.java 30 Mar 2004 19:49:19 -0000
@@ -72,6 +72,8 @@ public class DefaultSystemContextFactory
private File m_temp;
+ private File m_base;
+
private Repository m_repository;
private LoggingManager m_logging;
@@ -201,6 +203,11 @@ public class DefaultSystemContextFactory
m_temp = temp;
}
+ public void setBaseDirectory( File base )
+ {
+ m_base = base;
+ }
+
public void setName( String name )
{
m_name = name;
@@ -316,6 +323,7 @@ public class DefaultSystemContextFactory
*/
public File getBaseDirectory()
{
+ if ( m_base != null ) return m_base;
return m_context.getInitialWorkingDirectory();
}
Index: composition/spi/src/java/org/apache/avalon/composition/provider/SystemContextFactory.java
===================================================================
RCS file: /home/cvs/avalon/merlin/composition/spi/src/java/org/apache/avalon/composition/provider/SystemContextFactory.java,v
retrieving revision 1.6
diff -u -3 -p -u -r1.6 SystemContextFactory.java
--- composition/spi/src/java/org/apache/avalon/composition/provider/SystemContextFactory.java 17 Mar 2004 10:39:11 -0000 1.6
+++ composition/spi/src/java/org/apache/avalon/composition/provider/SystemContextFactory.java 30 Mar 2004 19:49:19 -0000
@@ -123,6 +123,13 @@ public interface SystemContextFactory */
void setTemporaryDirectory( File temp );
+ /**
+ * Sets the base directory from which relative classloader
+ * references may be resolved.
+ * @param base the base directory
+ */
+ public void setBaseDirectory( File base );
+
/**
* Set the name of the logging channel to be used by the * system context.
Index: kernel/impl/src/java/org/apache/avalon/merlin/impl/DefaultFactory.java
===================================================================
RCS file: /home/cvs/avalon/merlin/kernel/impl/src/java/org/apache/avalon/merlin/impl/DefaultFactory.java,v
retrieving revision 1.40
diff -u -3 -p -u -r1.40 DefaultFactory.java
--- kernel/impl/src/java/org/apache/avalon/merlin/impl/DefaultFactory.java 17 Mar 2004 10:50:04 -0000 1.40
+++ kernel/impl/src/java/org/apache/avalon/merlin/impl/DefaultFactory.java 30 Mar 2004 19:49:20 -0000
@@ -450,7 +450,8 @@ public class DefaultFactory implements F
factory.setTraceEnabled( criteria.isDebugEnabled() );
factory.setWorkingDirectory( criteria.getContextDirectory() );
factory.setTemporaryDirectory( criteria.getTempDirectory() );
-
+ factory.setBaseDirectory( criteria.getAnchorDirectory() );
+ //
// create the parent context
//
------------------------------------------------------------------------
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--
|------------------------------------------------| | Magic by Merlin | | Production by Avalon | | | | http://avalon.apache.org/merlin | | http://dpml.net/merlin/distributions/latest | |------------------------------------------------|
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
