forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thors...@apache.org
Subject svn commit: r704885 - /forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java
Date Wed, 15 Oct 2008 12:28:44 GMT
Author: thorsten
Date: Wed Oct 15 05:28:43 2008
New Revision: 704885

URL: http://svn.apache.org/viewvc?rev=704885&view=rev
Log:
Making dispatcherTransformer compatible with cocoon-2.2 by adding some setter methods and
using abstract log access.

Modified:
    forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java

Modified: forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java
URL: http://svn.apache.org/viewvc/forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java?rev=704885&r1=704884&r2=704885&view=diff
==============================================================================
--- forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java
(original)
+++ forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java
Wed Oct 15 05:28:43 2008
@@ -135,11 +135,6 @@
   public static final String CACHING_ON = "on";
 
   /**
-   * Logger
-   */
-  private Logger log;
-
-  /**
    * Main configuration bean of the dispatcher.
    * <p>
    * This config will control things like <li>contract prefixes/suffixes <li>
@@ -148,6 +143,24 @@
   private WritableDispatcherBean config;
 
   /**
+   * Cocoon 2.2 compatible method.
+   * Allow that the WritableDispatcherBean is be set via e.g. spring
+   * @param config the configuration to use.
+   */
+  public void setConfig(WritableDispatcherBean config) {
+    this.config = config;
+  }
+  
+  /**
+   * Cocoon 2.2 compatible method.
+   * Allow that the ServiceManager is be set via e.g. spring
+   * @param manager manger to use in the context
+   */
+  public void setManager(ServiceManager manager){
+    this.manager = manager;
+  }
+
+  /**
    * The level of xpath support we need.
    * <p>
    * If you choose enhanced you can inject/create node with enhanced xpath
@@ -196,7 +209,7 @@
     // FIXME: is this the best way to get an instance in cocoon?
     TransformerFactory tfactory = TransformerFactory.newInstance();
     tfactory.setURIResolver(this);
-    tfactory.setErrorListener(new TraxErrorHandler(getLogger()));
+    //tfactory.setErrorListener(new TraxErrorHandler(getLogger()));
     config.setTransFact(tfactory);
   }
 
@@ -209,9 +222,8 @@
     this.requestId = parameters
         .getParameter(DISPATCHER_REQUEST_ATTRIBUTE, null);
     this.cacheKey = parameters.getParameter(CACHE_PARAMETER, null);
-    log = getLogger();
     if (null == this.cacheKey)
-      log.warn("Caching not activated! Declare the CACHE_KEY_PARAMETER="
+      getLogger().warn("Caching not activated! Declare the CACHE_KEY_PARAMETER="
           + CACHE_PARAMETER + " in your sitemap.");
     this.validityFile = parameters.getParameter(VALIDITY_PARAMETER, null);
     this.validityChecking = parameters.getParameter(
@@ -219,14 +231,14 @@
     if (requestId == null) {
       String error = "dispatcherError:\n"
           + "You have to set the \"request\" parameter in the sitemap!";
-      log.error(error);
+      getLogger().error(error);
       throw new ProcessingException(error);
     }
     this.requestedFormat = parameters.getParameter(Captions.TYPE_ATT, null);
     if (requestedFormat == null) {
       String error = "dispatcherError:\n"
           + "You have to set the \"type\" parameter in the sitemap!";
-      log.error(error);
+      getLogger().error(error);
       throw new ProcessingException(error);
     }
     this.cacheKey += requestedFormat;



Mime
View raw message