[MOBY-guts] biomoby commit

Gary Schiltz gss at pub.open-bio.org
Thu Nov 3 22:36:25 UTC 2005


gss
Thu Nov  3 17:36:25 EST 2005
Update of /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/db
In directory pub.open-bio.org:/tmp/cvs-serv22707/src/org/semanticmoby/ref/tools/db

Modified Files:
	DBConnection.java 
Log Message:
Removed unused imports; use path relative to web root

s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/db DBConnection.java,1.2,1.3
===================================================================
RCS file: /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/db/DBConnection.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/db/DBConnection.java	2005/11/01 16:28:12	1.2
+++ /home/repository/moby/s-moby/ref-impl/semanticmoby.org/src/org/semanticmoby/ref/tools/db/DBConnection.java	2005/11/03 22:36:25	1.3
@@ -1,18 +1,11 @@
 package org.semanticmoby.ref.tools.db;
 
-import java.awt.*;
-import java.awt.event.*;
-
 import java.io.*;
 
 import java.sql.*;
 
 import java.util.*;
 
-import javax.swing.*;
-import javax.swing.border.*;
-import javax.swing.event.*;
-
 
 /**
  *
@@ -20,13 +13,14 @@
  */
 public class DBConnection {
 
+    private static String webrootPath;
     public static final int      INSERT        = 0;
     public static final int      UPDATE        = 1;
     public static final int      DELETE        = 2;
     public static final int      OTHER         = 3;
     public static String         propsFileName =
-        "../webapps/ROOT/WEB-INF/smoby.properties";
-    public static String         logFileName       = "../logs/smoby.dblog";
+        "/WEB-INF/smoby.properties";
+    public static String         logFileName       = "/WEB-INF/smoby.dblog";
     public static String         dbUserId          = "postgres";
     public static String         dbPassword        = "postgres";
     public static String         dbRepositoryName  = "smoby-dev";
@@ -56,7 +50,8 @@
      * @param logFileName The name (including path) of the log file to create
      * for this application.
      */
-    public DBConnection() {
+    public DBConnection(String webroot) {
+        webrootPath = webroot;
         try {
             startLog();
             loadDBProperties();
@@ -123,7 +118,7 @@
 
         try {
 
-            File logFile = new File(logFileName);
+            File logFile = new File(webrootPath + File.separator + logFileName);
 
             if (logFile.exists()) {
 
@@ -145,13 +140,13 @@
     void loadDBProperties() {
 
         try {
-
+            String propsFilePath = webrootPath + File.separator + propsFileName;
             logMsg(" ");
-            logMsg("loading database properties from " + propsFileName +
+            logMsg("loading database properties from " + propsFilePath +
                    " ...");
 
             dbProps = new Properties();
-            dbProps.load(new FileInputStream(propsFileName));
+            dbProps.load(new FileInputStream(propsFilePath));
 
             if (dbProps.getProperty("DB_USER_ID") != null) {
 
@@ -224,6 +219,7 @@
      */
     public static void saveDBProperties() {
 
+        String propFilePath = webrootPath + File.separator + propsFileName;
         try {
 
             String header = "# Semantic Moby Database Properties";
@@ -241,7 +237,7 @@
             dbProps.setProperty("DB_URL", dbUrl);
             logMsg("     DB_URL = " + dbUrl + "\n");
 
-            dbProps.store(new FileOutputStream(propsFileName), header);
+            dbProps.store(new FileOutputStream(propFilePath), header);
 
             logMsg("finished");
             logMsg(" ");




More information about the MOBY-guts mailing list