From 9f02386426b5bb5d931e92c80060fad06b693dd2 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Sun, 19 Aug 2007 00:07:10 +0000
Subject: [PATCH] Fix for issue 2112.

---
 /dev/null                                                                             |   57 --------
 opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java            |    3 
 opends/resource/Messages.java.stub                                                    |   47 ++++++
 opends/src/messages/messages/quicksetup.properties                                    |    1 
 opends/src/build-tools/org/opends/build/tools/GenerateMessageFile.java                |   35 ++++
 opends/src/quicksetup/org/opends/quicksetup/util/Utils.java                           |    3 
 opends/src/messages/src/org/opends/messages/MessageDescriptor.java                    |  184 ++++++++++++++++----------
 opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java |    6 
 opends/src/quicksetup/org/opends/quicksetup/webstart/WebStartDownloader.java          |   13 +
 opends/src/server/org/opends/server/util/SetupUtils.java                              |   32 ++++
 10 files changed, 236 insertions(+), 145 deletions(-)

diff --git a/opends/resource/Messages.java.stub b/opends/resource/Messages.java.stub
index 4ca5028..95dc265 100644
--- a/opends/resource/Messages.java.stub
+++ b/opends/resource/Messages.java.stub
@@ -41,6 +41,53 @@
   /** Base property for resource bundle containing messages */
   static private final String BASE = "${BASE}";
 
+  static private ClassLoader webstartClassLoader;
+
   ${MESSAGES}
 
+ /**
+  * Returns the Class Loader to be used to get the ResourceBundle,
+  * it returns <CODE>null</CODE> if the default ClassLoader is to be
+  * used.
+  * @return the Class Loader to be used to get the ResourceBundle,
+  * it returns <CODE>null</CODE> if the default ClassLoader is to be
+  * used.
+  */
+  private static ClassLoader getClassLoader()
+  {
+    ClassLoader cl;
+    if (${USE_MESSAGE_JAR_IF_WEBSTART})
+    {
+      if (org.opends.server.util.SetupUtils.isWebStart())
+      {
+        if (webstartClassLoader == null)
+        {
+          try
+          {
+            Class c = Class.forName("${PACKAGE}.${CLASS_NAME}");
+
+            java.net.URL[] urls = new java.net.URL[] {
+                c.getProtectionDomain().getCodeSource().getLocation()
+            };
+            webstartClassLoader = new java.net.URLClassLoader(urls);
+          }
+          catch (ClassNotFoundException cnfe)
+          {
+            // This cannot happen as we are looking for this class so it is
+            // already found.
+          }
+        }
+        cl = webstartClassLoader;
+      }
+      else
+      {
+        cl = null;
+      }
+    }
+    else
+    {
+      cl = null;
+    }
+    return cl;
+  }
 }
diff --git a/opends/src/build-tools/org/opends/build/tools/GenerateMessageFile.java b/opends/src/build-tools/org/opends/build/tools/GenerateMessageFile.java
index d5a889b..24af718 100644
--- a/opends/src/build-tools/org/opends/build/tools/GenerateMessageFile.java
+++ b/opends/src/build-tools/org/opends/build/tools/GenerateMessageFile.java
@@ -77,6 +77,13 @@
    */
   static private final String GLOBAL_ORDINAL = "global.ordinal";
 
+  /**
+   * When true and if the Java Web Start property is set use the class loader of
+   * the jar where the MessageDescriptor is contained to retrieve the
+   * ResourceBundle.
+   */
+  static private final String GLOBAL_USE_MESSAGE_JAR_IF_WEBSTART =
+    "global.use.message.jar.if.webstart";
 
   static private final Set<String> DIRECTIVE_PROPERTIES = new HashSet<String>();
   static {
@@ -84,6 +91,7 @@
     DIRECTIVE_PROPERTIES.add(GLOBAL_CATEGORY_MASK);
     DIRECTIVE_PROPERTIES.add(GLOBAL_SEVERITY);
     DIRECTIVE_PROPERTIES.add(GLOBAL_ORDINAL);
+    DIRECTIVE_PROPERTIES.add(GLOBAL_USE_MESSAGE_JAR_IF_WEBSTART);
   }
 
   static private final String SPECIFIER_REGEX =
@@ -319,7 +327,9 @@
             sb.append(",");
           }
         }
+        sb.append(", ");
       }
