Adding GUI application

ktn10 [2001-04-19 22:32:31]
Adding GUI application
Database can be accessed using swing application.
Filename
AddJFrame.java
DBAccessApplet.java
DBAccessApplication.java
DBAccessFrame.java
DBInterfaceFrame.java
DeleteJFrame.java
oracleDB.properties
diff --git a/AddJFrame.java b/AddJFrame.java
index 0a05d1e..97498d9 100644
--- a/AddJFrame.java
+++ b/AddJFrame.java
@@ -24,159 +24,160 @@ import org.xml.sax.*;
 public class AddJFrame extends javax.swing.JFrame
 {
     int numRow = -1;
-	public AddJFrame()
-	{
-		getContentPane().setLayout(null);
-		getContentPane().setBackground(new java.awt.Color(204,207,201));
-		setSize(399,222);
-		setVisible(false);
-		addJLabel.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
-		addJLabel.setText("Add Tags");
-		getContentPane().add(addJLabel);
-		addJLabel.setForeground(java.awt.Color.black);
-		addJLabel.setFont(new Font("Dialog", Font.BOLD, 20));
-		addJLabel.setBounds(144,12,108,36);
-		addJLabel1.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
-		addJLabel1.setText("Select a name");
-		getContentPane().add(addJLabel1);
-		addJLabel1.setForeground(java.awt.Color.black);
-		addJLabel1.setFont(new Font("Dialog", Font.BOLD, 12));
-		addJLabel1.setBounds(24,72,108,24);
-		addJLabel2.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
-		addJLabel2.setText("of the .xsd file");
-		getContentPane().add(addJLabel2);
-		addJLabel2.setForeground(java.awt.Color.black);
-		addJLabel2.setFont(new Font("Dialog", Font.BOLD, 12));
-		addJLabel2.setBounds(24,96,108,24);
-		getContentPane().add(addJTextField1);
-		addJTextField1.setBounds(144,84,225,24);
-		addJButton1.setText("Parse");
-		addJButton1.setActionCommand("Parse");
-		getContentPane().add(addJButton1);
-		addJButton1.setBackground(new java.awt.Color(225,223,223));
-		addJButton1.setFont(new Font("Dialog", Font.BOLD, 15));
-		addJButton1.setBounds(192,120,84,24);
-		messageJLabel.setAutoscrolls(true);
-		getContentPane().add(messageJLabel);
-		messageJLabel.setForeground(java.awt.Color.black);
-		messageJLabel.setBounds(24,168,360,24);
-		SymMouse aSymMouse = new SymMouse();
-		addJButton1.addMouseListener(aSymMouse);
-	}
-
-	public AddJFrame(String sTitle)
-	{
-		this();
-		setTitle(sTitle);
-	}
+    String rootPath = null;
+    public AddJFrame(String path)
+    {
+	rootPath = path;
+	getContentPane().setLayout(null);
+	getContentPane().setBackground(new java.awt.Color(204,207,201));
+	setSize(399,222);
+	setVisible(false);
+	addJLabel.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
+	addJLabel.setText("Add Tags");
+	getContentPane().add(addJLabel);
+	addJLabel.setForeground(java.awt.Color.black);
+	addJLabel.setFont(new Font("Dialog", Font.BOLD, 20));
+	addJLabel.setBounds(144,12,108,36);
+	addJLabel1.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
+	addJLabel1.setText("Select a name");
+	getContentPane().add(addJLabel1);
+	addJLabel1.setForeground(java.awt.Color.black);
+	addJLabel1.setFont(new Font("Dialog", Font.BOLD, 12));
+	addJLabel1.setBounds(24,72,108,24);
+	addJLabel2.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
+	addJLabel2.setText("of the .xsd file");
+	getContentPane().add(addJLabel2);
+	addJLabel2.setForeground(java.awt.Color.black);
+	addJLabel2.setFont(new Font("Dialog", Font.BOLD, 12));
+	addJLabel2.setBounds(24,96,108,24);
+	getContentPane().add(addJTextField1);
+	addJTextField1.setBounds(144,84,225,24);
+	addJButton1.setText("Parse");
+	addJButton1.setActionCommand("Parse");
+	getContentPane().add(addJButton1);
+	addJButton1.setBackground(new java.awt.Color(225,223,223));
+	addJButton1.setFont(new Font("Dialog", Font.BOLD, 15));
+	addJButton1.setBounds(192,120,84,24);
+	messageJLabel.setAutoscrolls(true);
+	getContentPane().add(messageJLabel);
+	messageJLabel.setForeground(java.awt.Color.black);
+	messageJLabel.setBounds(24,168,360,24);
+	SymMouse aSymMouse = new SymMouse();
+	addJButton1.addMouseListener(aSymMouse);
+    }

-	public void setVisible(boolean b)
-	{
-		if (b)
-			setLocation(50, 50);
-		super.setVisible(b);
-	}
+    public AddJFrame(String sTitle, String path)
+    {
+	this(path);
+	setTitle(sTitle);
+    }

-	static public void main(String args[])
-	{
-		(new AddJFrame()).setVisible(true);
-	}
+    public void setVisible(boolean b)
+    {
+	if (b)
+	    setLocation(50, 50);
+	super.setVisible(b);
+    }

-	public void addNotify()
-	{
-		// Record the size of the window prior to calling parents addNotify.
-		Dimension size = getSize();

-		super.addNotify();
+    public void addNotify()
+    {
+	// Record the size of the window prior to calling parents addNotify.
+	Dimension size = getSize();

-		if (frameSizeAdjusted)
-			return;
-		frameSizeAdjusted = true;
+	super.addNotify();

-		// Adjust size of frame according to the insets and menu bar
-		Insets insets = getInsets();
-		javax.swing.JMenuBar menuBar = getRootPane().getJMenuBar();
-		int menuBarHeight = 0;
-		if (menuBar != null)
-			menuBarHeight = menuBar.getPreferredSize().height;
-		setSize(insets.left + insets.right + size.width, insets.top + insets.bottom + size.height + menuBarHeight);
-	}
+	if (frameSizeAdjusted)
+	    return;
+	frameSizeAdjusted = true;

-	// Used by addNotify
-	boolean frameSizeAdjusted = false;
-	static String dbName = null;
-	static String moduleDir = null;
-	static String oraclePath = null;
-	static DBInterfaceFrame db = null;
+	// Adjust size of frame according to the insets and menu bar
+	Insets insets = getInsets();
+	javax.swing.JMenuBar menuBar = getRootPane().getJMenuBar();
+	int menuBarHeight = 0;
+	if (menuBar != null)
+	    menuBarHeight = menuBar.getPreferredSize().height;
+	setSize(insets.left + insets.right + size.width, insets.top + insets.bottom + size.height + menuBarHeight);
+    }

-	javax.swing.JLabel addJLabel = new javax.swing.JLabel();
-	javax.swing.JLabel addJLabel1 = new javax.swing.JLabel();
-	javax.swing.JLabel addJLabel2 = new javax.swing.JLabel();
-	javax.swing.JTextField addJTextField1 = new javax.swing.JTextField();
-	javax.swing.JButton addJButton1 = new javax.swing.JButton();
-	static javax.swing.JLabel messageJLabel = new javax.swing.JLabel();
+    // Used by addNotify
+    boolean frameSizeAdjusted = false;
+    static String dbName = "oracleDB";
+    static String moduleDir = null;
+    static String oraclePath = null;
+    static DBInterfaceFrame db = null;
+    static String moduleInfo = null;
+    static String defaultModuleInfo = null;
+    static String dbLoc = null;
+
+    javax.swing.JLabel addJLabel = new javax.swing.JLabel();
+    javax.swing.JLabel addJLabel1 = new javax.swing.JLabel();
+    javax.swing.JLabel addJLabel2 = new javax.swing.JLabel();
+    javax.swing.JTextField addJTextField1 = new javax.swing.JTextField();
+    javax.swing.JButton addJButton1 = new javax.swing.JButton();
+    static javax.swing.JLabel messageJLabel = new javax.swing.JLabel();


-	class SymMouse extends java.awt.event.MouseAdapter
+    class SymMouse extends java.awt.event.MouseAdapter
+    {
+	public void mouseClicked(java.awt.event.MouseEvent event)
 	{
-		public void mouseClicked(java.awt.event.MouseEvent event)
-		{
-			Object object = event.getSource();
-			if (object == addJButton1)
-				addJButton1_mouseClicked(event);
-		}
+	    Object object = event.getSource();
+	    if (object == addJButton1)
+		addJButton1_mouseClicked(event);
 	}
+    }

-	void addJButton1_mouseClicked(java.awt.event.MouseEvent event)
-	{
-		String msg = initialize();
-		messageJLabel.setText("Processing started ...");
-		if(msg != null)
-		    return;
-		String fileName = addJTextField1.getText();
-		File file = new File(fileName);
-	    if(!file.exists())
-		{
-		    printError("File " + fileName + " does not exist");
-		    return;
-		}
-		BufferedReader inLine = null;
+    void addJButton1_mouseClicked(java.awt.event.MouseEvent event)
+    {
+	String msg = initialize();
+	messageJLabel.setText("Processing started ...");
+	if(msg != null)
+	    return;
+	String fileName = addJTextField1.getText();
+	File file = new File(fileName);
+	if(!file.exists())
+	    {
+		printError("File " + fileName + " does not exist");
+		return;
+	    }
+	BufferedReader inLine = null;
     	BufferedWriter outLine = null;
     	String line = null;
-	    try
+	try
 	    {
-		    inLine = new BufferedReader(new FileReader(fileName));
-		    outLine = new BufferedWriter(new FileWriter("oracletemp.txt"));
-		    line  = inLine.readLine();
+		inLine = new BufferedReader(new FileReader(fileName));
+		outLine = new BufferedWriter(new FileWriter("oracletemp.txt"));
+		line  = inLine.readLine();
 	    }
-	    catch (Exception e)
+	catch (Exception e)
 	    {
-		    printError("Error on file read/write:" +
-e.getMessage());
-            return;
+		printError("Error on file read/write:" +
+			   e.getMessage());
+		return;
 	    }
-	    String mainBuffer = "";
-	    if(line != null)
+	String mainBuffer = "";
+	if(line != null)
     	    line = line.trim();
-	    else
+	else
 	    {
         	printError("Format of .xsd file is not valid. Tag <schema> "
-				   + "is expected.");
-		    return;
-		}
-		try
-		{
-    	    while(line != null)
-	        {
-        	    outLine.write(line, 0, line.length());
+			   + "is expected.");
+		return;
+	    }
+	try
+	    {
+		while(line != null)
+		    {
+			outLine.write(line, 0, line.length());
 		        mainBuffer = mainBuffer + line;
 		        outLine.write("\n");
-        	    line = inLine.readLine();
-	        }
+			line = inLine.readLine();
+		    }
 	        outLine.close();
-    	    inLine.close();
+		inLine.close();
 	        FileInputStream is = new FileInputStream("oracletemp.txt");
-            //Verify the format of schema file.
+		//Verify the format of schema file.
         	SAXParser parser = new SAXParser();
 	        parser.parse(new InputSource(is));
 	        messageJLabel.setText("Schema document validation is successfull.");
@@ -184,44 +185,44 @@ e.getMessage());
 	    }
     	catch(Exception e)
 	    {
-		    printError(""+e);
-		    return;
-        }
+		printError(""+e);
+		return;
+	    }
     	msg = processFile("oracletemp.txt", mainBuffer);
     	if(msg != null)
     	    return;
     }

