KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > contineo > core > config > RepositoryConfigurator


1 /*
2  * RepositoryConfigurator.java
3  *
4  * Created on 20. Januar 2004, 00:14
5  */

6
7 package org.contineo.core.config;
8
9 import org.contineo.core.XMLBean;
10 /**
11  *
12  * @author Michael Scholz
13  */

14 public class RepositoryConfigurator {
15
16     /**
17      *
18      * @uml.property name="xml"
19      * @uml.associationEnd
20      * @uml.property name="xml" multiplicity="(1 1)"
21      */

22     private XMLBean xml;
23
24     
25     /** Creates a new instance of DBMSConfigurator */
26     public RepositoryConfigurator() {
27         ClassLoader JavaDoc loader = Thread.currentThread().getContextClassLoader();
28         xml = new XMLBean(loader.getResource("repository.xml"));
29     }
30     
31     public String JavaDoc getAttribute(String JavaDoc jcdalias, String JavaDoc attr) {
32         return xml.getAttributeValue(xml.getChild("jdbc-connection-descriptor","jcd-alias",jcdalias), attr);
33     }
34     
35     public void setAttribute(String JavaDoc jcdalias, String JavaDoc attr, String JavaDoc value) {
36         xml.setAttributeValue(xml.getChild("jdbc-connection-descriptor", "jcd-alias", jcdalias), attr, value);
37     }
38     
39     public boolean toXML() {
40         return xml.writeXMLDoc();
41     }
42 }
43
Popular Tags