+      sb.append("getClassLoader()");
       sb.append(");");
       return sb.toString();
     }
@@ -430,7 +440,7 @@
   @Override
   public void execute() throws BuildException {
     BufferedReader stubReader = null;
-    PrintWriter destWriter = null;    
+    PrintWriter destWriter = null;
     try {
 
       // Decide whether to generate messages based on modification
@@ -459,11 +469,10 @@
       destWriter = new PrintWriter(new FileOutputStream(dest));
 
       String stubLine;
+      Properties properties = new Properties();
+      properties.load(new FileInputStream(source));
       while (null != (stubLine = stubReader.readLine())) {
         if (stubLine.contains("${MESSAGES}")) {
-          Properties properties = new Properties();
-          properties.load(new FileInputStream(source));
-
           Integer globalOrdinal = null;
           String go = properties.getProperty(GLOBAL_ORDINAL);
           if (go != null) {
@@ -510,7 +519,7 @@
             } catch (IllegalArgumentException iae) {
               throw new BuildException(
                       "ERROR: invalid property key " + propKey +
-                      ": " + iae.getMessage() + 
+                      ": " + iae.getMessage() +
                       KEY_FORM_MSG);
             }
           }
@@ -601,6 +610,22 @@
                   dest.getName().substring(0, dest.getName().length() -
                           ".java".length()));
           stubLine = stubLine.replace("${BASE}", getBase());
+
+          String useMessageJarIfWebstart =
+            properties.getProperty(GLOBAL_USE_MESSAGE_JAR_IF_WEBSTART);
+          if ((useMessageJarIfWebstart != null) &&
+              ("true".equalsIgnoreCase(useMessageJarIfWebstart) ||
+              "on".equalsIgnoreCase(useMessageJarIfWebstart) ||
+              "true".equalsIgnoreCase(useMessageJarIfWebstart)))
+          {
+            useMessageJarIfWebstart = "true";
+          }
+          else
+          {
+            useMessageJarIfWebstart = "false";
+          }
+          stubLine = stubLine.replace("${USE_MESSAGE_JAR_IF_WEBSTART}",
+              useMessageJarIfWebstart);
           destWriter.println(stubLine);
         }
       }
diff --git a/opends/src/messages/messages/quicksetup.properties b/opends/src/messages/messages/quicksetup.properties
index 1e92225..8cbf3e4 100644
--- a/opends/src/messages/messages/quicksetup.properties
+++ b/opends/src/messages/messages/quicksetup.properties
@@ -29,6 +29,7 @@
 #
 global.category=QUICKSETUP
 global.ordinal=-1
+global.use.message.jar.if.webstart=true
 
 #
 # Format string definitions