-	private String processFile(String fileName, String mainBuffer)
-	{
-	    BufferedReader inLine = null;
-	    String line = null;
-	    try
-	        {
+    private String processFile(String fileName, String mainBuffer)
+    {
+	BufferedReader inLine = null;
+	String line = null;
+	try
+	    {
 	        inLine = new BufferedReader(new FileReader(fileName));
 	        line = inLine.readLine();
-	        }
-	    catch(Exception e)
-	        {
-	            printError(""+e);
-	            return "error";
-	        }
+	    }
+	catch(Exception e)
+	    {
+		printError(""+e);
+		return "error";
+	    }
     	String mainPath = "";
-	    int level = -1;
+	int level = -1;
     	int index = -1;
-	    int index1 = -1;
+	int index1 = -1;
     	int index2 = -1;
-	    int j = -1;
+	int j = -1;
     	int i = -1;
-	    Vector element = new Vector(10);
+	Vector element = new Vector(10);
     	Hashtable paths = new Hashtable();
     	Hashtable moduleName = new Hashtable();
     	String elementName = null;
     	String typeName = null;
-	    String namespace = null;
+	String namespace = null;
     	while(line != null)
 	    {
-		    index = line.indexOf("element");
+		index = line.indexOf("element");
         	if(index != -1) //element
 		    {
 			j=index+8;
@@ -280,7 +281,7 @@ e.getMessage());
 					ElementInfo e = (ElementInfo) element.get(level);
 					if(index1 != -1)
 					    {
-					    moduleName.put(e, "");
+						moduleName.put(e, "");
 					    }
 					if(namespace != null)
 					    {
@@ -327,7 +328,7 @@ e.getMessage());
 					    }
 				    }
 			    }  //name not found
