[Schmitzm-commits] r1274 - in trunk: src/schmitzm/lang src/schmitzm/lang/resource/locales src_junit/schmitzm/lang

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Nov 15 18:56:49 CET 2010


Author: mojays
Date: 2010-11-15 18:56:48 +0100 (Mon, 15 Nov 2010)
New Revision: 1274

Added:
   trunk/src_junit/schmitzm/lang/ResourceProviderOperator.cfg
Modified:
   trunk/src/schmitzm/lang/ResourceProviderOperator.java
   trunk/src/schmitzm/lang/resource/locales/LangResourceBundle.properties
Log:
ResourceProviderOperator with CLI options

Modified: trunk/src/schmitzm/lang/ResourceProviderOperator.java
===================================================================
--- trunk/src/schmitzm/lang/ResourceProviderOperator.java	2010-11-15 16:22:47 UTC (rev 1273)
+++ trunk/src/schmitzm/lang/ResourceProviderOperator.java	2010-11-15 17:56:48 UTC (rev 1274)
@@ -43,6 +43,15 @@
 import java.util.Properties;
 import java.util.Set;
 
+import org.apache.commons.cli.BasicParser;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.GnuParser;
+import org.apache.commons.cli.HelpFormatter;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.Parser;
+import org.apache.commons.cli.PosixParser;
+import org.apache.commons.cli.UnrecognizedOptionException;
 import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
 
@@ -58,21 +67,104 @@
  * @author <a href="mailto:martin.schmitz at koeln.de">Martin Schmitz</a>
  *
  */
