RE: Using Jakarta Configuration with Merlin

"David Leangen" <[email protected]>
Newsgroups gmane.comp.jakarta.avalon.user
Message-ID <[email protected]>
Fair enough :-)

I can send the entire package as a zip file, too, but IIUC it will be
rejected by the mail server...


This is the test class:

package myproject;

import java.io.*;
import java.net.URL;
import junit.framework.*;
import org.apache.commons.configuration.*;

public class KConfigTest extends TestCase
{

    private ConfigurationFactory factory;

	public KConfigTest(String name)
	{
		super(name);
	}

	public void setUp()
	{
	    factory = new ConfigurationFactory();
	    URL configURL = getClass().getResource("/config.xml");
	    factory.setConfigurationURL(configURL);
	}

	public void testNothing()
	{

	    Configuration config = null;

	    try
        {
	        ConfigurationFactory nothing = factory;
            config = factory.getConfiguration();
        }
        catch (ConfigurationException e)
        {
            throw new RuntimeException(e);
        }

        String testPath = config.getString("test.path");
        File file = new File(testPath);
        System.out.print(file.getAbsolutePath());

	}

}



This is the build file:

<?xml version="1.0" encoding="UTF-8" ?>

<project name="myproject-test" default="install" basedir="."
    xmlns:x="antlib:org.apache.avalon.tools">

  <property name="project.home" value="."/>
  <x:home index="."/>
  <import file="standard.xml"/>

</project>


This is the config.xml file, which is located in /. in the classpath:

<?xml version="1.0" encoding="ISO-8859-1" ?>

<configuration>
  <xml className="org.apache.commons.configuration.XMLConfiguration"
fileName="conf/test.xml"/>
</configuration>


This is the test.xml file, which is located at /conf in the classpath:

<config>
  <test>
    <path>.</path>
  </test>
</config>


Finally, this is my index.xml file:

<?xml version="1.0" encoding="ISO-8859-1"?>

<index>

  <import
href="http://svn.apache.org/repos/asf/avalon/trunk/runtime/index.xml"/>

  <project basedir=".">
    <info>
      <group>myproject</group>
      <name>myproject-test</name>
      <version>SNAPSHOT</version>
    </info>
    <dependencies>
      <include key="dtdparser"/>
      <include key="commons-beanutils"/>
      <include key="commons-collections"/>
      <include key="commons-configuration"/>
      <include key="commons-digester"/>
      <include key="commons-lang"/>
      <include key="junit"/>
    </dependencies>
  </project>


  <resource>
    <info>
      <group>ant</group>
      <name>ant</name>
      <version>1.5.3</version>
      <type>jar</type>
    </info>
  </resource>

  <resource>
    <info>
      <group>ant</group>
      <name>ant-optional</name>
      <version>1.5.3</version>
      <type>jar</type>
    </info>
  </resource>

  <resource>
    <info>
      <group>c3p0</group>
      <name>c3p0</name>
      <version>0.8.4.5</version>
      <type>jar</type>
    </info>
  </resource>

  <resource>
    <info>
      <group>castor</group>
      <name>castor</name>
      <version>0.9.5.3</version>
      <type>jar</type>
    </info>
  </resource>

  <resource>
    <info>
      <group>cglib</group>
      <name>cglib-full</name>
      <version>2.0.1</version>
      <type>jar</type>
    </info>
  </resource>


  <resource>
    <info>
      <group>commons-beanutils</group>
      <name>commons-beanutils</name>
      <version>1.7.0</version>
      <type>jar</type>
    </info>
  </resource>


  <resource>
    <info>
      <group>commons-cli</group>
      <name>commons-cli</name>
      <version>2.0</version>
      <type>jar</type>
    </info>
  </resource>


  <resource>
    <info>
      <group>commons-collections</group>
      <name>commons-collections</name>
      <version>3.0</version>
      <type>jar</type>
    </info>
  </resource>


  <resource>
    <info>
      <group>commons-configuration</group>
      <name>commons-configuration</name>
      <version>1.0</version>
      <type>jar</type>
    </info>
  </resource>


  <resource>
    <info>
      <group>commons-dbcp</group>
      <name>commons-dbcp</name>
      <version>1.1</version>
      <type>jar</type>
    </info>
  </resource>


  <resource>
    <info>
      <group>commons-digester</group>
      <name>commons-digester</name>
      <version>1.5</version>
      <type>jar</type>
    </info>
  </resource>


<!--
  <resource>
    <info>
      <group>commons-lang</group>
      <name>commons-lang</name>
      <version>1.0.1</version>
      <type>jar</type>
    </info>
  </resource>
-->
  <resource>
    <info>
      <group>commons-lang</group>
      <name>commons-lang</name>
      <version>2.0</version>
      <type>jar</type>
    </info>
  </resource>

<!--
  <resource>
    <info>
      <group>commons-logging</group>
      <name>commons-logging</name>
      <version>1.0.3</version>
      <type>jar</type>
    </info>
  </resource>