-			    else if((line.indexOf("element>")) != -1)
+			else if((line.indexOf("element>")) != -1)
 			    {
 				for(i=0; i<=level; i++)
 				    {
@@ -455,32 +456,32 @@ e.getMessage());
 				element.set(i, e);
 			    }
 		    }
-		    try
-		        {
-	            line = inLine.readLine();
+		try
+		    {
+			line = inLine.readLine();
 	            }
 	        catch(Exception ex)
 	            {
-	            printError(""+ex);
-	            return "error";
+			printError(""+ex);
+			return "error";
 	            }
 	    }
-	    String msg = askModuleInfo(moduleName);
-	    if(msg != null)
-	        return "error";
-	    else
-	        return null;
-	}
+	String msg = askModuleInfo(moduleName);
+	if(msg != null)
+	    return "error";
+	else
+	    return null;
+    }

-	private void refreshScreen()
-	{
-	    addJTextField1.setText(" ");
-	    messageJLabel.setText(" ");
-	}
+    private void refreshScreen()
+    {
+	addJTextField1.setText(" ");
+	messageJLabel.setText(" ");
+    }

-	/**
-  	* This method is used to increase the version value for the tags.
-  	*/
+    /**
+     * This method is used to increase the version value for the tags.
+     */

     public String modifyKeyValue(String key, int version)
     {
@@ -493,17 +494,17 @@ e.getMessage());
     }


