added an optional idlPath param to init plus some docs
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 20 Nov 2007 17:07:12 +0000 (17:07 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 20 Nov 2007 17:07:12 +0000 (17:07 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@8097 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/java/org/open_ils/Sys.java

index ad93a92..0d66edc 100644 (file)
@@ -15,6 +15,19 @@ public class Sys {
 
     private static IDLParser idlParser = null;
 
+    /**
+     * Initializes the connection to the OpenSRF network and parses the IDL file.
+     * @param attrs A map of configuration attributes.  Options include:<br/>
+     * <ul>
+     * <li>configFile - The OpenSRF core config file</li>
+     * <li>configContext - The path to the config chunk in the config XML, typically "opensrf"</li>
+     * <li>logProtocol - Currently supported option is "file".</li>
+     * <li>logLevel - The log level.  Options are 1,2,3, or 4 (error, warn, info, debug)</li>
+     * <li>syslogFacility - For future use, when syslog is a supported log option</li>
+     * <li>idlFile - The path to the IDL file.  May be relative or absolute.  If this option is 
+     * not provided, the system will ask the OpenSRF Settings server for the IDL file path.</li>
+     * </ul>
+     */
     public static void init(Map<String, String> attrs) throws ConfigException, SessionException, IOException, IDLException {
 
         String configFile = attrs.get("configFile");
@@ -23,6 +36,7 @@ public class Sys {
         String logFile = attrs.get("logFile");
         String logLevel = attrs.get("logLevel");
         String syslogFacility = attrs.get("syslogFacility");
+        String idlFile = attrs.get("idlFile");
 
 
         if(idlParser != null) {
@@ -42,10 +56,11 @@ public class Sys {
         /** connect to the opensrf network. */
         org.opensrf.Sys.bootstrapClient(configFile, configContext);
 
-        /** Grab the IDL file setting */
-        SettingsClient client = SettingsClient.instance();
-        String idlFile = client.getString("/IDL");
-
+        /** Grab the IDL file setting if not explicitly provided */
+        if(idlFile == null) {
+            SettingsClient client = SettingsClient.instance();
+            idlFile = client.getString("/IDL");
+        }
 
         /** Parse the IDL if necessary */
         idlParser = new IDLParser(idlFile);