[Schmitzm-commits] r1275 - trunk/src/schmitzm/lang

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Nov 15 20:11:12 CET 2010


Author: mojays
Date: 2010-11-15 20:11:11 +0100 (Mon, 15 Nov 2010)
New Revision: 1275

Modified:
   trunk/src/schmitzm/lang/ResourceProviderOperator.java
Log:


Modified: trunk/src/schmitzm/lang/ResourceProviderOperator.java
===================================================================
--- trunk/src/schmitzm/lang/ResourceProviderOperator.java	2010-11-15 17:56:48 UTC (rev 1274)
+++ trunk/src/schmitzm/lang/ResourceProviderOperator.java	2010-11-15 19:11:11 UTC (rev 1275)
@@ -162,9 +162,29 @@
   /** 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;
+  protected File resourceBundlesRootFolder = new File(CLI_DEFAULT_RESOURCE_BUNDLES_ROOT_FOLDER);
   
+  /**
+   * Configures a {@link ResourceProviderOperator} for the currently registered
+   * {@link ResourceProvider}. 
+   * @param indicator  the indicator prefix for the bundle keys to process;
+   *                   if {@code null}, the default "REMOVEME_" is used
+   * @param rootFolder the root folder the bundle source files are located (relatively to);
+   *                   if {@code null}, the default "src/main/resources/" is used
+   * @return
+   */
+  public static ResourceProviderOperator createForCurrentResourceProvider(String indicator, File rootFolder) {
+    ResourceProvider[] rp = ResourceProvider.getRegisteredResourceProvider().toArray(new ResourceProvider[0]);
+    ResourceProviderOperator rpo = new ResourceProviderOperator();
+    rpo.setResourceBundles(rp);
+    if ( indicator != null )
+      rpo.setKeyIndicatorPrefix( indicator );
+    if ( rootFolder != null )
+      rpo.setResourceBundlesRootFolder( rootFolder );
 
+    return rpo;
+  }
+  
   /**
    * Sets the resource bundles to perform the operations on.
    */



More information about the Schmitzm-commits mailing list