-	private String askModuleInfo(Hashtable main)
+    private String askModuleInfo(Hashtable main)
+    {
+	String msg = null;
+	Vector moduleVector = new Vector();
+	ElementInfo element = null;
+	String key = null;
+	String moduleInfo = null;
+	int ind = 0;
+	ElementInfo elementInfo = null;
+	for(Enumeration e = main.keys();e.hasMoreElements();)
 	    {
-	    String msg = null;
-	    Vector moduleVector = new Vector();
-	    ElementInfo element = null;
-	    String key = null;
-	    String moduleInfo = null;
-	    int ind = 0;
-	    ElementInfo elementInfo = null;
-	    for(Enumeration e = main.keys();e.hasMoreElements();)
-	        {
 	        element = (ElementInfo)e.nextElement();
 	        key = element.getKey();
 	        Object getDB = db.get(key);
@@ -512,33 +513,33 @@ e.getMessage());
 		        elementInfo = ElementInfo.getElementInfo((String)getDB);
 		        element.setModuleInfo(elementInfo.getModuleInfo());
 		        int version = elementInfo.getVersion();
-				String newKey = modifyKeyValue(key, version);
-				version++;
-				elementInfo.setVersion(version);
-				db.remove(key);
-				elementInfo.setKey(newKey);
-				db.put(newKey, elementInfo.toString());
+			String newKey = modifyKeyValue(key, version);
+			version++;
+			elementInfo.setVersion(version);
+			db.remove(key);
+			elementInfo.setKey(newKey);
+			db.put(newKey, elementInfo.toString());
 	            }
-	         moduleVector.add(ind, element);
-	         ind++;
-	        }
-	        int row = 0;
-	        for(Enumeration e = moduleVector.elements();e.hasMoreElements();)
-	        {
-	            e.nextElement();
-	            row++;
-	        }
-	        Object[][] moduleArray;
-	        moduleArray = new Object[row][4];
-	        int i =0;
-	        for(Enumeration e = moduleVector.elements();e.hasMoreElements();)
-	        {
-	            moduleArray[i][0] = e.nextElement();
-	            i++;
-	        }
-	        ModuleTable.showTable(moduleArray, row);
-		    return msg;
-       	}
+		moduleVector.add(ind, element);
+		ind++;
+	    }
+	int row = 0;
+	for(Enumeration e = moduleVector.elements();e.hasMoreElements();)
+	    {
+		e.nextElement();
+		row++;
+	    }
+	Object[][] moduleArray;
+	moduleArray = new Object[row][4];
+	int i =0;
+	for(Enumeration e = moduleVector.elements();e.hasMoreElements();)
+	    {
+		moduleArray[i][0] = e.nextElement();
+		i++;
+	    }
+	ModuleTable.showTable(moduleArray, row);
+	return msg;
+    }

     public static void addToDB(Object[][] moduleInfo, int row)
     {
@@ -546,85 +547,101 @@ e.getMessage());
         String key = null;
         String msg = null;
         for(int i=0; i<row; i++)
-        {
-            element = (ElementInfo)moduleInfo[i][0];
-            key = element.getKey();
-            element.setModuleInfo(moduleInfo[i][1].toString());
-            msg = db.put(key, element.toString());
+	    {
+		element = (ElementInfo)moduleInfo[i][0];
+		key = element.getKey();
+		element.setModuleInfo(moduleInfo[i][1].toString());
+		msg = db.put(key, element.toString());
 	        if(msg != null)
-	        {
-		    printError(msg);
-		    return;
+		    {
+			printError(msg);
+			return;
 		    }
-		}
-		msg = db.shutdown();
-		if(msg != null)
-		{
-		    printError(msg);
-		    return;
-		}
-		messageJLabel.setText("Tags are successfully added");
+	    }
+	msg = db.shutdown();
+	if(msg != null)
+	    {
+		printError(msg);
 		return;
+	    }
+	messageJLabel.setText("Tags are successfully added");
+	return;
     }


     private String initialize()
-        {
-       	File file = new File("oracle.prop");
-	    Properties property = new Properties();
-	    String msg = null;
-	    try
-	        {
-		    property.load(new FileInputStream(file));
-	        }
-	    catch(FileNotFoundException ffe)
-	        {
-		    printError("Exception: " + ffe);
-		    return "error";
-	        }
-	    catch(IOException ioe)
-	        {
-		    printError("Exception: "+ ioe);
-		    return "error";
-	        }
-	    oraclePath = property.getProperty("oraclePath");
-	    if(oraclePath == null || oraclePath.length() < 1)
+    {
+	String msg = null;
+	//code to read parameters from the property file
+	File file = new File(rootPath + File.separator + "oracle.prop");
+	if(!file.exists())
+	    {
+		file = new File(rootPath + File.separator + "psl" + File.separator + "oracle" + File.separator + "oracle.prop");
+		if(!file.exists())
+		    {
+			printError("File 'oracle.prop' does not exist");
+			return "error";
+		    }
+	    }
+	Properties property = new Properties();
+	try
 	    {
-		    printError("Parameter 'oraclePath' must be set in 'oracle.prop' file.");
-		    return "error";
+		property.load(new FileInputStream(file));
 	    }
-	    dbName = property.getProperty("dbName");
-	    if(dbName == null || dbName.length() < 1)
-	        {
-		    printError("Parameter 'dbName' must be set in 'oracle.prop' file.");
-		    return "error";
-	        }
-	    moduleDir = property.getProperty("moduleDir");
+	catch(FileNotFoundException ffe)
+	    {
+		printError("Exception: " + ffe);
+		return "error";
+	    }
+	catch(IOException ioe)
+	    {
+		printError("Exception: "+ ioe);
+		return "error";
+	    }
+	moduleInfo = property.getProperty("defaultModuleInfo");
+	if(moduleInfo == null || moduleInfo.length() < 1)
+	    {
+		printError("Parameter 'defaultModuleInfo' must be set in 'oracle.prop' file.");
+		return "error";
+	    }
+	defaultModuleInfo = moduleInfo;
+	dbLoc = property.getProperty("dbLocation");
+	if(dbLoc == null || dbLoc.length() < 1)
+	    {
+		printError("Parameter 'dbLocation' must be set in 'oracle.prop' file.");
+		return "error";
+	    }
+	moduleDir = property.getProperty("moduleDir");
         if(moduleDir == null || moduleDir.length() < 1)
-	        {
-		    printError("Parameter 'moduleDir' must be set in 'oracle.prop' file.");
-		    return "error";
-	        }
-	    moduleDir = oraclePath + File.separator + moduleDir;
-	    db = null;
-	    try
-	        {
-		    db = new DBInterfaceFrame(dbName);
-	        }
-	    catch(Exception e)
-	        {
-		    printError("Exception in database: " + e);
-		    msg = db.shutdown();
-		    return "error";
-	        }
-	    return null;
-	   	}
+	    {
+		printError("Parameter 'moduleDir' must be set in 'oracle.prop' file.");
+		return "error";
+	    }
+
+	//property file code end here
+	try
+	    {
+		//dbName = dbLoc + File.separator + dbName;
+		db = new DBInterfaceFrame(dbName);
+	    }
+	catch(Exception e)
+	    {
+		printError("Exception in database: " + e);
+		msg = db.shutdown();
+		return "error";
+	    }
+	return null;
+    }
+
+    public static void printError(String msg)
+    {
+	ErrorJDialog ed = new ErrorJDialog();
+	ed.setMessage(msg);
+    }
+
+
+}
+

