[Fedora-directory-commits] console/src/com/netscape/management/client/util ClassLoaderUtil.java, 1.1.1.1, 1.2 LocalJarClassLoader.java, 1.2, 1.3

Nathan Kinder (nkinder) fedora-directory-commits at redhat.com
Tue Nov 29 18:37:25 UTC 2005


Author: nkinder

Update of /cvs/dirsec/console/src/com/netscape/management/client/util
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv22252/src/com/netscape/management/client/util

Modified Files:
	ClassLoaderUtil.java LocalJarClassLoader.java 
Log Message:
173947 - Added ability to build a Console RPM.  The layout of Console can now be distributed inside system locations instead of being self-contained.


Index: ClassLoaderUtil.java
===================================================================
RCS file: /cvs/dirsec/console/src/com/netscape/management/client/util/ClassLoaderUtil.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- ClassLoaderUtil.java	18 Jul 2005 00:34:25 -0000	1.1.1.1
+++ ClassLoaderUtil.java	29 Nov 2005 18:37:17 -0000	1.2
@@ -50,13 +50,13 @@
             return false;
 
         if (Debug.getTraceLevel() >= 7) {
-            Debug.println(7, debugTag + " Search <" + sJarName + "> in java/jars ");
+            Debug.println(7, debugTag + " Search <" + sJarName + "> in " + LocalJarClassLoader.jarsDir);
             String list = "";
             for (int n = 0 ; n < sJarList.length ; n++) {
 
                 list += "<"+sJarList[n] + ">";
             }
-            Debug.println(7, debugTag + " java/jars content: " + list);
+            Debug.println(7, debugTag + LocalJarClassLoader.jarsDir + " content: " + list);
         }
 
         for (int i = 0 ; i < sJarList.length ; i++)


Index: LocalJarClassLoader.java
===================================================================
RCS file: /cvs/dirsec/console/src/com/netscape/management/client/util/LocalJarClassLoader.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- LocalJarClassLoader.java	26 Oct 2005 23:16:29 -0000	1.2
+++ LocalJarClassLoader.java	29 Nov 2005 18:37:17 -0000	1.3
@@ -25,8 +25,8 @@
 import java.net.URL;
 import java.net.MalformedURLException;
 import com.netscape.management.client.comm.*;
-
 import com.netscape.management.client.console.ConsoleInfo;
+import com.netscape.management.client.console.Console;
 
 /**
  * The LocalJarClassLoader is designed to load classes from jars
@@ -55,11 +55,13 @@
 
     private static final String debugTag = "ClassLoader: ";
 
+    static String jarsDir = Console.PREFERENCE_DIR + "jars" + File.separator;
+
     /**
-     *  Patch table lists all files in the ./patch directory
+     *  Patch table lists all files in the PREFERENCE_DIR/patch directory
      */
     static String patchFilePrefix = "patch-";
-    static String patchDir = "./patch/";
+    static String patchDir = Console.PREFERENCE_DIR + "patch" + File.separator;
     static Hashtable patchTable;
 
     static {
@@ -408,22 +410,17 @@
 
 
     /**
-      * A jar file is either in <server-root>/java/jars or in <server-root>/java
+      * Server jar file located in jarsDir
       */
     protected static String locateJarFile(String jarname) {
-        // Look for files first in jars/.
+        // Look for files in jarsDir.
+        String filename = jarsDir + jarname;
 
-        //String filename = "jars/" + jarname;
-        String filename = "jars" + File.separator + jarname;
         if (!((new File(filename)).exists())) {
-            // file not found in jars/, look in ./
-
-            filename = jarname;
-            if (!((new File(filename)).exists())) {
-                return null;
-            }
+            return null;
+        } else {
+            return filename;
         }
-        return filename;
     }
 
 
@@ -475,17 +472,14 @@
 
     /**
       * Returns a list of the jarfiles stored in the local jar directory.
-      * This directory is currently ./jars, which assumes that our ultimate
-      * application installation strategy will allow for a directory called
-      * jars in the cwd of the VM on startup.
       *
       * @return an array of the locally stored jar files.
       */
     public static String[] getLocalJarList() {
-        File f = new File("jars");
+        File f = new File(jarsDir);
 
         if (!f.exists() || !f.isDirectory()) {
-            Debug.println(0, debugTag + "getLocalJarList():Unable to read ./jars directory");
+            Debug.println(0, debugTag + "getLocalJarList():Unable to read " + jarsDir + " directory");
             return null;
         }
 
@@ -498,7 +492,7 @@
     }
 
     /**
-      * Returns a list of the patch files stored in the ./patch directory.
+      * Returns a list of the patch files stored in the patch directory.
       * A patch file name format is patch-<jar-file> e.g. patch-ds41.jar
       *
       * @return a hashtable of patchFile
@@ -531,7 +525,7 @@
 
     /**
       * Acquires the jar file from the remote http server and stores it in the local
-      * jar directory, which is currently assumed to be ./jars. It will look in
+      * jar directory, which is currently assumed to be PREFERENCE_DIR/jars. It will look in
       * the <baseURL>/java, followed by <baseURL>/java/jars and finally <baseURL>
       * directory, and it will also attempt to retrieve any L10N supplements, if found.
       *
@@ -557,7 +551,7 @@
             for (int i=0; i < createdFiles.size(); i++) {
                 try {
                     String filename = (String)createdFiles.elementAt(i);
-                    File f = new File("jars/" + filename);
+                    File f = new File(jarsDir + filename);
                     boolean deleted = f.delete();
                     if (deleted) {
                         Debug.println(1, debugTag + " Cleanup: removed " + f);
@@ -750,13 +744,12 @@
                 Thread.currentThread().sleep(20);
             }
 
-            String jarPath = "jars";
-            File f = new File(jarPath);
+            File f = new File(jarsDir);
             if (!f.exists())
                 f.mkdir();
 
             FileOutputStream fos =
-                    new FileOutputStream(jarPath + "/" + filename);
+                    new FileOutputStream(jarsDir + filename);
             AsyncByteArrayInputStream ais = (AsyncByteArrayInputStream) is;
             fos.write(ais.getBuf(), 0, ais.size());
             fos.close();
@@ -811,7 +804,7 @@
         Vector jars = new Vector();
 
         try {
-            f = new ZipFile("jars/" + mainJar);
+            f = new ZipFile(jarsDir + mainJar);
             ZipEntry e = f.getEntry(MANIFEST_FILE_NAME);
             String jarname, compList = null;
 
@@ -981,7 +974,7 @@
     }
 
     /**
-      * Parse all jars in java/jars for 'backward-compatible'
+      * Parse all jars in jarsDir for 'backward-compatible'
       * directive in the manifest file
       */
     public static void parseAllJars(Hashtable table, String[] jars) {
@@ -989,7 +982,7 @@
             return;
         for (int i = 0; i < jars.length; i++) {
             try {
-                ZipFile f = new ZipFile("jars/" + jars[i]);
+                ZipFile f = new ZipFile(LocalJarClassLoader.jarsDir + jars[i]);
                 ZipEntry e = f.getEntry(
                         LocalJarClassLoader.MANIFEST_FILE_NAME);
                 if (e == null) {
@@ -1023,7 +1016,7 @@
                 }
             } catch (Exception ex) {
                 Debug.println(0,
-                        debugTag + " error process manifest for jars/" +
+                        debugTag + " error process manifest for " + LocalJarClassLoader.jarsDir +
                         jars[i] + " " + ex);
                 continue;
             }




More information about the Fedora-directory-commits mailing list