Update of /cvsroot/metamorphosis/ruper2/src/java/core/org/krysalis/ruper/config
In directory sc8-pr-cvs1:/tmp/cvs-serv17764/src/java/core/org/krysalis/ruper/config
Modified Files:
RuperConfig.java
Log Message:
1) Unit test for messages
2) Fallback to "en" if messages in default locale not available
3) First stab at loading ruper.xml from a resource (classloader) not just file
Index: RuperConfig.java
===================================================================
RCS file: /cvsroot/metamorphosis/ruper2/src/java/core/org/krysalis/ruper/config/RuperConfig.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** RuperConfig.java 22 Sep 2003 19:18:32 -0000 1.6
--- RuperConfig.java 22 Sep 2003 20:18:28 -0000 1.7
***************
*** 5,11 ****
--- 5,13 ----
import java.io.File;
+ import java.io.InputStream;
import org.krysalis.ruper.impl.ReferenceManager;
import org.krysalis.ruper.log.Logger;
+ import org.krysalis.ruper.util.ClassLoaderHelper;
import org.krysalis.ruper.util.RuperConstants;
import org.krysalis.ruper.util.text.MessageConstants;
***************
*** 21,40 ****
private static boolean l_configured = false;
! public static void configure(String configFileName) {
try {
! File configFile = new File(configFileName);
! if(configFile.exists()){
! XMLEntryTable xmlEntryTable = new ConfigXMLEntryTable();
!
! XMLParser parser = new XMLParser(xmlEntryTable);
! XMLContext xmlContext = parser.parse(configFile);
}
! else
Logger.getLog().error(
! Messages.getString(
! MessageConstants.UNABLE_TO_LOAD_CONFIG_FILE,
! new Object[] { configFileName }));
!
}
catch (Exception exp) {
--- 23,57 ----
private static boolean l_configured = false;
! public static void configure(String resourceName) {
try {
! XMLEntryTable xmlEntryTable = new ConfigXMLEntryTable();
! XMLParser parser = new XMLParser(xmlEntryTable);
! XMLContext xmlContext = null;
! File configFile = new File(resourceName);
! if (configFile.exists()) {
! Logger.getLog().info(
! Messages.getString(
! MessageConstants.CONFIG,
! new Object[] { "File", resourceName }));
! xmlContext = parser.parse(configFile);
}
! else {
! InputStream resource =
! ClassLoaderHelper.getClassLoader().getResourceAsStream(
! resourceName);
! Logger.getLog().info(
! Messages.getString(
! MessageConstants.CONFIG,
! new Object[] { "Resource", resourceName }));
! xmlContext = parser.parse(resource);
! }
!
! if (null == xmlContext)
Logger.getLog().error(
! Messages.getString(
! MessageConstants.UNABLE_TO_LOAD_CONFIG,
! resourceName));
!
}
catch (Exception exp) {
***************
*** 54,60 ****
public static void main(String[] args) throws Exception {
!
RuperConfig.configure();
-
ReferenceManager.dump();
}
--- 71,76 ----
public static void main(String[] args) throws Exception {
! Logger.testInit();
RuperConfig.configure();
ReferenceManager.dump();
}
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
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.