-	   	static void printError(String msg)
-	   	{
-	   	    ErrorJDialog ed = new ErrorJDialog();
-	        ed.setMessage(msg);
-	   	}


-}
\ No newline at end of file
diff --git a/DBAccessApplet.java b/DBAccessApplet.java
new file mode 100644
index 0000000..d63ca75
--- /dev/null
+++ b/DBAccessApplet.java
@@ -0,0 +1,101 @@
+/**
+ * Title: DBAccessApplet
+ * Description: A main frame to access Oracle database. It provides user
+ *              an option of adding or deleting the tags to the database.
+ * Copyright (c) 2000: The Trustees of Columbia University and the City of New York.
+  *                              All Rights Reserved.
+ * Company:      <p>
+ * @author Kanan Naik
+ * @version 1.0
+ */
+
+package psl.oracle;
+
+import java.awt.*;
+import javax.swing.*;
+
+
+public class DBAccessApplet extends JApplet
+{
+	public void init()
+	{
+		getRootPane().putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE);
+		getContentPane().setLayout(null);
+		getContentPane().setBackground(new java.awt.Color(204,207,201));
+		getContentPane().setFont(new Font("Dialog", Font.PLAIN, 20));
+		setSize(360,213);
+		addJButton.setText("Add");
+		addJButton.setActionCommand("Add");
+		getContentPane().add(addJButton);
+		addJButton.setBackground(new java.awt.Color(225,223,223));
+		addJButton.setFont(new Font("Dialog", Font.BOLD, 15));
+		addJButton.setBounds(216,48,84,24);
+		deleteJButton.setText("Delete");
+		deleteJButton.setActionCommand("Delete");
+		getContentPane().add(deleteJButton);
+		deleteJButton.setBackground(new java.awt.Color(225,223,223));
+		deleteJButton.setFont(new Font("Dialog", Font.BOLD, 15));
+		deleteJButton.setBounds(216,120,84,24);
+		titleJLabel1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
+		titleJLabel1.setText("FleXML-Oracle");
+		getContentPane().add(titleJLabel1);
+		titleJLabel1.setForeground(java.awt.Color.black);
+		titleJLabel1.setFont(new Font("Dialog", Font.BOLD, 17));
+		titleJLabel1.setBounds(48,72,144,36);
+		titleJLabel2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
+		titleJLabel2.setText("Database");
+		getContentPane().add(titleJLabel2);
+		titleJLabel2.setForeground(java.awt.Color.black);
+		titleJLabel2.setFont(new Font("Dialog", Font.BOLD, 17));
+		titleJLabel2.setBounds(60,120,132,36);
+		SymMouse aSymMouse = new SymMouse();
+		addJButton.addMouseListener(aSymMouse);
+		deleteJButton.addMouseListener(aSymMouse);
+	}
+
+	javax.swing.JButton addJButton = new javax.swing.JButton();
+	javax.swing.JButton deleteJButton = new javax.swing.JButton();
+	javax.swing.JLabel titleJLabel1 = new javax.swing.JLabel();
+	javax.swing.JLabel titleJLabel2 = new javax.swing.JLabel();
+
+	class SymMouse extends java.awt.event.MouseAdapter
+	{
+		public void mouseClicked(java.awt.event.MouseEvent event)
+		{
+			Object object = event.getSource();
+			if (object == addJButton)
+				addJButton_mouseClicked(event);
+			else if (object == deleteJButton)
+				deleteJButton_mouseClicked(event);
+
+		}
+	}
+
+	void addJButton_mouseClicked(java.awt.event.MouseEvent event)
+	{
+		addJButton_mouseClicked_Interaction1(event);
+	}
+
+	void addJButton_mouseClicked_Interaction1(java.awt.event.MouseEvent event)
+	{
+		try {
+			// AddJFrame Create and show the AddJFrame
+			(new AddJFrame(".")).setVisible(true);
+		} catch (java.lang.Exception e) {
+		}
+	}
+
+	void deleteJButton_mouseClicked(java.awt.event.MouseEvent event)
+	{
+		deleteJButton_mouseClicked_Interaction1(event);
+	}
+
+	void deleteJButton_mouseClicked_Interaction1(java.awt.event.MouseEvent event)
+	{
+		try {
+			// DeleteJFrame Create and show the DeleteJFrame
+			(new DeleteJFrame(".")).setVisible(true);
+		} catch (java.lang.Exception e) {
+		}
+	}
+}
diff --git a/DBAccessApplication.java b/DBAccessApplication.java
new file mode 100644
index 0000000..5eddb78
--- /dev/null
+++ b/DBAccessApplication.java
@@ -0,0 +1,113 @@
+/**
+ * Title: DBAccessApplication
+ * Description: A main frame to access Oracle database. It provides user
+ *              an option of adding or deleting the tags to the database.
+ * Copyright (c) 2000: The Trustees of Columbia University and the City of New York.
+  *                              All Rights Reserved.
+ * Company:      <p>
+ * @author Kanan Naik
+ * @version 1.0
+ */
+
+package psl.oracle;
+
+import java.awt.*;
+import javax.swing.*;
+
+
+public class DBAccessApplication
+{
+	public DBAccessApplication(JFrame frame)
+	{
+		frame.getContentPane().setLayout(null);
+		frame.getContentPane().setBackground(new java.awt.Color(204,207,201));
+		frame.getContentPane().setFont(new Font("Dialog", Font.PLAIN, 20));
+		frame.setSize(360,213);
+		addJButton.setText("Add");
+		addJButton.setActionCommand("Add");
+		frame.getContentPane().add(addJButton);
+		addJButton.setBackground(new java.awt.Color(225,223,223));
+		addJButton.setFont(new Font("Dialog", Font.BOLD, 15));
+		addJButton.setBounds(216,48,84,24);
+		deleteJButton.setText("Delete");
+		deleteJButton.setActionCommand("Delete");
+		frame.getContentPane().add(deleteJButton);
+		deleteJButton.setBackground(new java.awt.Color(225,223,223));
+		deleteJButton.setFont(new Font("Dialog", Font.BOLD, 15));
+		deleteJButton.setBounds(216,120,84,24);
+		titleJLabel1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
+		titleJLabel1.setText("FleXML-Oracle");
+		frame.getContentPane().add(titleJLabel1);
+		titleJLabel1.setForeground(java.awt.Color.black);
+		titleJLabel1.setFont(new Font("Dialog", Font.BOLD, 17));
+		titleJLabel1.setBounds(48,72,144,36);
+		titleJLabel2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
+		titleJLabel2.setText("Database");
+		frame.getContentPane().add(titleJLabel2);
+		titleJLabel2.setForeground(java.awt.Color.black);
+		titleJLabel2.setFont(new Font("Dialog", Font.BOLD, 17));
+		titleJLabel2.setBounds(60,120,132,36);
+		SymMouse aSymMouse = new SymMouse();
+		addJButton.addMouseListener(aSymMouse);
+		deleteJButton.addMouseListener(aSymMouse);
+	}
+    static String rootPath = null;
+	javax.swing.JButton addJButton = new javax.swing.JButton();
+	javax.swing.JButton deleteJButton = new javax.swing.JButton();
+	javax.swing.JLabel titleJLabel1 = new javax.swing.JLabel();
+	javax.swing.JLabel titleJLabel2 = new javax.swing.JLabel();
+
+	class SymMouse extends java.awt.event.MouseAdapter
+	{
+		public void mouseClicked(java.awt.event.MouseEvent event)
+		{
+			Object object = event.getSource();
+			if (object == addJButton)
+				addJButton_mouseClicked(event);
+			else if (object == deleteJButton)
+				deleteJButton_mouseClicked(event);
+
+		}
+	}
+
+	void addJButton_mouseClicked(java.awt.event.MouseEvent event)
+	{
+		addJButton_mouseClicked_Interaction1(event);
+	}
+
+	void addJButton_mouseClicked_Interaction1(java.awt.event.MouseEvent event)
+	{
+		try {
+			// AddJFrame Create and show the AddJFrame
+			(new AddJFrame(rootPath)).setVisible(true);
+		} catch (java.lang.Exception e) {
+		}
+	}
+
+	void deleteJButton_mouseClicked(java.awt.event.MouseEvent event)
+	{
+		deleteJButton_mouseClicked_Interaction1(event);
+	}
+
+	void deleteJButton_mouseClicked_Interaction1(java.awt.event.MouseEvent event)
+	{
+		try {
+			// DeleteJFrame Create and show the DeleteJFrame
+			(new DeleteJFrame(rootPath)).setVisible(true);
+		} catch (java.lang.Exception e) {
+		}
+	}
+
+    public static void main(String[] args)
+    {
+	if(args.length != 1)
+	    {
+		System.out.println("Usage: java DBAccessApplication <root path>");
+		System.exit(0);
+	    }
+	rootPath = args[0];
+	JFrame frame = new JFrame();
+	DBAccessApplication daa = new DBAccessApplication(frame);
+	frame.show();
+    }
+}
diff --git a/DBAccessFrame.java b/DBAccessFrame.java
deleted file mode 100644
index b6bcc43..0000000
--- a/DBAccessFrame.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/**
- * Title: DBAccessFrame
- * Description: A main frame to access Oracle database. It provides user
- *              an option of adding or deleting the tags to the database.
- * Copyright (c) 2000: The Trustees of Columbia University and the City of New York.
-  *                              All Rights Reserved.
- * Company:      <p>
- * @author Kanan Naik
- * @version 1.0
- */
-
-package psl.oracle;
-
-import java.awt.*;
-import javax.swing.*;
-
-
-public class DBAccessFrame extends JApplet
-{
-	public void init()
-	{
-		getRootPane().putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE);
-		getContentPane().setLayout(null);
-		getContentPane().setBackground(new java.awt.Color(204,207,201));
-		getContentPane().setFont(new Font("Dialog", Font.PLAIN, 20));
-		setSize(360,213);
-		addJButton.setText("Add");
-		addJButton.setActionCommand("Add");
-		getContentPane().add(addJButton);
-		addJButton.setBackground(new java.awt.Color(225,223,223));
-		addJButton.setFont(new Font("Dialog", Font.BOLD, 15));
-		addJButton.setBounds(216,48,84,24);
-		deleteJButton.setText("Delete");
-		deleteJButton.setActionCommand("Delete");
-		getContentPane().add(deleteJButton);
-		deleteJButton.setBackground(new java.awt.Color(225,223,223));
-		deleteJButton.setFont(new Font("Dialog", Font.BOLD, 15));
-		deleteJButton.setBounds(216,120,84,24);
-		titleJLabel1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
-		titleJLabel1.setText("FleXML-Oracle");
-		getContentPane().add(titleJLabel1);
-		titleJLabel1.setForeground(java.awt.Color.black);
-		titleJLabel1.setFont(new Font("Dialog", Font.BOLD, 17));
-		titleJLabel1.setBounds(48,72,144,36);
-		titleJLabel2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
-		titleJLabel2.setText("Database");
-		getContentPane().add(titleJLabel2);
-		titleJLabel2.setForeground(java.awt.Color.black);
-		titleJLabel2.setFont(new Font("Dialog", Font.BOLD, 17));
-		titleJLabel2.setBounds(60,120,132,36);
-		SymMouse aSymMouse = new SymMouse();
-		addJButton.addMouseListener(aSymMouse);
-		deleteJButton.addMouseListener(aSymMouse);
-	}
-
-	javax.swing.JButton addJButton = new javax.swing.JButton();
-	javax.swing.JButton deleteJButton = new javax.swing.JButton();
-	javax.swing.JLabel titleJLabel1 = new javax.swing.JLabel();
-	javax.swing.JLabel titleJLabel2 = new javax.swing.JLabel();
-
-	class SymMouse extends java.awt.event.MouseAdapter
-	{
-		public void mouseClicked(java.awt.event.MouseEvent event)
-		{
-			Object object = event.getSource();
-			if (object == addJButton)
-				addJButton_mouseClicked(event);
-			else if (object == deleteJButton)
-				deleteJButton_mouseClicked(event);
-
-		}
-	}
-
-	void addJButton_mouseClicked(java.awt.event.MouseEvent event)
-	{
-		addJButton_mouseClicked_Interaction1(event);
-	}
-
-	void addJButton_mouseClicked_Interaction1(java.awt.event.MouseEvent event)
-	{
-		try {
-			// AddJFrame Create and show the AddJFrame
-			(new AddJFrame()).setVisible(true);
-		} catch (java.lang.Exception e) {
-		}
-	}
-
-	void deleteJButton_mouseClicked(java.awt.event.MouseEvent event)
-	{
-		deleteJButton_mouseClicked_Interaction1(event);
-	}
-
-	void deleteJButton_mouseClicked_Interaction1(java.awt.event.MouseEvent event)
-	{
-		try {
-			// DeleteJFrame Create and show the DeleteJFrame
-			(new DeleteJFrame()).setVisible(true);
-		} catch (java.lang.Exception e) {
-		}
-	}
-}
diff --git a/DBInterfaceFrame.java b/DBInterfaceFrame.java
index bdf2032..90ab7c4 100644
--- a/DBInterfaceFrame.java
+++ b/DBInterfaceFrame.java
@@ -32,12 +32,13 @@ public class DBInterfaceFrame
     public DBInterfaceFrame(String userTableName)
     {
       tableName = userTableName;
-      dbname = userTableName+".dat";
+      dbname = userTableName;

       try
       {
         Class.forName("org.hsql.jdbcDriver");
-        conn=DriverManager.getConnection("jdbc:HypersonicSQL:dbname","sa","");
+	String server = "jdbc:HypersonicSQL:" + dbname;
+        conn=DriverManager.getConnection(server,"sa","");
         Statement stat=conn.createStatement();
         stat.execute("CREATE TABLE " + userTableName + "(key varchar(2000),element varchar(20000))");
       }
@@ -149,3 +150,8 @@ public class DBInterfaceFrame



+
+
+
+
+
diff --git a/DeleteJFrame.java b/DeleteJFrame.java
index 9d963c3..c3eff18 100644
--- a/DeleteJFrame.java
+++ b/DeleteJFrame.java
@@ -18,10 +18,12 @@ import java.util.*;
 public class DeleteJFrame extends javax.swing.JFrame
 {
     DBInterfaceFrame db = null;
-    String dbName = null;
-
-	public DeleteJFrame()
+    String dbName = "oracleDB";
+    String rootPath = null;
+    String dbLoc = null;
+	public DeleteJFrame(String path)
 	{
+	    rootPath = path;
 		getContentPane().setLayout(null);
 		getContentPane().setBackground(new java.awt.Color(204,207,201));
 		setSize(387,289);
@@ -71,9 +73,9 @@ public class DeleteJFrame extends javax.swing.JFrame

 	}

-	public DeleteJFrame(String sTitle)
+	public DeleteJFrame(String sTitle, String path)
 	{
-		this();
+		this(path);
 		setTitle(sTitle);
 	}

@@ -84,10 +86,6 @@ public class DeleteJFrame extends javax.swing.JFrame
 		super.setVisible(b);
 	}

-	static public void main(String args[])
-	{
-		(new DeleteJFrame()).setVisible(true);
-	}

 	public void addNotify()
 	{
@@ -111,6 +109,7 @@ public class DeleteJFrame extends javax.swing.JFrame

 	// Used by addNotify
 	boolean frameSizeAdjusted = false;
+

 	javax.swing.JLabel deleteJLabel = new javax.swing.JLabel();
 	javax.swing.JLabel deleteJLabel1 = new javax.swing.JLabel();
@@ -129,45 +128,56 @@ public class DeleteJFrame extends javax.swing.JFrame


     String initializeParam()
-	{
-	    //code to read parameters from the property file
-	    File file = new File("oracle.prop");
-        if(file.exists() ==  false)
-        {
-            deleteMessageLabel.setText("File 'oracle.prop' must exist");
-            return "error";
-        }
-        Properties property = new Properties();
-        try
-        {
-            property.load(new FileInputStream(file));
-        }
-        catch(FileNotFoundException ffe)
-        {
-            deleteMessageLabel.setText("Exception: " + ffe);
-        }
-        catch(IOException ioe)
-        {
-            deleteMessageLabel.setText("Exception: "+ ioe);
-        }
-        dbName = property.getProperty("dbName");
-        if(dbName == null || dbName.length() < 1)
-        {
-            deleteMessageLabel.setText("Parameter 'dbName' must be set in 'oracle.prop' file.");
-            return "error";
-        }
-        try
-        {
-            db = new DBInterfaceFrame(dbName);
-        }
-        catch(Exception e)
-        {
-            deleteMessageLabel.setText("Exception in database: " + e);
-            shutdownDB();
-        }
-        return null;
-   }
+    {
+	String msg = null;
+	//code to read parameters from the property file
+	File file = new File(rootPath + File.separator + "oracle.prop");
+	if(!file.exists())
+	    {
+		file = new File(rootPath + File.separator + "psl" + File.separator + "oracle" + File.separator + "oracle.prop");
+		if(!file.exists())
+		    {
+			printError("File 'oracle.prop' does not exist");
+			return "error";
+		    }
+	    }
+	Properties property = new Properties();
+	try
+	    {
+		property.load(new FileInputStream(file));
+	    }
+	catch(FileNotFoundException ffe)
+	    {
+		printError("Exception: " + ffe);
+		return "error";
+	    }
+	catch(IOException ioe)
+	    {
+		printError("Exception: "+ ioe);
+		return "error";
+	    }
+	dbLoc = property.getProperty("dbLocation");
+	if(dbLoc == null || dbLoc.length() < 1)
+	    {
+		printError("Parameter 'dbLocation' must be set in 'oracle.prop' file.");
+		return "error";
+	    }
+	//property file code end here
+	try
+	    {
+		//dbName = dbLoc + File.separator + dbName;
+		db = new DBInterfaceFrame(dbName);
+	    }
+	catch(Exception e)
+	    {
+		printError("Exception in database: " + e);
+		msg = db.shutdown();
+		return "error";
+	    }
+	return null;
+    }

+
 	class SymMouse extends java.awt.event.MouseAdapter
 	{
 		public void mouseClicked(java.awt.event.MouseEvent event)
@@ -211,4 +221,10 @@ public class DeleteJFrame extends javax.swing.JFrame
 	        }
 	    }
 	}
-}
\ No newline at end of file
+
+     public static void printError(String msg)
+    {
+	ErrorJDialog ed = new ErrorJDialog();
+	ed.setMessage(msg);
+    }
+}
diff --git a/oracleDB.properties b/oracleDB.properties
index 5bebcbf..ecda3d6 100644
--- a/oracleDB.properties
+++ b/oracleDB.properties
@@ -1,4 +1,4 @@
 #Hypersonic SQL database
-#Wed Apr 04 16:44:19 EDT 2001
+#Wed Apr 04 16:50:17 EDT 2001
 version=1.4
 modified=no