-public class ResourceProviderOperator  {
-  private static final String CFG_KEY_RESOURCE_BUNDLES_SEP = ";";
+public class ResourceProviderOperator {
+  private static enum Operation {
+    /** Operation: remove marked keys from bundle files. */ 
+    REMOVE_KEYS
+  }
+  
+  private static final Parser  cliParser  = new PosixParser();
+  private static Options cliOptions = null; 
+  private static CommandLine cliOptionValues = null; 
+  
+  private static final char RESOURCE_BUNDLES_SEP = ';';
+  
+  // constants for config file interpretation
+  private static final String CFG_KEY_OPERATION = "operation";
   private static final String CFG_KEY_RESOURCE_BUNDLES = "resource.bundles";
   private static final String CFG_KEY_RESOURCE_BUNDLES_ROOT_FOLDER = "resource.bundles.src.root.folder";
-  private static final String CFG_KEY_REMOVE_KEYS_INDICATOR_PREFIX = "remove.keys.indicator.prefix";
+  private static final String CFG_KEY_BUNDLE_KEYS_INDICATOR_PREFIX = "bundle.keys.indicator.prefix";
 
+  /** Command line option key (-h) to show the command line help messages.
+   *  Alias for "--help". */
+  protected static final String CLI_KEY_HELP = "h";
+  /** Command line option key (--help) to show the command line help messages.
+   *  Alias for "-h". */
+  protected static final String CLI_LONGKEY_HELP = "help";
   
+  /** Command line option key (-o) to specify the operation.
+   *  Alias for "--operation". */
+  protected static final String CLI_KEY_OPERATION = "o";
+  /** Command line option key (--operation) to specify the operation.
+   *  Alias for "-o". */
+  protected static final String CLI_LONGKEY_OPERATION = "operation";
+  /** Default for the command line option -o (--operation): "REMOVE". */
+  protected static final String CLI_DEFAULT_OPERATION = Operation.REMOVE_KEYS.toString();
+
+  /** Command line option key (-b) to specify the bundles.
+   *  Alias for "--bundles". */
+  protected static final String CLI_KEY_RESOURCE_BUNDLES = "b";
+  /** Command line option key (--bundles) to specify the bundles.
+   *  Alias for "-b". */
+  protected static final String CLI_LONGKEY_RESOURCE_BUNDLES = "bundles";
+
+  /** Command line option key (-s) to specify the root folder the bundles
+   *  source files are stored relatively to.
+   *  Alias for "--src-root". */
+  protected static final String CLI_KEY_RESOURCE_BUNDLES_ROOT_FOLDER = "s";
+  /** Command line option key (-s) to specify the root folder the bundles
+   *  source files are stored relatively to. Alias for "-s".*/
+  protected static final String CLI_LONGKEY_RESOURCE_BUNDLES_ROOT_FOLDER = "src-root";
+  /** Default for the command line option -s (--src-root): "src/main/resources" (as it is the maven default) */
+  protected static final String CLI_DEFAULT_RESOURCE_BUNDLES_ROOT_FOLDER = "src/main/resources";
+
+  /** Command line option key (-i) to specify the indicator prefix the bundle
+   *  keys, which should be processed, are marked with.
+   *  Alias for "-indicator". */
+  protected static final String CLI_KEY_BUNDLE_KEYS_INDICATOR_PREFIX = "i";
+  /** Command line option key (--key-indicator) to specify the indicator prefix the bundle
+   *  keys, which should be processed, are marked with.
+   *  Alias for "-i". */
+  protected static final String CLI_LONGKEY_BUNDLE_KEYS_INDICATOR_PREFIX = "key-indicator";
+  /** Default for the command line option -i (--key-indicator): "REMOVEME_" (because REMOVE is the default operation) */
+  protected static final String CLI_DEFAULT_BUNDLE_KEYS_INDICATOR_PREFIX = "REMOVEME_";
+ 
+  /** Command line option key (-cff) to specify a property file the {@link ResourceProviderOperator}
+   *  configuration is read from. Additional command line parameters have higher
+   *  priority and overload the file configuration!
+   *  Alias for "--config-from-file". */
+  protected static final String CLI_KEY_FILE_CONFIG_IN = "cff";
+  /** Command line option key (--configfromfile) to specify a property file the {@link ResourceProviderOperator}
+   *  configuration is read from. Additional command line parameters have higher
+   *  priority and overload the file configuration!
+   *  Alias for "-cff". */
+  protected static final String CLI_LONGKEY_FILE_CONFIG_IN = "config-from-file";
+  /** Default for the command line option -cff (--config-from-file): "ResourceProviderOperator.cfg" */
+  protected static final String CLI_DEFAULT_FILE_CONFIG_IN = "ResourceProviderOperator.cfg";
+
+  /** Command line option key (-ctf) to specify a file the {@link ResourceProviderOperator}
+   *  configuration (specified by config file or command line parameters) is
+   *  stored in. Alias for "--config-to-file". */
+  protected static final String CLI_KEY_FILE_CONFIG_OUT = "ctf";
+  /** Command line option key (--config-to-file) to specify a file the {@link ResourceProviderOperator}
+   *  configuration (specified by config file or command line parameters) is
+   *  stored in. Alias for "-ctf". */
+  protected static final String CLI_LONGKEY_FILE_CONFIG_OUT = "config-to-file";
+  /** Default for the command line option -ctf (--config-to-file): "ResourceProviderOperator.cfg" */
+  protected static final String CLI_DEFAULT_FILE_CONFIG_OUT = "ResourceProviderOperator.cfg";
+
   
+  
+  
   protected static final Logger LOGGER = LangUtil.createLogger(ResourceProviderOperator.class);
-
+  /** Holds the resource bundles to process. */
   protected ResourceProvider[] resourceBundles = new ResourceProvider[0];
-  protected String   removeIndicatorPrefix = "REMOVEME_";
-  protected File     resourceBundlesRootFolder = null;
+  /** Holds the prefix, which indicates the bundles keys to process. */
+  protected String keyIndicatorPrefix = "REMOVEME_";
+  /** Root folder where the bundle source files can be found relatively to.*/
+  protected File resourceBundlesRootFolder = null;
   
-  
+
   /**
    * Sets the resource bundles to perform the operations on.
    */
@@ -108,21 +200,21 @@
   }
 
   /**
-   * Sets the prefix string the keys, which should be removed, are marked
+   * Sets the prefix string the keys, which should be processed, are marked
    * with.
    */
-  public void setRemoveIndicatorPrefix(String removeIndicatorPrefix) {
-    this.removeIndicatorPrefix = removeIndicatorPrefix;
+  public void setKeyIndicatorPrefix(String keyIndicatorPrefix) {
+    this.keyIndicatorPrefix = keyIndicatorPrefix;
   }
   
   /**
-   * Returns the prefix string the keys, which should be removed, are marked
+   * Returns the prefix string the keys, which should be processed, are marked
    * with.
    */
-  public String getRemoveIndicatorPrefix() {
-    if ( removeIndicatorPrefix == null )
+  public String getKeyIndicatorPrefix() {
+    if ( keyIndicatorPrefix == null )
       return "";
-    return this.removeIndicatorPrefix;
+    return this.keyIndicatorPrefix;
   }
 
   /**
@@ -160,25 +252,29 @@
    * @param rp resource provider to process
    */
   protected void processRemoveUnusedKeys(ResourceProvider rp) throws Exception {
-    // First: Determine all keys which must be removed, either with
-    //        or without the prefix
-    String removeIndicator = getRemoveIndicatorPrefix();
-    Set<String> keysToRemove = new HashSet<String>();
-    for ( String key : rp.getKeys() )
-      if ( key.startsWith( removeIndicator ) ) {
-        // The keys which are marked explicitly with the
-        // indicator must be removed as well as the
-        // "originals" (in the sub-bundles)
-        // --> so add both to ''eysToRemove
-        keysToRemove.add( key );
-        keysToRemove.add( eliminateRemoveIndicator(key) );
-      }
-
-    // Remove keys from the root bundle
-    processRemoveUnusedKeys(rp,null,keysToRemove);
-    // Remove keys from the language sub-bundles
-    for (Locale locale : rp.getAvailableLocales(false))
-      processRemoveUnusedKeys(rp,locale,keysToRemove);
+    try {
+      // First: Determine all keys which must be removed, either with
+      //        or without the prefix
+      String removeIndicator = getKeyIndicatorPrefix();
+      Set<String> keysToRemove = new HashSet<String>();
+      for ( String key : rp.getKeys() )
+        if ( key.startsWith( removeIndicator ) ) {
+          // The keys which are marked explicitly with the
+          // indicator must be removed as well as the
+          // "originals" (in the sub-bundles)
+          // --> so add both to ''eysToRemove
+          keysToRemove.add( key );
+          keysToRemove.add( eliminateKeyIndicatorPrefix(key) );
+        }
+  
+      // Remove keys from the root bundle
+      processRemoveUnusedKeys(rp,null,keysToRemove);
+      // Remove keys from the language sub-bundles
+      for (Locale locale : rp.getAvailableLocales(false))
+        processRemoveUnusedKeys(rp,locale,keysToRemove);
+    } catch (MissingResourceException err) {
+      LOGGER.error(err.getMessage());
+    }
   }
   
   /**
@@ -223,46 +319,49 @@
       // add key/value to removing or remaining pairs
       if ( keysToRemove.contains(key) )
         // ignore the prefix of the removing key
-        removedKeys.put( eliminateRemoveIndicator(key), value);
+        removedKeys.put( eliminateKeyIndicatorPrefix(key), value);
       else
         remainingKeys.put(key, value);
     }
 
-    // store remaining pairs
+    // Determine original bundle source file
     File bundleFile = ResourceProvider.getPropertyFile(rp, locale, getResourceBundlesRootFolder());
-    String comments = getInitialCommentLines(bundleFile, "#", true);
-//    Writer remainingKeysOutput = IOUtil.createUTF8FileWriter(bundleFile,false);
-    Writer remainingKeysOutput = IOUtil.createUTF8FileWriter( IOUtil.changeFileExt(bundleFile, "remainingKeys"), false );
-    remainingKeysOutput.write(comments); // write comments as their were
-    if ( !"".equals(comments) )
-      remainingKeysOutput.write("\n");
-    remainingKeys.store(
-        remainingKeysOutput,
-        "Revised by "+LangUtil.getSimpleClassName(this)+" (Unused keys removed)");
-    remainingKeysOutput.flush();
-    remainingKeysOutput.close();
-      
-    // store removed pairs
-    File removedKeysFile = IOUtil.changeFileExt(bundleFile, "removedKeys");
-    Writer removedKeysOutput = IOUtil.createUTF8FileWriter(removedKeysFile,true);
-    removedKeys.store(
-        removedKeysOutput,
-        "======================================================\n" +
-        "Removed Keys: "+rp.getDefaultBundleName()
-    );
-    removedKeysOutput.flush();
-    removedKeysOutput.close();
-    
+    // only rewrite files, when keys are removed
+    if ( removedKeys.size() > 0 ) {
+      // store remaining pairs
+      String comments = getInitialCommentLines(bundleFile, "#", true);
+//      Writer remainingKeysOutput = IOUtil.createUTF8FileWriter(bundleFile,false);
+      Writer remainingKeysOutput = IOUtil.createUTF8FileWriter( IOUtil.changeFileExt(bundleFile, "remainingKeys"), false );
+      remainingKeysOutput.write(comments); // write comments as their were
+      if ( !"".equals(comments) )
+        remainingKeysOutput.write("\n");
+      remainingKeys.store(
+          remainingKeysOutput,
+          "Revised by "+LangUtil.getSimpleClassName(this)+" (Unused keys removed)");
+      remainingKeysOutput.flush();
+      remainingKeysOutput.close();
+        
+      // store removed pairs
+      File removedKeysFile = IOUtil.changeFileExt(bundleFile, "removedKeys");
+      Writer removedKeysOutput = IOUtil.createUTF8FileWriter(removedKeysFile,true);
+      removedKeys.store(
+          removedKeysOutput,
+          "======================================================\n" +
+          "Removed Keys: "+rp.getDefaultBundleName()
+      );
+      removedKeysOutput.flush();
+      removedKeysOutput.close();
+    }    
     LOGGER.info("Removed "+removedKeys.size()+" keys from bundle '"+rp.getDefaultBundleName()+"' ("+locale+") --> "+bundleFile.getAbsolutePath());
   }
 
 
   /**
-   * Returns the key without the remove indicator prefix, if the key
+   * Returns the key without the indicator prefix, if the key
    * starts with it. Otherwise the given key is returned unchanged.
    */
-  private String eliminateRemoveIndicator(String key) {
-    String removeIndicator = getRemoveIndicatorPrefix();
+  private String eliminateKeyIndicatorPrefix(String key) {
+    String removeIndicator = getKeyIndicatorPrefix();
     if ( key.startsWith( removeIndicator ) )
       return key.substring( removeIndicator.length() );
     return key;
@@ -284,32 +383,131 @@
   }
   
   /**
+   * Initializes the command line options in {@link #cliOptions}.
+   */
+  protected static void initCliOptions() {
+    cliOptions = new Options();
+    cliOptions.addOption( new Option(
+        CLI_KEY_HELP,
+        CLI_LONGKEY_HELP,
+        false,
+        LangUtil.RESOURCE.getString("ResourceProviderOperator.cli.info.help")
+    ));
+    Option operationOption = new Option(
+        CLI_KEY_OPERATION,
+        CLI_LONGKEY_OPERATION,
+        true,
+        LangUtil.RESOURCE.getString(
+            "ResourceProviderOperator.cli.info.operation",
+            LangUtil.stringConcatWithSep(" | ", Operation.values()),
+            CLI_DEFAULT_OPERATION
+        )
+    );
+    operationOption.setValueSeparator(RESOURCE_BUNDLES_SEP);
+    cliOptions.addOption( operationOption );
+    cliOptions.addOption( new Option(
+        CLI_KEY_RESOURCE_BUNDLES,
+        CLI_LONGKEY_RESOURCE_BUNDLES,
+        true,
+        LangUtil.RESOURCE.getString("ResourceProviderOperator.cli.info.bundles")
+    ));
+    cliOptions.addOption( new Option(
+        CLI_KEY_RESOURCE_BUNDLES_ROOT_FOLDER,
+        CLI_LONGKEY_RESOURCE_BUNDLES_ROOT_FOLDER,
+        true,
+        LangUtil.RESOURCE.getString(
+            "ResourceProviderOperator.cli.info.rootfolder",
+            CLI_DEFAULT_RESOURCE_BUNDLES_ROOT_FOLDER
+        )
+    ));
+    cliOptions.addOption( new Option(
+        CLI_KEY_BUNDLE_KEYS_INDICATOR_PREFIX,
+        CLI_LONGKEY_BUNDLE_KEYS_INDICATOR_PREFIX,
+        true,
+        LangUtil.RESOURCE.getString(
+            "ResourceProviderOperator.cli.info.indicator",
+            CLI_DEFAULT_BUNDLE_KEYS_INDICATOR_PREFIX
+        )
+    ));
+    cliOptions.addOption( new Option(
+        CLI_KEY_FILE_CONFIG_IN,
+        CLI_LONGKEY_FILE_CONFIG_IN,
+        true,
+        LangUtil.RESOURCE.getString(
+            "ResourceProviderOperator.cli.info.filein",
+            CLI_DEFAULT_FILE_CONFIG_IN
+        )
+    ));
+    cliOptions.addOption( new Option(
+        CLI_KEY_FILE_CONFIG_OUT,
+        CLI_LONGKEY_FILE_CONFIG_OUT,
+        true,
+        LangUtil.RESOURCE.getString(
+            "ResourceProviderOperator.cli.info.fileout",
+            CLI_DEFAULT_FILE_CONFIG_OUT
+        )
+    ));
+  }
+  
+  /**
+   * Prints the command line help to console.
+   */
+  public static void printCliHelp() {
+    HelpFormatter formatter = new HelpFormatter();
+    formatter.printHelp(ResourceProviderOperator.class.getName(), cliOptions);
+  }
+  
+  /**
    * Starts an operation on resource bundle files.
    * @param args command line arguments
    */
   public static void main(String[] args) throws Exception {
     LangUtil.initializeDefaultLogger(Level.DEBUG,null);
-
-    // TODO: implement complex command line arguments (via CLI)
-    //       currently only a properties file is used
-    if ( args.length < 1 )
-      throw new UnsupportedOperationException("Config file required as only command line parameter!");
-
+    initCliOptions();
+    try {
+    cliOptionValues = cliParser.parse(cliOptions, args);
+    } catch (UnrecognizedOptionException err) {
+      LOGGER.error(err.getMessage()+"\n");
+      printCliHelp();
+      return;
+    }
+    
+    
+    if ( cliOptionValues.hasOption(CLI_KEY_HELP) ) {
+      printCliHelp();
+      return;
+    };
+    
     // Configuration from config file
-    ResourceProviderOperator rpo = initResourceOperator(null, args[0]);
+    ResourceProviderOperator rpo = new ResourceProviderOperator();
+    if ( cliOptionValues.hasOption(CLI_KEY_FILE_CONFIG_IN) )
+      initResourceOperator(
+          rpo,
+          cliOptionValues.getOptionValue(CLI_KEY_FILE_CONFIG_IN,CLI_DEFAULT_FILE_CONFIG_IN)
+      );
+    
     // Configuration from command line parameters (overwrite config file
     // configuration)
-    initResourceOperator(rpo, (Object)null);
+    initResourceOperator(rpo, cliOptionValues, !cliOptionValues.hasOption(CLI_KEY_FILE_CONFIG_IN));
+    
     // Perform the operation
-    // TODO: implement several commands
-    //       currently only key removal supported.
-    rpo.processRemoveUnusedKeys();
+    try {
+      String operationStr = cliOptionValues.getOptionValue(CLI_KEY_OPERATION,CLI_DEFAULT_OPERATION);
+      switch ( Operation.valueOf(operationStr.toUpperCase()) ) {
+        case REMOVE_KEYS: rpo.processRemoveUnusedKeys(); break;
+      }
+    } catch (IllegalArgumentException err) {
+      LOGGER.error("Unsupported operation specified: "+cliOptionValues.getOptionValue(CLI_KEY_OPERATION,CLI_DEFAULT_OPERATION));
+      return;
+    }
   
-    // TODO: when a special command line parameter "-s <file>" is set
-    //       then store the configuration in the specified file
-//    rpo.setResourceBundles( new ResourceProvider[] {SwingUtil.RESOURCE,LangUtil.RESOURCE} );
-//    storeResourceOperator(rpo, new File(args[0]));
-
+    // When a special command line parameter "-ctf <file>" is set
+    // then store the configuration in the specified file
+    if ( cliOptionValues.hasOption(CLI_KEY_FILE_CONFIG_OUT) )
+      storeResourceOperator(
+          rpo,
+          new File(cliOptionValues.getOptionValue(CLI_KEY_FILE_CONFIG_OUT,CLI_DEFAULT_FILE_CONFIG_OUT))
+      );
   }
   
   /**
@@ -330,9 +528,9 @@
       parameters.load(input);
       
       // Configure the ResourceProviderOperator
-      String removeIndicatorPrefix = parameters.getProperty(CFG_KEY_REMOVE_KEYS_INDICATOR_PREFIX);
+      String removeIndicatorPrefix = parameters.getProperty(CFG_KEY_BUNDLE_KEYS_INDICATOR_PREFIX);
       if ( removeIndicatorPrefix != null )
-        rpo.setRemoveIndicatorPrefix(removeIndicatorPrefix);
+        rpo.setKeyIndicatorPrefix(removeIndicatorPrefix);
       String resourceBundleRootFolder = parameters.getProperty(CFG_KEY_RESOURCE_BUNDLES_ROOT_FOLDER);
       if ( resourceBundleRootFolder != null )
         rpo.setResourceBundlesRootFolder(new File(resourceBundleRootFolder));
@@ -340,7 +538,7 @@
         rpo.setResourceBundlesRootFolder(new File("."));
       String resourceBundlesList = parameters.getProperty(CFG_KEY_RESOURCE_BUNDLES);
       if ( resourceBundlesList != null ) {
-        String[] resourceBundles = resourceBundlesList.split(CFG_KEY_RESOURCE_BUNDLES_SEP);
+        String[] resourceBundles = resourceBundlesList.split(""+RESOURCE_BUNDLES_SEP);
         rpo.setResourceBundles(resourceBundles);
       }
     } catch (IOException err) {
@@ -355,13 +553,31 @@
    * @param rpo {@link ResourceProviderOperator} to configure (if {@code null} a
    *            new {@link ResourceProviderOperator} is created and returned)
    * @param cli command line parameters
+   * @param initCompletely If {@code true} the {@link ResourceProviderOperator} is
+   *                       initialized (with the default) even if an CLI option is not
+   *                       set. If {@code false} the properties remain on their
+   *                       previous state when the CLI option is not set.
    */
-  public static ResourceProviderOperator initResourceOperator(ResourceProviderOperator rpo, Object cli) {
+  public static ResourceProviderOperator initResourceOperator(ResourceProviderOperator rpo, CommandLine cli, boolean initCompletely) {
     if ( rpo == null )
       rpo = new ResourceProviderOperator();
 
-    // TODO: implement with CLI
     
+    // Configure the ResourceProviderOperator
+    if ( initCompletely || cli.hasOption( CLI_KEY_BUNDLE_KEYS_INDICATOR_PREFIX ) )
+      rpo.setKeyIndicatorPrefix( cli.getOptionValue(
+          CLI_KEY_BUNDLE_KEYS_INDICATOR_PREFIX, CLI_DEFAULT_BUNDLE_KEYS_INDICATOR_PREFIX )
+      );
+
+    if ( initCompletely || cli.hasOption( CLI_KEY_RESOURCE_BUNDLES_ROOT_FOLDER ) )
+      rpo.setResourceBundlesRootFolder( new File( cli.getOptionValue(
+          CLI_KEY_RESOURCE_BUNDLES_ROOT_FOLDER, CLI_DEFAULT_RESOURCE_BUNDLES_ROOT_FOLDER )
+      ));
+
+    if ( initCompletely || cli.hasOption( CLI_KEY_RESOURCE_BUNDLES ) ) {
+      rpo.setResourceBundles( cli.getOptionValues(CLI_KEY_RESOURCE_BUNDLES) );
+    }
+    
     return rpo;
   }
 
@@ -377,12 +593,12 @@
     try {
       Properties config = new Properties();
       output = new FileWriter(outFile);
-      if ( rpo.getRemoveIndicatorPrefix() != null )
-        config.put(CFG_KEY_REMOVE_KEYS_INDICATOR_PREFIX, rpo.getRemoveIndicatorPrefix());
+      if ( rpo.getKeyIndicatorPrefix() != null )
+        config.put(CFG_KEY_BUNDLE_KEYS_INDICATOR_PREFIX, rpo.getKeyIndicatorPrefix());
       if ( rpo.getResourceBundlesRootFolder() != null )
         config.put(CFG_KEY_RESOURCE_BUNDLES_ROOT_FOLDER, rpo.getResourceBundlesRootFolder().getPath());
       if ( rpo.getResourceBundles().length > 0 ) {
-        config.put(CFG_KEY_RESOURCE_BUNDLES, LangUtil.stringConcatWithSep(CFG_KEY_RESOURCE_BUNDLES_SEP, rpo.getResourceBundles()));
+        config.put(CFG_KEY_RESOURCE_BUNDLES, LangUtil.stringConcatWithSep(""+RESOURCE_BUNDLES_SEP, rpo.getResourceBundles()));
         ResourceProvider sample = rpo.getResourceBundles()[0];
       }
         

Modified: trunk/src/schmitzm/lang/resource/locales/LangResourceBundle.properties
===================================================================
--- trunk/src/schmitzm/lang/resource/locales/LangResourceBundle.properties	2010-11-15 16:22:47 UTC (rev 1273)
+++ trunk/src/schmitzm/lang/resource/locales/LangResourceBundle.properties	2010-11-15 17:56:48 UTC (rev 1274)
@@ -1,48 +1,56 @@
-##########
-#Copyright (c) 2009 Martin O. J. Schmitz.
-#
-#This file is part of the SCHMITZM library - a collection of utility 
-#classes based on Java 1.6, focusing (not only) on Java Swing 
-#and the Geotools library.
-#
-#The SCHMITZM project is hosted at:
-#http://wald.intevation.org/projects/schmitzm/
-#
-#This program is free software; you can redistribute it and/or
-#modify it under the terms of the GNU Lesser General Public License
-#as published by the Free Software Foundation; either version 3
-#of the License, or (at your option) any later version.
-#
-#This program is distributed in the hope that it will be useful,
-#but WITHOUT ANY WARRANTY; without even the implied warranty of
-#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#GNU General Public License for more details.
-#
-#You should have received a copy of the GNU Lesser General Public License (license.txt)
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-#or try this link: http://www.gnu.org/licenses/lgpl.html
-#
-#Contributors:
-#    Martin O. J. Schmitz - initial API and implementation
-#    Stefan A. Tzeggai - additional utility classes
-OperationTree.Integer=Integer
-OperationTree.Number=Number
-OperationTree.err.ParseErrorMess=Parse-Error at "${0}": ${1}
-OperationTree.err.UnexpectedEOR=Unexpected end of rule!
-OperationTree.err.UnexpectedError=Unexpected error!
-OperationTree.err.TokenNotExpected=${0} not expected
-OperationTree.err.MoreParamsExpected=${0} more function parameters expected. Bracket can not close!
-OperationTree.err.UnexpectedBracket=Bracket ${0} can not close ${1}
-OperationTree.err.BracketsNotClosed=Bracket(s) not closed: ${0}
-OperationTree.err.IllegalOperator=Illegal operator ${0}
-OperationTree.err.IllegalOperatorSyntax=Illegal ${0} syntax '${1}'
-OperationTree.err.ParamSepExpected=Parameter-Separator expected
-OperationTree.err.IllegalCharacter=Illegal character '${0}' (${1} expected)
-
-OperationTree.err.UnknownNode=Unknown operation tree node: ${0}
-OperationTree.err.UnknownOperator=Unknown operator: ${0}
-OperationTree.err.UnknownAliasOperator=Unknown alias operator: ${0}
-OperationTree.err.LessParams1=At least ${0} function parameters expected: ${1}(..)
-OperationTree.err.LessParams2=${0} function parameters expected: ${1}(..)
-OperationTree.err.IllegalParam=Illegal parameter ${0} for ${1}(..): ${2} expected
+##########
+#Copyright (c) 2009 Martin O. J. Schmitz.
+#
+#This file is part of the SCHMITZM library - a collection of utility 
+#classes based on Java 1.6, focusing (not only) on Java Swing 
+#and the Geotools library.
+#
+#The SCHMITZM project is hosted at:
+#http://wald.intevation.org/projects/schmitzm/
+#
+#This program is free software; you can redistribute it and/or
+#modify it under the terms of the GNU Lesser General Public License
+#as published by the Free Software Foundation; either version 3
+#of the License, or (at your option) any later version.
+#
+#This program is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#GNU General Public License for more details.
+#
+#You should have received a copy of the GNU Lesser General Public License (license.txt)
+#along with this program; if not, write to the Free Software
+#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+#or try this link: http://www.gnu.org/licenses/lgpl.html
+#
+#Contributors:
+#    Martin O. J. Schmitz - initial API and implementation
+#    Stefan A. Tzeggai - additional utility classes
+OperationTree.Integer=Integer
+OperationTree.Number=Number
+OperationTree.err.ParseErrorMess=Parse-Error at "${0}": ${1}
+OperationTree.err.UnexpectedEOR=Unexpected end of rule!
+OperationTree.err.UnexpectedError=Unexpected error!
+OperationTree.err.TokenNotExpected=${0} not expected
+OperationTree.err.MoreParamsExpected=${0} more function parameters expected. Bracket can not close!
+OperationTree.err.UnexpectedBracket=Bracket ${0} can not close ${1}
+OperationTree.err.BracketsNotClosed=Bracket(s) not closed: ${0}
+OperationTree.err.IllegalOperator=Illegal operator ${0}
+OperationTree.err.IllegalOperatorSyntax=Illegal ${0} syntax '${1}'
+OperationTree.err.ParamSepExpected=Parameter-Separator expected
+OperationTree.err.IllegalCharacter=Illegal character '${0}' (${1} expected)
+
+OperationTree.err.UnknownNode=Unknown operation tree node: ${0}
+OperationTree.err.UnknownOperator=Unknown operator: ${0}
+OperationTree.err.UnknownAliasOperator=Unknown alias operator: ${0}
+OperationTree.err.LessParams1=At least ${0} function parameters expected: ${1}(..)
+OperationTree.err.LessParams2=${0} function parameters expected: ${1}(..)
+OperationTree.err.IllegalParam=Illegal parameter ${0} for ${1}(..): ${2} expected
+
+ResourceProviderOperator.cli.info.help=Shows this help messages.
+ResourceProviderOperator.cli.info.operation=Operation which is processed.\nPossible values: ${0}\nDefault: ${1}
+ResourceProviderOperator.cli.info.bundles=Semicolon-separated list of the resource bundles which are processed.
+ResourceProviderOperator.cli.info.rootfolder=Root folder the resource bundle files can be found relatively to.\nDefault: ${0} (as it is the maven default)
+ResourceProviderOperator.cli.info.indicator=Prefix the bundle keys, which should be processed, are marked with.\nDefault: ${0}
+ResourceProviderOperator.cli.info.filein=Property file the configuration is taken from (command line parameters have higher priority!).\nDefault: ${0}
+ResourceProviderOperator.cli.info.fileout=Property file the configuration is stored in.\nDefault: ${0}

Added: trunk/src_junit/schmitzm/lang/ResourceProviderOperator.cfg
===================================================================
--- trunk/src_junit/schmitzm/lang/ResourceProviderOperator.cfg	2010-11-15 16:22:47 UTC (rev 1273)
+++ trunk/src_junit/schmitzm/lang/ResourceProviderOperator.cfg	2010-11-15 17:56:48 UTC (rev 1274)
@@ -0,0 +1,5 @@
+#Configuration for ResourceProviderOperator
+#Mon Nov 15 18:25:27 CET 2010
+resource.bundles.src.root.folder=E:/Arbeit/SCHMITZM/Trunk/src_junit
+resource.bundles=schmitzm.lang.resource.locales.TestLangResourceBundle
+bundle.keys.indicator.prefix=REMOVEME_



More information about the Schmitzm-commits mailing list