diff --git a/opends/src/messages/src/org/opends/messages/MessageDescriptor.java b/opends/src/messages/src/org/opends/messages/MessageDescriptor.java
index f220aad..214ed13 100644
--- a/opends/src/messages/src/org/opends/messages/MessageDescriptor.java
+++ b/opends/src/messages/src/org/opends/messages/MessageDescriptor.java
@@ -57,7 +57,7 @@
   public static final String DESCRIPTOR_CLASS_BASE_NAME = "Arg";
 
   /**
-   * Subclass for creating messages with no arguements.
+   * Subclass for creating messages with no arguments.
    */
   static public class Arg0 extends MessageDescriptor {
 
@@ -75,10 +75,11 @@
      * @param category of created messages
      * @param severity of created messages
      * @param ordinal of created messages
+     * @param classLoader the class loader to be used to get the ResourceBundle
      */
     public Arg0(String rbBase, String key, Category category,
-              Severity severity, int ordinal) {
-      super(rbBase, key, category, severity, ordinal);
+              Severity severity, int ordinal, ClassLoader classLoader) {
+      super(rbBase, key, category, severity, ordinal, classLoader);
       message = new Message(this);
     }
 
@@ -89,10 +90,11 @@
      * @param mask to apply to the USER_DEFINED category
      * @param severity of created messages
      * @param ordinal of created messages
+     * @param classLoader the class loader to be used to get the ResourceBundle
      */
     public Arg0(String rbBase, String key, int mask,
-              Severity severity, int ordinal) {
-      super(rbBase, key, mask, severity, ordinal);
+              Severity severity, int ordinal, ClassLoader classLoader) {
+      super(rbBase, key, mask, severity, ordinal, classLoader);
       message = new Message(this);
     }
 
@@ -107,7 +109,7 @@
   }
 
   /**
-   * Subclass for creating messages with one arguement.
+   * Subclass for creating messages with one argument.
    */
   static public class Arg1<T1> extends MessageDescriptor {
 
@@ -118,10 +120,11 @@
      * @param category of created messages
      * @param severity of created messages
      * @param ordinal of created messages
+     * @param classLoader the class loader to be used to get the ResourceBundle
      */
     public Arg1(String rbBase, String key, Category category,
-              Severity severity, int ordinal) {
-      super(rbBase, key, category, severity, ordinal);
+              Severity severity, int ordinal, ClassLoader classLoader) {
+      super(rbBase, key, category, severity, ordinal, classLoader);
     }
 
     /**
@@ -131,10 +134,11 @@
      * @param mask to apply to the USER_DEFINED category
      * @param severity of created messages
      * @param ordinal of created messages
+     * @param classLoader the class loader to be used to get the ResourceBundle
      */
     public Arg1(String rbBase, String key, int mask,
-              Severity severity, int ordinal) {
-      super(rbBase, key, mask, severity, ordinal);
+              Severity severity, int ordinal, ClassLoader classLoader) {
+      super(rbBase, key, mask, severity, ordinal, classLoader);
     }
 
     /**
@@ -151,7 +155,7 @@
   }
 
   /**
-   * Subclass for creating messages with two arguements.
+   * Subclass for creating messages with two arguments.
    */
   static public class Arg2<T1, T2> extends MessageDescriptor {
 
@@ -162,10 +166,11 @@
      * @param category of created messages
      * @param severity of created messages
      * @param ordinal of created messages
+     * @param classLoader the class loader to be used to get the ResourceBundle
      */
     public Arg2(String rbBase, String key, Category category,
-              Severity severity, int ordinal) {
-      super(rbBase, key, category, severity, ordinal);
+              Severity severity, int ordinal, ClassLoader classLoader) {
+      super(rbBase, key, category, severity, ordinal, classLoader);
     }
 
     /**
@@ -175,10 +180,11 @@
      * @param mask to apply to the USER_DEFINED category
      * @param severity of created messages
      * @param ordinal of created messages
+     * @param classLoader the class loader to be used to get the ResourceBundle
      */
     public Arg2(String rbBase, String key, int mask,
-              Severity severity, int ordinal) {
-      super(rbBase, key, mask, severity, ordinal);
+              Severity severity, int ordinal, ClassLoader classLoader) {
+      super(rbBase, key, mask, severity, ordinal, classLoader);
     }
 
     /**
@@ -196,7 +202,7 @@
   }
 
   /**
-   * Subclass for creating messages with three arguements.
+   * Subclass for creating messages with three arguments.
    */
   static public class Arg3<T1, T2, T3> extends MessageDescriptor {
 
@@ -207,10 +213,11 @@
      * @param category of created messages
      * @param severity of created messages
      * @param ordinal of created messages
+     * @param classLoader the class loader to be used to get the ResourceBundle
      */
     public Arg3(String rbBase, String key, Category category,
-              Severity severity, int ordinal) {
-      super(rbBase, key, category, severity, ordinal);
+              Severity severity, int ordinal, ClassLoader classLoader) {
+      super(rbBase, key, category, severity, ordinal, classLoader);
     }
 
     /**
@@ -220,10 +227,11 @@
      * @param mask to apply to the USER_DEFINED category
      * @param severity of created messages
      * @param ordinal of created messages
+     * @param classLoader the class loader to be used to get the ResourceBundle
      */
     public Arg3(String rbBase, String key, int mask,
-              Severity severity, int ordinal) {
-      super(rbBase, key, mask, severity, ordinal);
+              Severity severity, int ordinal, ClassLoader classLoader) {
+      super(rbBase, key, mask, severity, ordinal, classLoader);
     }
 
     /**
@@ -242,7 +250,7 @@
   }
 
   /**
-   * Subclass for creating messages with four arguements.
+   * Subclass for creating messages with four arguments.
    */
   static public class Arg4<T1, T2, T3, T4> extends MessageDescriptor {
 
@@ -253,10 +261,11 @@
      * @param category of created messages
      * @param severity of created messages
      * @param ordinal of created messages
+     * @param classLoader the class loader to be used to get the ResourceBundle
      */
     public Arg4(String rbBase, String key, Category category,
-              Severity severity, int ordinal) {
-      super(rbBase, key, category, severity, ordinal);
+              Severity severity, int ordinal, ClassLoader classLoader) {
+      super(rbBase, key, category, severity, ordinal, classLoader);
     }
 
     /**
@@ -266,10 +275,11 @@
      * @param mask to apply to the USER_DEFINED category
      * @param severity of created messages
      * @param ordinal of created messages
+     * @param classLoader the class loader to be used to get the ResourceBundle
      */
     public Arg4(String rbBase, String key, int mask,
-              Severity severity, int ordinal) {
-      super(rbBase, key, mask, severity, ordinal);
+              Severity severity, int ordinal, ClassLoader classLoader) {
+      super(rbBase, key, mask, severity, ordinal, classLoader);
     }
 
     /**
@@ -289,7 +299,7 @@
   }
 
   /**
-   * Subclass for creating messages with five arguements.
+   * Subclass for creating messages with five arguments.
    */
   static public class Arg5<T1, T2, T3, T4, T5> extends MessageDescriptor {
 
@@ -300,10 +310,11 @@
      * @param category of created messages
      * @param severity of created messages
      * @param ordinal of created messages
+     * @param classLoader the class loader to be used to get the ResourceBundle
      */
     public Arg5(String rbBase, String key, Category category,
-              Severity severity, int ordinal) {
-      super(rbBase, key, category, severity, ordinal);
+              Severity severity, int ordinal, ClassLoader classLoader) {
+      super(rbBase, key, category, severity, ordinal, classLoader);
     }
 
     /**
@@ -313,10 +324,11 @@
      * @param mask to apply to the USER_DEFINED category
      * @param severity of created messages
      * @param ordinal of created messages
+     * @param classLoader the class loader to be used to get the ResourceBundle
      */
     public Arg5(String rbBase, String key, int mask,
-              Severity severity, int ordinal) {
-      super(rbBase, key, mask, severity, ordinal);
+              Severity severity, int ordinal, ClassLoader classLoader) {
+      super(rbBase, key, mask, severity, ordinal, classLoader);
     }
 
     /**
@@ -337,7 +349,7 @@
   }
 
   /**
-   * Subclass for creating messages with six arguements.
+   * Subclass for creating messages with six arguments.
    */
   static public class Arg6<T1, T2, T3, T4, T5, T6> extends MessageDescriptor {
 
@@ -348,10 +360,11 @@
      * @param category of created messages
      * @param severity of created messages
      * @param ordinal of created messages
+     * @param classLoader the class loader to be used to get the ResourceBundle
      */
     public Arg6(String rbBase, String key, Category category,
-              Severity severity, int ordinal) {
-      super(rbBase, key, category, severity, ordinal);
+              Severity severity, int ordinal, ClassLoader classLoader) {
+      super(rbBase, key, category, severity, ordinal, classLoader);
     }
 
     /**
@@ -361,10 +374,11 @@
      * @param mask to apply to the USER_DEFINED category
      * @param severity of created messages
      * @param ordinal of created messages
+     * @param classLoader the class loader to be used to get the ResourceBundle
      */
     public Arg6(String rbBase, String key, int mask,
-              Severity severity, int ordinal) {
-      super(rbBase, key, mask, severity, ordinal);
+              Severity severity, int ordinal, ClassLoader classLoader) {
+      super(rbBase, key, mask, severity, ordinal, classLoader);
     }
 
     /**
@@ -386,7 +400,7 @@
   }
 
   /**
-   * Subclass for creating messages with seven arguements.
+   * Subclass for creating messages with seven arguments.
    */
   static public class Arg7<T1, T2, T3, T4, T5, T6, T7>
           extends MessageDescriptor
@@ -399,10 +413,11 @@
      * @param category of created messages
      * @param severity of created messages
      * @param ordinal of created messages
+     * @param classLoader the class loader to be used to get the ResourceBundle
      */
     public Arg7(String rbBase, String key, Category category,
-              Severity severity, int ordinal) {
-      super(rbBase, key, category, severity, ordinal);
+              Severity severity, int ordinal, ClassLoader classLoader) {
+      super(rbBase, key, category, severity, ordinal, classLoader);
     }
 
     /**
@@ -412,10 +427,11 @@
      * @param mask to apply to the USER_DEFINED category
      * @param severity of created messages
      * @param ordinal of created messages
+     * @param classLoader the class loader to be used to get the ResourceBundle
      */
     public Arg7(String rbBase, String key, int mask,
-              Severity severity, int ordinal) {
-      super(rbBase, key, mask, severity, ordinal);
+              Severity severity, int ordinal, ClassLoader classLoader) {
+      super(rbBase, key, mask, severity, ordinal, classLoader);
     }
 
     /**
@@ -438,7 +454,7 @@
   }
 
   /**
-   * Subclass for creating messages with eight arguements.
+   * Subclass for creating messages with eight arguments.
    */
   static public class Arg8<T1, T2, T3, T4, T5, T6, T7, T8>
           extends MessageDescriptor
@@ -451,10 +467,11 @@
      * @param category of created messages
      * @param severity of created messages
      * @param ordinal of created messages
+     * @param classLoader the class loader to be used to get the ResourceBundle
      */
     public Arg8(String rbBase, String key, Category category,
-              Severity severity, int ordinal) {
-      super(rbBase, key, category, severity, ordinal);
+              Severity severity, int ordinal, ClassLoader classLoader) {
+      super(rbBase, key, category, severity, ordinal, classLoader);
     }
 
     /**
@@ -464,10 +481,11 @@
      * @param mask to apply to the USER_DEFINED category
      * @param severity of created messages
      * @param ordinal of created messages
+     * @param classLoader the class loader to be used to get the ResourceBundle
      */
     public Arg8(String rbBase, String key, int mask,
-              Severity severity, int ordinal) {
-      super(rbBase, key, mask, severity, ordinal);
+              Severity severity, int ordinal, ClassLoader classLoader) {
+      super(rbBase, key, mask, severity, ordinal, classLoader);
     }
 
     /**
@@ -492,7 +510,7 @@
   }
 
   /**
-   * Subclass for creating messages with nine arguements.
+   * Subclass for creating messages with nine arguments.
    */
   static public class Arg9<T1, T2, T3, T4, T5, T6, T7, T8, T9>
           extends MessageDescriptor {
@@ -504,10 +522,11 @@
      * @param category of created messages
      * @param severity of created messages
      * @param ordinal of created messages
+     * @param classLoader the class loader to be used to get the ResourceBundle
      */
     public Arg9(String rbBase, String key, Category category,
-              Severity severity, int ordinal) {
-      super(rbBase, key, category, severity, ordinal);
+              Severity severity, int ordinal, ClassLoader classLoader) {
+      super(rbBase, key, category, severity, ordinal, classLoader);
     }
 
     /**
@@ -517,10 +536,11 @@
      * @param mask to apply to the USER_DEFINED category
      * @param severity of created messages
      * @param ordinal of created messages
+     * @param classLoader the class loader to be used to get the ResourceBundle
      */
     public Arg9(String rbBase, String key, int mask,
-              Severity severity, int ordinal) {
-      super(rbBase, key, mask, severity, ordinal);
+              Severity severity, int ordinal, ClassLoader classLoader) {
+      super(rbBase, key, mask, severity, ordinal, classLoader);
     }
 
     /**
@@ -558,10 +578,11 @@
      * @param category of created messages
      * @param severity of created messages
      * @param ordinal of created messages
+     * @param classLoader the class loader to be used to get the ResourceBundle
      */
     public Arg10(String rbBase, String key, Category category,
-               Severity severity, int ordinal) {
-      super(rbBase, key, category, severity, ordinal);
+               Severity severity, int ordinal, ClassLoader classLoader) {
+      super(rbBase, key, category, severity, ordinal, classLoader);
     }
 
     /**
@@ -571,10 +592,11 @@
      * @param mask to apply to the USER_DEFINED category
      * @param severity of created messages
      * @param ordinal of created messages
+     * @param classLoader the class loader to be used to get the ResourceBundle
      */
     public Arg10(String rbBase, String key, int mask,
-              Severity severity, int ordinal) {
-      super(rbBase, key, mask, severity, ordinal);
+              Severity severity, int ordinal, ClassLoader classLoader) {
+      super(rbBase, key, mask, severity, ordinal, classLoader);
     }
 
     /**
@@ -601,7 +623,7 @@
   }
 
   /**
-   * Subclass for creating messages with eleven arguements.
+   * Subclass for creating messages with eleven arguments.
    */
   static public class Arg11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>
           extends MessageDescriptor
@@ -614,10 +636,11 @@
      * @param category of created messages
      * @param severity of created messages
      * @param ordinal of created messages
+     * @param classLoader the class loader to be used to get the ResourceBundle
      */
     public Arg11(String rbBase, String key, Category category,
-               Severity severity, int ordinal) {
-      super(rbBase, key, category, severity, ordinal);
+               Severity severity, int ordinal, ClassLoader classLoader) {
+      super(rbBase, key, category, severity, ordinal, classLoader);
     }
 
     /**
@@ -627,10 +650,11 @@
      * @param mask to apply to the USER_DEFINED category
      * @param severity of created messages
      * @param ordinal of created messages
+     * @param classLoader the class loader to be used to get the ResourceBundle
      */
     public Arg11(String rbBase, String key, int mask,
-              Severity severity, int ordinal) {
-      super(rbBase, key, mask, severity, ordinal);
+              Severity severity, int ordinal, ClassLoader classLoader) {
+      super(rbBase, key, mask, severity, ordinal, classLoader);
     }
 
     /**
@@ -658,7 +682,7 @@
   }
 
   /**
-   * Subclass for creating messages with an any number of arguements.
+   * Subclass for creating messages with an any number of arguments.
    * In general this class should be used when a message needs to be
    * defined with more arguments that can be handled with the current
    * number of subclasses
@@ -672,10 +696,11 @@
      * @param category of created messages
      * @param severity of created messages
      * @param ordinal of created messages
+     * @param classLoader the class loader to be used to get the ResourceBundle
      */
     public ArgN(String rbBase, String key, Category category,
-               Severity severity, int ordinal) {
-      super(rbBase, key, category, severity, ordinal);
+               Severity severity, int ordinal, ClassLoader classLoader) {
+      super(rbBase, key, category, severity, ordinal, classLoader);
     }
 
     /**
@@ -685,10 +710,11 @@
      * @param mask to apply to the USER_DEFINED category
      * @param severity of created messages
      * @param ordinal of created messages
+     * @param classLoader the class loader to be used to get the ResourceBundle
      */
     public ArgN(String rbBase, String key, int mask,
-              Severity severity, int ordinal) {
-      super(rbBase, key, mask, severity, ordinal);
+              Severity severity, int ordinal, ClassLoader classLoader) {
+      super(rbBase, key, mask, severity, ordinal, classLoader);
     }
 
     /**
@@ -730,7 +756,7 @@
      */
     Raw(CharSequence formatString, Category category,
                                 Severity severity) {
-      super(null, null, category, severity, null);
+      super(null, null, category, severity, null, null);
       this.formatString = formatString != null ? formatString.toString() : "";
     }
 
@@ -742,7 +768,7 @@
      * @param severity for created messages
      */
     Raw(CharSequence formatString, int mask, Severity severity) {
-      super(null, null, mask, severity, null);
+      super(null, null, mask, severity, null, null);
       this.formatString = formatString != null ? formatString.toString() : "";
     }
 
@@ -801,6 +827,12 @@
   protected Integer ordinal;
 
   /**
+   * The class loader to be used to retrieve the ResourceBundle.  If null
+   * the default class loader will be used.
+   */
+  protected ClassLoader classLoader;
+
+  /**
    * Obtains the category of this descriptor.  Gauranteed not to be null.
    * @return Category of this message
    */
@@ -894,7 +926,14 @@
 
   private ResourceBundle getBundle(Locale locale) {
     if (locale == null) locale = Locale.getDefault();
-    return ResourceBundle.getBundle(this.rbBase, locale);
+    if (classLoader == null)
+    {
+      return ResourceBundle.getBundle(this.rbBase, locale);
+    }
+    else
+    {
+      return ResourceBundle.getBundle(this.rbBase, locale, classLoader);
+    }
   }
 
   /**
@@ -904,9 +943,11 @@
    * @param category of any created message
    * @param severity of any created message
    * @param ordinal of any created message
+   * @param classLoader the class loader to be used to get the ResourceBundle
    */
   private MessageDescriptor(String rbBase, String key, Category category,
-                     Severity severity, Integer ordinal) {
+                     Severity severity, Integer ordinal,
+                     ClassLoader classLoader) {
     if (category == null) {
       throw new NullPointerException("Null Category value for message " +
               "descriptor with key " + key);
@@ -920,6 +961,7 @@
     this.category = category;
     this.severity = severity;
     this.ordinal = ordinal;
+    this.classLoader = classLoader;
   }
 
   /**
@@ -931,10 +973,12 @@
    * @param mask custom mask
    * @param severity of any created message
    * @param ordinal of any created message
+   * @param classLoader the class loader to be used to get the ResourceBundle
    */
   private MessageDescriptor(String rbBase, String key, int mask,
-                     Severity severity, Integer ordinal) {
-    this(rbBase, key, Category.USER_DEFINED, severity, ordinal);
+                     Severity severity, Integer ordinal,
+                     ClassLoader classLoader) {
+    this(rbBase, key, Category.USER_DEFINED, severity, ordinal, classLoader);
     this.mask = mask;
   }
 
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java b/opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java
index f926735..6464814 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java
@@ -41,7 +41,6 @@
 
 import org.opends.quicksetup.ApplicationException;
 import org.opends.quicksetup.ApplicationReturnCode;
-import org.opends.quicksetup.webstart.JnlpProperties;
 import static org.opends.quicksetup.util.Utils.*;
 import org.opends.server.admin.DefaultBehaviorException;
 import org.opends.server.admin.ManagedObjectNotFoundException;
@@ -78,7 +77,7 @@
  * classes the required jar files are already loaded. However these jar files
  * are not necessarily loaded when we create this class.
  */
-public class InstallerHelper implements JnlpProperties {
+public class InstallerHelper {
   private static final Logger LOG = Logger.getLogger(
       InstallerHelper.class.getName());
 
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java b/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
index df6873a..d7cdc61 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
@@ -40,13 +40,13 @@
 import org.opends.quicksetup.ApplicationReturnCode;
 import org.opends.quicksetup.ProgressStep;
 import org.opends.quicksetup.Installation;
-import org.opends.quicksetup.webstart.JnlpProperties;
 import org.opends.quicksetup.installer.Installer;
 import org.opends.quicksetup.installer.InstallProgressStep;
 import org.opends.quicksetup.util.Utils;
 import org.opends.quicksetup.util.ZipExtractor;
 import org.opends.quicksetup.util.ServerController;
 import org.opends.quicksetup.util.FileManager;
+import org.opends.server.util.SetupUtils;
 
 import org.opends.messages.Message;
 import static org.opends.messages.QuickSetupMessages.*;
@@ -77,7 +77,7 @@
  * This class is supposed to be fully independent of the graphical layout.
  *
  */
-public class WebStartInstaller extends Installer implements JnlpProperties {
+public class WebStartInstaller extends Installer {
   private HashMap<InstallProgressStep, Integer> hmRatio =
       new HashMap<InstallProgressStep, Integer>();
 
@@ -518,7 +518,7 @@
   private String getZipFileName()
   {
     // Passed as a java option in the JNLP file
-    return System.getProperty(ZIP_FILE_NAME);
+    return System.getProperty(SetupUtils.ZIP_FILE_NAME);
   }
 
   /**
diff --git a/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java b/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
index e8c5fe4..36463ee 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
@@ -51,7 +51,6 @@
 import org.opends.admin.ads.TopologyCacheException;
 import org.opends.admin.ads.util.ConnectionUtils;
 import org.opends.quicksetup.*;
-import org.opends.quicksetup.webstart.JnlpProperties;
 
 import org.opends.server.util.SetupUtils;
 import org.opends.messages.MessageBuilder;
@@ -802,7 +801,7 @@
    */
   public static boolean isWebStart()
   {
-    return "true".equals(System.getProperty(JnlpProperties.IS_WEBSTART));
+    return SetupUtils.isWebStart();
   }
 
   /**
diff --git a/opends/src/quicksetup/org/opends/quicksetup/webstart/JnlpProperties.java b/opends/src/quicksetup/org/opends/quicksetup/webstart/JnlpProperties.java
deleted file mode 100644
index 89a79e6..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/webstart/JnlpProperties.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
- */
-
-package org.opends.quicksetup.webstart;
-
-/**
- * The following properties are set in the QuickSetup.jnlp file to provide
- * informations.
- *
- */
-public interface JnlpProperties
-{
-  /**
-   * Java property used to known if we are using web start or not.
-   */
-  public static final String IS_WEBSTART = "org.opends.quicksetup.iswebstart";
-
-  /**
-   * Java property used to know which are the jar files that must be downloaded
-   * lazily.  The current code in WebStartDownloader that uses this property
-   * assumes that the URL are separated with an space.
-   */
-  public static final String LAZY_JAR_URLS =
-      "org.opends.quicksetup.lazyjarurls";
-
-  /**
-   * Java property used to know which is the name of the zip file that must
-   * be unzipped and whose contents must be extracted during the Web Start
-   * based setup.
-   */
-  public static final String ZIP_FILE_NAME =
-      "org.opends.quicksetup.zipfilename";
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/webstart/WebStartDownloader.java b/opends/src/quicksetup/org/opends/quicksetup/webstart/WebStartDownloader.java
index 0e2f1c3..e5ca041 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/webstart/WebStartDownloader.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/webstart/WebStartDownloader.java
@@ -40,6 +40,8 @@
 
 import org.opends.quicksetup.ApplicationException;
 import org.opends.quicksetup.ApplicationReturnCode;
+import org.opends.server.util.SetupUtils;
+
 import static org.opends.quicksetup.util.Utils.*;
 import static org.opends.messages.QuickSetupMessages.*;
 
@@ -53,8 +55,7 @@
  * not finished the WebStartInstaller will be on the
  * ProgressStep.DOWNLOADING step.
  */
-public class WebStartDownloader implements DownloadServiceListener,
-        JnlpProperties {
+public class WebStartDownloader implements DownloadServiceListener {
 
 
 
@@ -65,7 +66,7 @@
   static public String getZipFileName()
   {
     // Passed as a java option in the JNLP file
-    return System.getProperty(ZIP_FILE_NAME);
+    return System.getProperty(SetupUtils.ZIP_FILE_NAME);
   }
 
   private ApplicationException ex;
@@ -237,8 +238,8 @@
    * <CODE>true</CODE> the files will be re-downloaded even if they already
    * are on cache.
    * @param forceDownload used to ignore the case and force download.
-   * @throws MalformedURLException if there is an error with the URL that we
-   * get from the JnlpProperties.
+   * @throws MalformedURLException if there is an error with the URLs that we
+   * get from the property SetupUtils.LAZY_JAR_URLS
    * @throws IOException if a network problem occurs.
    */
   private void startDownload(boolean forceDownload)
@@ -415,7 +416,7 @@
    */
   private String[] getJarUrls()
   {
-    String jars = System.getProperty(LAZY_JAR_URLS);
+    String jars = System.getProperty(SetupUtils.LAZY_JAR_URLS);
     return jars.split(" ");
   }
 
diff --git a/opends/src/server/org/opends/server/util/SetupUtils.java b/opends/src/server/org/opends/server/util/SetupUtils.java
index b8c65a3..1bbe5ac 100644
--- a/opends/src/server/org/opends/server/util/SetupUtils.java
+++ b/opends/src/server/org/opends/server/util/SetupUtils.java
@@ -52,6 +52,27 @@
 public class SetupUtils
 {
   /**
+   * Java property used to known if we are using web start or not.
+   */
+  public static final String IS_WEBSTART = "org.opends.quicksetup.iswebstart";
+
+  /**
+   * Java property used to know which are the jar files that must be downloaded
+   * lazily.  The current code in WebStartDownloader that uses this property
+   * assumes that the URL are separated with an space.
+   */
+  public static final String LAZY_JAR_URLS =
+      "org.opends.quicksetup.lazyjarurls";
+
+  /**
+   * Java property used to know which is the name of the zip file that must
+   * be unzipped and whose contents must be extracted during the Web Start
+   * based setup.
+   */
+  public static final String ZIP_FILE_NAME =
+      "org.opends.quicksetup.zipfilename";
+
+  /**
    * Creates a MakeLDIF template file using the provided information.
    *
    * @param  baseDN      The base DN for the data in the template file.
@@ -373,5 +394,16 @@
   {
     return 1689;
   }
+
+  /**
+   * Indicates whether we are in a web start installation or not.
+   *
+   * @return <CODE>true</CODE> if we are in a web start installation and
+   *         <CODE>false</CODE> if not.
+   */
+  public static boolean isWebStart()
+  {
+    return "true".equals(System.getProperty(IS_WEBSTART));
+  }
 }
 

--
Gitblit v1.10.0