forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cyriaque Dupoirieux <Cyriaque.Dupoiri...@pcotech.fr>
Subject Re: svn commit: r430701 - in /forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher: ContractBeanDOMImpl.java transformation/DispatcherTransformer.java
Date Fri, 11 Aug 2006 07:42:35 GMT
Excellent,

These kind of improvement are very important.
We need to have an overview of what is done by each component to be able 
to improve the code quality and the performance.
(Actually, we need a design dossier ;-)   )

Salutations,
Cyriaque,

le 11/08/2006 09:10 thorsten@apache.org a écrit :
> Author: thorsten
> Date: Fri Aug 11 00:10:20 2006
> New Revision: 430701
>
> URL: http://svn.apache.org/viewvc?rev=430701&view=rev
> Log:
> Moving the request/generation of the properties out of the contract implementation bean
since it will not change for one structurer file. The properties will be now generated once
per structurer instead of x times for x contracts. This reduces the processing load quite
a bit.
>
> Modified:
>     forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/ContractBeanDOMImpl.java
>     forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java
>
> Modified: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/ContractBeanDOMImpl.java
> URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/ContractBeanDOMImpl.java?rev=430701&r1=430700&r2=430701&view=diff
> ==============================================================================
> --- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/ContractBeanDOMImpl.java
(original)
> +++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/ContractBeanDOMImpl.java
Fri Aug 11 00:10:20 2006
> @@ -115,6 +115,8 @@
>  
>      private URIResolver m_uriResolver;
>  
> +    private Object defaultVariables;
> +
>      /**
>       * The ContractBean contains all fields to work with contracts. It is a
>       * helper bean.
> @@ -126,14 +128,16 @@
>       * 
>       * @param manager
>       * @param parameterHelper
> +     * @param defaultProperties 
>       * @throws ParserConfigurationException
>       */
> -    public ContractBeanDOMImpl(ServiceManager manager, HashMap parameterHelper,URIResolver
uriResolver)
> +    public ContractBeanDOMImpl(ServiceManager manager, HashMap parameterHelper,Document
defaultProperties, URIResolver uriResolver)
>              throws ParserConfigurationException {
>          m_uriResolver=uriResolver;
>          this.manager = manager;
>          dispatcherHelper = new DispatcherHelper(manager);
>          this.parameterHelper = parameterHelper;
> +        this.defaultVariables=defaultProperties;
>      }
>  
>      /*
> @@ -252,12 +256,8 @@
>                       */
>                      // default forrest properties
>                      Transformer transformer = cachedXSLT.newTransformer();
> -                    String request= (String) parameterHelper.get(DispatcherTransformer.DISPATCHER_REQUEST_ATTRIBUTE);
> -                    String propertyURI= "cocoon://"+request+".props";
> -                    Node defaultVariables = org.apache.forrest.dispatcher.util.SourceUtil
> -                            .readDOM(propertyURI, this.manager);
>                      transformer.setParameter("defaultVariables",
> -                            defaultVariables);
> +                            this.defaultVariables);
>                      transformer.setOutputProperty(
>                              OutputKeys.OMIT_XML_DECLARATION, "yes");
>                      transformer.setOutputProperty(OutputKeys.INDENT, "yes");
>
> Modified: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java
> URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java?rev=430701&r1=430700&r2=430701&view=diff
> ==============================================================================
> --- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java
(original)
> +++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java
Fri Aug 11 00:10:20 2006
> @@ -23,6 +23,7 @@
>  import java.util.Iterator;
>  import java.util.Map;
>  
> +import javax.xml.parsers.ParserConfigurationException;
>  import javax.xml.transform.Transformer;
>  import javax.xml.transform.TransformerException;
>  import javax.xml.transform.URIResolver;
> @@ -193,6 +194,8 @@
>  
>      private String requestId;
>  
> +    private Document defaultProperties;
> +
>      public static final String HOOKS_TRANSFORMER_PARAMETER = "hooksTransformer";
>  
>      public static final String PATH_PARAMETER = "path";
> @@ -292,6 +295,16 @@
>              getLogger().error(error);
>              throw new ProcessingException(error);
>          }
> +        String propertyURI= "cocoon://"+requestId+".props";
> +        try {
> +            this.defaultProperties = org.apache.forrest.dispatcher.util.SourceUtil
> +            .readDOM(propertyURI, this.manager);
> +        } catch (Exception e1) {
> +            String error = "dispatcherError:\n"
> +                + "Could not get the properties for "+propertyURI;
> +        getLogger().error(error);
> +        throw new ProcessingException(error);
> +        }
>          parameterHelper.put(DISPATCHER_REQUEST_ATTRIBUTE, requestId);
>          this.requestedFormat = parameters.getParameter(
>                  STRUCTURER_FORMAT_ATTRIBUTE, null);
> @@ -620,9 +633,10 @@
>          try {
>              if (contract == null)
>                  contract = new ContractBeanDOMImpl(this.manager,
> -                        parameterHelper,(URIResolver)this);
> -            else
> -                contract.initialize();
> +                        parameterHelper,defaultProperties,(URIResolver)this);
> +            // This is not needed since the manager did not change.
> +            //else
> +              //  contract.initialize();
>          } catch (Exception e) {
>              String error = DispatcherException.ERROR_500 + "\n"
>                      + "component: ContractBean" + "\n"
>
>
>
>   

Mime
View raw message