incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1234446 - in /incubator/lcf/branches/CONNECTORS-388/framework/core/src/main/java/org/apache/manifoldcf/core/i18n: MCFVelocityResourceLoader.java Messages.java
Date Sun, 22 Jan 2012 02:16:57 GMT
Author: kwright
Date: Sun Jan 22 02:16:57 2012
New Revision: 1234446

URL: http://svn.apache.org/viewvc?rev=1234446&view=rev
Log:
This code gets the template resource pickup working.

Modified:
    incubator/lcf/branches/CONNECTORS-388/framework/core/src/main/java/org/apache/manifoldcf/core/i18n/MCFVelocityResourceLoader.java
    incubator/lcf/branches/CONNECTORS-388/framework/core/src/main/java/org/apache/manifoldcf/core/i18n/Messages.java

Modified: incubator/lcf/branches/CONNECTORS-388/framework/core/src/main/java/org/apache/manifoldcf/core/i18n/MCFVelocityResourceLoader.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-388/framework/core/src/main/java/org/apache/manifoldcf/core/i18n/MCFVelocityResourceLoader.java?rev=1234446&r1=1234445&r2=1234446&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-388/framework/core/src/main/java/org/apache/manifoldcf/core/i18n/MCFVelocityResourceLoader.java
(original)
+++ incubator/lcf/branches/CONNECTORS-388/framework/core/src/main/java/org/apache/manifoldcf/core/i18n/MCFVelocityResourceLoader.java
Sun Jan 22 02:16:57 2012
@@ -24,14 +24,13 @@ import java.io.*;
 */
 public class MCFVelocityResourceLoader extends org.apache.velocity.runtime.resource.loader.ResourceLoader
 {
-  public final static String CLASS_INSTANCE = "ClassInstance";
+  protected Class classInstance;
   
-  protected Class classInstance = null;
-  
-  /** Null constructor.
+  /** Constructor.
   */
-  public MCFVelocityResourceLoader()
+  public MCFVelocityResourceLoader(Class classInstance)
   {
+    this.classInstance = classInstance;
   }
 
   public long getLastModified(org.apache.velocity.runtime.resource.Resource resource)
@@ -50,13 +49,7 @@ public class MCFVelocityResourceLoader e
 
   public void init(org.apache.commons.collections.ExtendedProperties configuration)
   {
-    // Set the class instance
-    Object o = configuration.getProperty(CLASS_INSTANCE);
-    if (o == null)
-      throw new RuntimeException("Missing property '"+CLASS_INSTANCE+"'");
-    if (!(o instanceof Class))
-      throw new RuntimeException("Property '"+CLASS_INSTANCE+"' must be of type Class");
-    classInstance = (Class)o;
+    // Does nothing
   }
 
   public boolean isSourceModified(org.apache.velocity.runtime.resource.Resource resource)

Modified: incubator/lcf/branches/CONNECTORS-388/framework/core/src/main/java/org/apache/manifoldcf/core/i18n/Messages.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-388/framework/core/src/main/java/org/apache/manifoldcf/core/i18n/Messages.java?rev=1234446&r1=1234445&r2=1234446&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-388/framework/core/src/main/java/org/apache/manifoldcf/core/i18n/Messages.java
(original)
+++ incubator/lcf/branches/CONNECTORS-388/framework/core/src/main/java/org/apache/manifoldcf/core/i18n/Messages.java
Sun Jan 22 02:16:57 2012
@@ -24,6 +24,7 @@ import java.util.MissingResourceExceptio
 import java.util.ResourceBundle;
 import java.util.Set;
 import java.util.HashSet;
+import java.util.Vector;
 
 import java.io.InputStream;
 
@@ -53,8 +54,10 @@ public class Messages
     VelocityEngine engine = new VelocityEngine();
     // Now configure it
     org.apache.commons.collections.ExtendedProperties configuration = new org.apache.commons.collections.ExtendedProperties();
-    configuration.setProperty(VelocityEngine.RESOURCE_LOADER,MCFVelocityResourceLoader.class.getName());
-    configuration.setProperty(MCFVelocityResourceLoader.CLASS_INSTANCE,classInstance);
+    // This is the property that describes the id's of the resource loaders.
+    configuration.setProperty(VelocityEngine.RESOURCE_LOADER,"mcf");
+    // This is the property which describes the resource loader itself
+    configuration.setProperty("mcf."+VelocityEngine.RESOURCE_LOADER+".instance",new MCFVelocityResourceLoader(classInstance));
     engine.setExtendedProperties(configuration);
     return engine;
   }



Mime
View raw message