[wsas-java-dev] svn commit r4566 - trunk/wsas/java/modules/core/src/org/wso2/wsas/installer

svn at wso2.org svn at wso2.org
Sun Jul 1 05:07:09 PDT 2007


Author: azeez
Date: Sun Jul  1 05:07:01 2007
New Revision: 4566

Modified:
   trunk/wsas/java/modules/core/src/org/wso2/wsas/installer/AbstractAppServerInstaller.java
   trunk/wsas/java/modules/core/src/org/wso2/wsas/installer/AbstractInstaller.java
   trunk/wsas/java/modules/core/src/org/wso2/wsas/installer/TomcatInstaller.java
Log:
Removing some hardcoded versions



Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/installer/AbstractAppServerInstaller.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/installer/AbstractAppServerInstaller.java	(original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/installer/AbstractAppServerInstaller.java	Sun Jul  1 05:07:01 2007
@@ -75,10 +75,11 @@
     protected void copyDerbyJAR(String toDir) throws InstallationException {
         try {
             File libDir = new File(toDir);
-            System.out.println("Copying \"lib/derby-10.1.1.0.jar\" to \"" +
+            String derbyJar = getItem("lib", "derby-", ".jar");
+            System.out.println("Copying \"lib/" + derbyJar + "\" to \"" +
                                libDir.getAbsolutePath() + "\"");
             File destDerbyJar = new File(libDir.getAbsolutePath() +
-                                         File.separator + "derby-10.1.1.0.jar");
+                                         File.separator + derbyJar);
             String delete;
             if (destDerbyJar.exists()) {
                 do {
@@ -91,16 +92,16 @@
                        !(delete.trim().length() == 0));
                 if (delete.equalsIgnoreCase("y") || delete.trim().length() == 0) {
                     destDerbyJar.delete();
-                    fileMan.copyFile(new File("lib/derby-10.1.1.0.jar"),
+                    fileMan.copyFile(new File("lib" + File.separator + derbyJar),
                                      destDerbyJar);
                 }
             } else {
-                fileMan.copyFile(new File("lib/derby-10.1.1.0.jar"),
+                fileMan.copyFile(new File("lib" + File.separator + derbyJar),
                                  destDerbyJar);
             }
             System.out.println("OK");
         } catch (IOException e) {
-            String msg = "Could not copy derby-10.1.1.0.jar file: " + e;
+            String msg = "Could not copy derby.jar file: " + e;
             System.err.println(" " + msg);
             throw new InstallationException(msg, e);
         }
@@ -111,8 +112,9 @@
             File libDir = new File(toDir);
             System.out.println("Copying \"lib/log4j.jar\" to \"" +
                                libDir.getAbsolutePath() + "\"");
+            String log4jJar = getItem("lib", "log4j-", ".jar");
             File destLog4jJar = new File(libDir.getAbsolutePath() +
-                                         File.separator + "log4j-1.2.13.jar");
+                                         File.separator + log4jJar);
             String delete;
             if (destLog4jJar.exists()) {
                 do {
@@ -125,16 +127,16 @@
                        !(delete.trim().length() == 0));
                 if (delete.equalsIgnoreCase("y") || delete.trim().length() == 0) {
                     destLog4jJar.delete();
-                    fileMan.copyFile(new File("lib/log4j-1.2.13.jar"),
+                    fileMan.copyFile(new File("lib" + File.separator + log4jJar),
                                      destLog4jJar);
                 }
             } else {
-                fileMan.copyFile(new File("lib/log4j-1.2.13.jar"),
+                fileMan.copyFile(new File("lib" + File.separator + log4jJar),
                                  destLog4jJar);
             }
             System.out.println("OK");
         } catch (IOException e) {
-            String msg = "Could not copy log4j-1.2.13.jar file: " + e;
+            String msg = "Could not copy log4j.jar file: " + e;
             System.err.println(" " + msg);
             throw new InstallationException(msg, e);
         }

Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/installer/AbstractInstaller.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/installer/AbstractInstaller.java	(original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/installer/AbstractInstaller.java	Sun Jul  1 05:07:01 2007
@@ -54,6 +54,18 @@
         this.wso2wsasHome = wsasHome;
     }
 
+    protected String getItem(String sourceDir, String itemPrefix, String extension) {
+        File libDir = new File(sourceDir);
+        String[] items = libDir.list();
+        for (int i = 0; i < items.length; i++) {
+            String item = items[i];
+            if (item.startsWith(itemPrefix) && item.endsWith(extension)) {
+                return item;
+            }
+        }
+        return sourceDir;
+    }
+
     protected void createWebArchive() throws InstallationException {
         try {
             // Archive the extracted wso2wsas.war

Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/installer/TomcatInstaller.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/installer/TomcatInstaller.java	(original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/installer/TomcatInstaller.java	Sun Jul  1 05:07:01 2007
@@ -134,10 +134,14 @@
                                  new File(serverHome + File.separator + "common" +
                                           File.separator + "classes" + File.separator +
                                           "log4j.properties"));
-                fileMan.copyFile(new File("lib" + File.separator + "wso2utils-SNAPSHOT.jar"),   //TODO: Change the version
+
+                // Copy the wos2utils.jar
+                String wso2utilsJar = getItem("lib", "wso2utils-", ".jar");
+
+                fileMan.copyFile(new File("lib" + File.separator + wso2utilsJar),
                                  new File(serverHome + File.separator + "common" +
                                           File.separator + "lib" + File.separator +
-                                          "wso2utils-SNAPSHOT.jar"));  //TODO: Change the version
+                                          wso2utilsJar));
                 copyDerbyJAR(serverHome + File.separator + "shared" + File.separator + "lib");
             } catch (IOException e) {
                 e.printStackTrace();




More information about the Wsas-java-dev mailing list