You are viewing a plain text version of this content. The canonical link for it is here.
Posted to svn@forrest.apache.org by th...@apache.org on 2008/10/02 12:34:36 UTC

svn commit: r701070 - /forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java

Author: thorsten
Date: Thu Oct  2 03:34:35 2008
New Revision: 701070

URL: http://svn.apache.org/viewvc?rev=701070&view=rev
Log:
white noise - formating changes

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=701070&r1=701069&r2=701070&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 Thu Oct  2 03:34:35 2008
@@ -51,7 +51,7 @@
   /**
    * The requested format.
    */
-  private String requestedFormat,requestId;
+  private String requestedFormat, requestId;
 
   /**
    * Caching and validity properties
@@ -84,35 +84,40 @@
   public static final String CACHING_OFF = "off";
 
   public static final String CACHING_ON = "on";
-  
-  
-  /* 
-   * @see org.apache.cocoon.transformation.AbstractSAXTransformer#configure(org.apache.avalon.framework.configuration.Configuration)
+
+  /*
+   * @see
+   * org.apache.cocoon.transformation.AbstractSAXTransformer#configure(org.apache
+   * .avalon.framework.configuration.Configuration)
    */
-  public void configure(Configuration configuration) throws ConfigurationException {
+  public void configure(Configuration configuration)
+      throws ConfigurationException {
     config = new DispatcherBean();
-    boolean allowXml=configuration.getChild("allowXml").getValueAsBoolean(false);
+    boolean allowXml = configuration.getChild("allowXml").getValueAsBoolean(
+        false);
     config.setAllowXmlProperties(allowXml);
-    String contractUriPrefix = configuration.getChild("contractUriPrefix").getValue("cocoon://resolve.contract");
+    String contractUriPrefix = configuration.getChild("contractUriPrefix")
+        .getValue("cocoon://resolve.contract");
     config.setContractUriPrefix(contractUriPrefix);
     xpathSupport = configuration.getChild("xpathSupport").getValue("basic");
   }
-  
-//we do all the heavy stuff later and only prepare the basics here,
+
+  // we do all the heavy stuff later and only prepare the basics here,
   // this enhance the response time while caching.
   public void setup(SourceResolver resolver, Map objectModel, String src,
       Parameters par) throws ProcessingException, SAXException, IOException {
     super.setup(resolver, objectModel, src, par);
-    
-    this.requestId = parameters.getParameter(DISPATCHER_REQUEST_ATTRIBUTE, null);
+
+    this.requestId = parameters
+        .getParameter(DISPATCHER_REQUEST_ATTRIBUTE, null);
     this.cacheKey = parameters.getParameter(CACHE_PARAMETER, null);
     if (null == this.cacheKey)
       getLogger().warn(
           "Caching not activated! Declare the CACHE_KEY_PARAMETER="
               + CACHE_PARAMETER + " in your sitemap.");
     this.validityFile = parameters.getParameter(VALIDITY_PARAMETER, null);
-    this.validityOverride = parameters
-        .getParameter(VALIDITY_OVERRIDE_PARAMETER, "");
+    this.validityOverride = parameters.getParameter(
+        VALIDITY_OVERRIDE_PARAMETER, "");
     this.cacheKey += validityOverride;
 
     if (requestId == null) {
@@ -121,8 +126,7 @@
       getLogger().error(error);
       throw new ProcessingException(error);
     }
-    this.requestedFormat = parameters.getParameter(Captions.TYPE_ATT,
-        null);
+    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!";
@@ -131,34 +135,37 @@
     }
     if (null == m_resolver)
       try {
-        m_resolver = (org.apache.excalibur.source.SourceResolver) manager.lookup(SourceResolver.ROLE);
+        m_resolver = (org.apache.excalibur.source.SourceResolver) manager
+            .lookup(SourceResolver.ROLE);
         config.setResolver(new CocoonResolver(m_resolver));
       } catch (ServiceException e) {
         throw new ProcessingException(e);
       }
 
   }
+
   public void startDocument() throws SAXException {
     super.startDocument();
     startSerializedXMLRecording(null);
   }
-  public void endDocument()
-  throws SAXException {
+
+  public void endDocument() throws SAXException {
     super.endDocument();
-    String document=null;
+    String document = null;
     try {
       document = super.endSerializedXMLRecording();
     } catch (ProcessingException e) {
       throw new SAXException(e);
-    }    
+    }
     Structurer structurer = null;
-    if(xpathSupport.equals("enhanced")){
-      structurer =new XMLStructurerAxiom(config);
-    }else{
-      structurer =new XMLStructurer(config);
+    if (xpathSupport.equals("enhanced")) {
+      structurer = new XMLStructurerAxiom(config);
+    } else {
+      structurer = new XMLStructurer(config);
     }
     try {
-      structurer.execute(new BufferedInputStream(new ByteArrayInputStream(document.getBytes())), requestedFormat);
+      structurer.execute(new BufferedInputStream(new ByteArrayInputStream(
+          document.getBytes())), requestedFormat);
     } catch (DispatcherException e) {
       throw new SAXException(e);
     }
@@ -177,8 +184,8 @@
   /**
    * Generate the validity object.
    * 
-   * @return The generated validity object or <code>null</code> if the
-   *         component is currently not cacheable.
+   * @return The generated validity object or <code>null</code> if the component
+   *         is currently not cacheable.
    */
   public SourceValidity getValidity() {
     // You can either request URL?dispatcher.caching=off
@@ -186,13 +193,13 @@
     // to force a SourceValidity.INVALID
     if (null != validityFile && !(validityOverride.equals(CACHING_OFF))) {
       this.validity = new AggregatedValidity();
-      Source resolveSource=null;
+      Source resolveSource = null;
       try {
-        resolveSource= m_resolver.resolveURI(validityFile);
+        resolveSource = m_resolver.resolveURI(validityFile);
         this.validity.add(resolveSource.getValidity());
       } catch (Exception e) {
         getLogger().error(e.getMessage());
-      }finally{
+      } finally {
         release(resolveSource);
       }
     } else
@@ -201,14 +208,14 @@
   }
 
   /**
-   * @see org.apache.excalibur.source.SourceFactory#release(org.apache.excalibur.source.Source) 
+   * @see org.apache.excalibur.source.SourceFactory#release(org.apache.excalibur.source.Source)
    */
- public void release(Source source) {
-   if(source!=null){
-     m_resolver.release(source);
-   }
+  public void release(Source source) {
+    if (source != null) {
+      m_resolver.release(source);
+    }
   }
-  
+
   /**
    * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
    */
@@ -221,7 +228,7 @@
    */
   public void dispose() {
     if (null != this.manager) {
-      if (null!=m_resolver)
+      if (null != m_resolver)
         this.manager.release(m_resolver);
       this.manager = null;
     }