-->
  <resource>
    <info>
      <group>commons-logging</group>
      <name>commons-logging</name>
      <version>1.0.4</version>
      <type>jar</type>
    </info>
  </resource>

  <resource>
    <info>
      <group>commons-logging</group>
      <name>commons-logging-api</name>
      <version>1.0.4</version>
      <type>jar</type>
    </info>
  </resource>

  <resource>
    <info>
      <group>concurrent</group>
      <name>concurrent</name>
      <version>1.3.2</version>
      <type>jar</type>
    </info>
  </resource>

  <resource>
    <info>
      <group>connector</group>
      <name>connector</name>
      <version>1.3.0</version>
      <type>jar</type>
    </info>
  </resource>

  <resource>
    <info>
      <group>dom4j</group>
      <name>dom4j</name>
      <version>1.4</version>
      <type>jar</type>
    </info>
  </resource>

  <resource>
    <info>
      <group>dbunit</group>
      <name>dbunit</name>
      <version>2.1</version>
      <type>jar</type>
    </info>
  </resource>

  <resource>
    <info>
      <group>dtdparser</group>
      <name>dtdparser</name>
      <version>1.2.1</version>
      <type>jar</type>
    </info>
  </resource>

  <resource>
    <info>
      <group>ehcache</group>
      <name>ehcache</name>
      <version>0.7</version>
      <type>jar</type>
    </info>
  </resource>

  <resource>
    <info>
      <group>hibernate</group>
      <name>hibernate</name>
      <version>2.1.4</version>
      <type>jar</type>
    </info>
  </resource>

  <resource>
    <info>
      <group>hsqldb</group>
      <name>hsqldb</name>
      <version>1.7.1</version>
      <type>jar</type>
    </info>
  </resource>

  <resource>
    <info>
      <group>java/jaas</group>
      <name>jaas</name>
      <version>1.0</version>
      <type>jar</type>
    </info>
  </resource>

  <resource>
    <info>
      <group>java/jdbc</group>
      <name>jdbc-stdext</name>
      <version>2.0</version>
      <type>jar</type>
    </info>
  </resource>

  <resource>
    <info>
      <group>java/jta</group>
      <name>jta</name>
      <version>1.0</version>
      <type>jar</type>
    </info>
  </resource>

  <resource>
    <info>
      <group>jboss</group>
      <name>jboss-cache</name>
      <version>4.0.0</version>
      <type>jar</type>
    </info>
  </resource>

  <resource>
    <info>
      <group>jboss</group>
      <name>jboss-common</name>
      <version>4.0.0</version>
      <type>jar</type>
    </info>
  </resource>

  <resource>
    <info>
      <group>jboss</group>
      <name>jboss-jmx</name>
      <version>4.0.0</version>
      <type>jar</type>
    </info>
  </resource>

  <resource>
    <info>
      <group>jboss</group>
      <name>jboss-system</name>
      <version>4.0.0</version>
      <type>jar</type>
    </info>
  </resource>

  <resource>
    <info>
      <group>jcs</group>
      <name>jcs-dev</name>
      <version>1.0</version>
      <type>jar</type>
    </info>
  </resource>

  <resource>
    <info>
      <group>jgroups</group>
      <name>jgroups</name>
      <version>2.2.1</version>
      <type>jar</type>
    </info>
  </resource>

  <resource>
    <info>
      <group>junit</group>
      <name>junit</name>
      <version>3.8.1</version>
      <type>jar</type>
    </info>
  </resource>

  <resource>
    <info>
      <group>odmg</group>
      <name>odmg</name>
      <version>3.0</version>
      <type>jar</type>
    </info>
  </resource>

  <resource>
    <info>
      <group>oscache</group>
      <name>oscache</name>
      <version>2.0</version>
      <type>jar</type>
    </info>
  </resource>

  <resource>
    <info>
      <group>postgresql</group>
      <name>postgresql</name>
      <version>7.4.2</version>
      <type>jar</type>
    </info>
  </resource>

  <resource>
    <info>
      <group>proxool</group>
      <name>proxool</name>
      <version>0.8.3</version>
      <type>jar</type>
    </info>
  </resource>

  <resource>
    <info>
      <group>swarmcache</group>
      <name>swarmcache</name>
      <version>1.0</version>
      <type>jar</type>
    </info>
  </resource>

  <resource>
    <info>
      <group>xalan</group>
      <name>xalan</name>
      <version>2.4.0</version>
      <type>jar</type>
    </info>
  </resource>

  <resource>
    <info>
      <group>xalan</group>
      <name>xerces</name>
      <version>2.4.0</version>
      <type>jar</type>
    </info>
  </resource>

  <resource>
    <info>
      <group>xalan</group>
      <name>xerces-impl</name>
      <version>2.5.0</version>
      <type>jar</type>
    </info>
  </resource>

  <resource>
    <info>
      <group>xalan</group>
      <name>xml-apis</name>
      <version>2.4.0</version>
      <type>jar</type>
    </info>
  </resource>
</index>


I think that's everything...




> -----Original Message-----
> From: Niclas Hedhman [mailto:[email protected]]
> Sent: 19 September 2004 10:14
> To: Avalon framework users
> Subject: Re: Using Jakarta Configuration with Merlin
>
>
> On Saturday 18 September 2004 23:30, David Leangen wrote:
>
> >   [x:junit] Caused by: java.io.FileNotFoundException:
> >
> K:\myproject\target\test\file:\K:\myproject\target\deliverables\ja
> rs\my-jar
> >- SNAPSHOT.jar!\conf\test.xml
>
> Another thing I didn't see at first;
>
> K:\myproject\target\test\file:\K:\myproject\target\deliverables....
>
> -------------------------^^^^^^^^^
>
> why is this?
>
>
> I think you need to provide a lot more info.
>
>
> Cheers
> Niclas
>
> --
>    +------//-------------------+
>   / http://www.bali.ac        /
>  / http://niclas.hedhman.org /
> +------//-------------------+
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.