cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject cvs commit: xml-cocoon2/src/scratchpad/src/org/apache/cocoon/transformation/pagination Paginator.java
Date Tue, 11 Jun 2002 23:54:54 GMT
vgritsenko    2002/06/11 16:54:54

  Modified:    src/java/org/apache/cocoon/acting Tag: cocoon_2_0_3_branch
                        SetCharacterEncodingAction.java
               src/java/org/apache/cocoon/matching Tag: cocoon_2_0_3_branch
                        CookieMatcher.java
               src/scratchpad/src/org/apache/cocoon/acting Tag:
                        cocoon_2_0_3_branch DbXMLAuthenticatorAction.java
               src/scratchpad/src/org/apache/cocoon/acting/modular Tag:
                        cocoon_2_0_3_branch TestAction.java
               src/scratchpad/src/org/apache/cocoon/reading Tag:
                        cocoon_2_0_3_branch DirectoryZipArchiver.java
                        ImageReader.java
               src/scratchpad/src/org/apache/cocoon/samples/castor Tag:
                        cocoon_2_0_3_branch TestBeanAction.java
               src/scratchpad/src/org/apache/cocoon/samples/xmlform Tag:
                        cocoon_2_0_3_branch FormBinderAction.java
                        ValidatingFormAction.java
               src/scratchpad/src/org/apache/cocoon/transformation Tag:
                        cocoon_2_0_3_branch CastorTransformer.java
               src/scratchpad/src/org/apache/cocoon/transformation/pagination
                        Tag: cocoon_2_0_3_branch Paginator.java
  Log:
  Use ObjectModelHelper instead of deprecated Constants
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.1   +6 -5      xml-cocoon2/src/java/org/apache/cocoon/acting/SetCharacterEncodingAction.java
  
  Index: SetCharacterEncodingAction.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/acting/SetCharacterEncodingAction.java,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- SetCharacterEncodingAction.java	22 Feb 2002 06:59:26 -0000	1.2
  +++ SetCharacterEncodingAction.java	11 Jun 2002 23:54:53 -0000	1.2.2.1
  @@ -50,13 +50,14 @@
   */
   package org.apache.cocoon.acting;
   
  -import org.apache.avalon.framework.parameters.Parameters;
  -import org.apache.avalon.framework.parameters.Parameterizable;
   import org.apache.avalon.framework.parameters.ParameterException;
  +import org.apache.avalon.framework.parameters.Parameterizable;
  +import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.avalon.framework.thread.ThreadSafe;
  -import org.apache.cocoon.Constants;
  -import org.apache.cocoon.environment.Request;
  +
  +import org.apache.cocoon.environment.ObjectModelHelper;
   import org.apache.cocoon.environment.Redirector;
  +import org.apache.cocoon.environment.Request;
   import org.apache.cocoon.environment.SourceResolver;
   
   import java.util.Map;
  @@ -89,7 +90,7 @@
        * Set character encoding of current request.
        */
       public Map act (Redirector redirector, SourceResolver resolver, Map objectModel, String
src, Parameters par) throws Exception {
  -        Request request = (Request) objectModel.get(Constants.REQUEST_OBJECT);
  +        Request request = ObjectModelHelper.getRequest(objectModel);
           if (request != null) {
               String form_encoding = par.getParameter("form-encoding", global_form_encoding);
               if (form_encoding != null) {
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +2 -2      xml-cocoon2/src/java/org/apache/cocoon/matching/CookieMatcher.java
  
  Index: CookieMatcher.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/matching/CookieMatcher.java,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  --- CookieMatcher.java	3 Mar 2002 01:03:48 -0000	1.1
  +++ CookieMatcher.java	11 Jun 2002 23:54:53 -0000	1.1.2.1
  @@ -53,9 +53,9 @@
   import org.apache.avalon.framework.logger.AbstractLoggable;
   import org.apache.avalon.framework.parameters.Parameters;
   
  -import org.apache.cocoon.Constants;
   import org.apache.cocoon.environment.Cookie;
   import org.apache.cocoon.environment.Request;
  +import org.apache.cocoon.environment.ObjectModelHelper;
   import org.apache.cocoon.sitemap.PatternException;
   
   import java.util.HashMap;
  @@ -75,7 +75,7 @@
               throw new PatternException("No cookie name given.");
           }
   
  -        Request request = (Request) objectModel.get(Constants.REQUEST_OBJECT);
  +        Request request = ObjectModelHelper.getRequest(objectModel);
           Cookie[] cookies = request.getCookies();
           HashMap result = null;
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +15 -12    xml-cocoon2/src/scratchpad/src/org/apache/cocoon/acting/DbXMLAuthenticatorAction.java
  
  Index: DbXMLAuthenticatorAction.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/acting/DbXMLAuthenticatorAction.java,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  --- DbXMLAuthenticatorAction.java	5 Mar 2002 11:02:31 -0000	1.1
  +++ DbXMLAuthenticatorAction.java	11 Jun 2002 23:54:53 -0000	1.1.2.1
  @@ -55,30 +55,33 @@
   
   package org.apache.cocoon.acting;
   
  -import org.apache.avalon.excalibur.datasource.DataSourceComponent;
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.avalon.framework.thread.ThreadSafe;
  +
   import org.apache.cocoon.Constants;
  +import org.apache.cocoon.environment.ObjectModelHelper;
   import org.apache.cocoon.environment.Redirector;
   import org.apache.cocoon.environment.Request;
   import org.apache.cocoon.environment.Session;
   import org.apache.cocoon.environment.SourceResolver;
   
  +import org.apache.xpath.XPathAPI;
  +import org.apache.xpath.objects.XObject;
  +import org.w3c.dom.Node;
  +import org.xmldb.api.DatabaseManager;
  +import org.xmldb.api.base.Collection;
  +import org.xmldb.api.base.Database;
  +import org.xmldb.api.base.ResourceIterator;
  +import org.xmldb.api.base.ResourceSet;
  +import org.xmldb.api.base.XMLDBException;
  +import org.xmldb.api.modules.XMLResource;
  +import org.xmldb.api.modules.XPathQueryService;
  +
   import java.util.Collections;
   import java.util.HashMap;
   import java.util.Map;
   
  -
  -import org.xmldb.api.base.*;
  -import org.xmldb.api.modules.*;
  -import org.xmldb.api.*;
  -
  -import org.w3c.dom.*;
  -
  -import org.apache.xpath.*;
  -import org.apache.xpath.objects.*;
  -
   /**
    * This action is used to authenticate user by comparing several request
    * fields (username, password) with the values in a DBXML compliant database.
  @@ -161,7 +164,7 @@
             cs = false;
           }
   
  -        Request req = (Request) objectModel.get(Constants.REQUEST_OBJECT);
  +        Request req = ObjectModelHelper.getRequest(objectModel);
   
           /* check request validity */
           if (req == null) {
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.2   +5 -10     xml-cocoon2/src/scratchpad/src/org/apache/cocoon/acting/modular/Attic/TestAction.java
  
  Index: TestAction.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/acting/modular/Attic/TestAction.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- TestAction.java	28 Apr 2002 19:59:52 -0000	1.1.2.1
  +++ TestAction.java	11 Jun 2002 23:54:53 -0000	1.1.2.2
  @@ -51,28 +51,23 @@
   
   package org.apache.cocoon.acting.modular;
   
  -import org.apache.avalon.framework.activity.Initializable;
  +import org.apache.avalon.framework.component.ComponentSelector;
   import org.apache.avalon.framework.configuration.Configurable;
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.ConfigurationException;
  -import org.apache.avalon.framework.parameters.ParameterException;
   import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.avalon.framework.thread.ThreadSafe;
  -import org.apache.avalon.framework.component.ComponentSelector;
   
  -import org.apache.cocoon.Constants;
   import org.apache.cocoon.acting.ComposerAction;
  +import org.apache.cocoon.components.modules.input.InputModule;
  +import org.apache.cocoon.components.modules.output.OutputModule;
  +import org.apache.cocoon.environment.ObjectModelHelper;
   import org.apache.cocoon.environment.Redirector;
   import org.apache.cocoon.environment.Request;
  -import org.apache.cocoon.environment.Session;
   import org.apache.cocoon.environment.SourceResolver;
   
  -import org.apache.cocoon.components.modules.input.InputModule;
  -import org.apache.cocoon.components.modules.output.OutputModule;
  -
   import java.util.Enumeration;
   import java.util.Map;
  -import java.util.HashMap;
   
   /** Demo action that uses componentized input / output layer. In order
    * to stop combinatorial explosion of actions, matchers, and selectors
  @@ -121,7 +116,7 @@
                       String source, Parameters param ) throws Exception {
   
           // general setup
  -        Request request = (Request) objectModel.get(Constants.REQUEST_OBJECT);
  +        Request request = ObjectModelHelper.getRequest(objectModel);
           if (request == null) {
             getLogger().error("no request object!");
             return(null);
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.3.2.1   +14 -29    xml-cocoon2/src/scratchpad/src/org/apache/cocoon/reading/DirectoryZipArchiver.java
  
  Index: DirectoryZipArchiver.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/reading/DirectoryZipArchiver.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- DirectoryZipArchiver.java	22 Feb 2002 06:58:03 -0000	1.3
  +++ DirectoryZipArchiver.java	11 Jun 2002 23:54:53 -0000	1.3.2.1
  @@ -50,36 +50,11 @@
   */
   package org.apache.cocoon.reading;
   
  -import java.io.InputStream;
  -import java.io.BufferedInputStream;
  -import java.io.FileInputStream;
  -import java.io.FileOutputStream;
  -import java.io.File;
  -import java.io.OutputStream;
  -import java.io.IOException;
  -
  -import java.net.URL;
  -
  -import java.util.Map;
  -import java.util.Date;
  -
  -import java.util.zip.ZipEntry;
  -import java.util.zip.ZipOutputStream;
  -
  -import org.apache.avalon.framework.component.Component;
  -import org.apache.avalon.framework.component.ComponentException;
  -import org.apache.avalon.framework.component.ComponentManager;
  -import org.apache.avalon.framework.component.Composable;
   import org.apache.avalon.framework.parameters.Parameters;
   
  -import org.apache.cocoon.Constants;
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.ResourceNotFoundException;
  -import org.apache.cocoon.caching.CacheValidity;
  -import org.apache.cocoon.caching.Cacheable;
  -import org.apache.cocoon.caching.TimeStampCacheValidity;
  -import org.apache.cocoon.util.HashUtil;
  -import org.apache.cocoon.environment.Context;
  +import org.apache.cocoon.environment.ObjectModelHelper;
   import org.apache.cocoon.environment.Request;
   import org.apache.cocoon.environment.Response;
   import org.apache.cocoon.environment.Source;
  @@ -87,6 +62,16 @@
   
   import org.xml.sax.SAXException;
   
  +import java.io.File;
  +import java.io.FileInputStream;
  +import java.io.IOException;
  +import java.io.InputStream;
  +import java.io.OutputStream;
  +import java.net.URL;
  +import java.util.Map;
  +import java.util.zip.ZipEntry;
  +import java.util.zip.ZipOutputStream;
  +
   /**
    * The <code>DirectoryZipArchiver</code> component creates a compressed zip
    * archive of the files contained in the directory passed with 'src'.
  @@ -110,8 +95,8 @@
       public void setup(SourceResolver resolver, Map objectModel, String src, Parameters
par)
           throws ProcessingException, SAXException, IOException {
           super.setup(resolver, objectModel, src, par);
  -        this.request = (Request) objectModel.get(Constants.REQUEST_OBJECT);
  -        this.response = (Response) objectModel.get(Constants.RESPONSE_OBJECT);
  +        this.request = ObjectModelHelper.getRequest(objectModel);
  +        this.response = ObjectModelHelper.getResponse(objectModel);
   
           this.inputSource = this.resolver.resolve(super.source);
   
  
  
  
  1.3.2.1   +22 -34    xml-cocoon2/src/scratchpad/src/org/apache/cocoon/reading/ImageReader.java
  
  Index: ImageReader.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/reading/ImageReader.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- ImageReader.java	22 Feb 2002 06:58:03 -0000	1.3
  +++ ImageReader.java	11 Jun 2002 23:54:53 -0000	1.3.2.1
  @@ -50,52 +50,40 @@
   */
   package org.apache.cocoon.reading;
   
  -import java.io.InputStream;
  -import java.io.BufferedInputStream;
  -import java.io.FileInputStream;
  -import java.io.FileOutputStream;
  -import java.io.File;
  -import java.io.OutputStream;
  -import java.io.ByteArrayOutputStream;
  -import java.io.IOException;
  -
  -import java.util.Map;
  -import java.util.Date;
  -
  -import java.awt.geom.AffineTransform;
  -
  -import java.awt.image.Raster;
  -import java.awt.image.WritableRaster;
  -import java.awt.image.AffineTransformOp;
  -
  -import com.sun.image.codec.jpeg.JPEGCodec;
  -import com.sun.image.codec.jpeg.JPEGImageEncoder;
  -import com.sun.image.codec.jpeg.JPEGImageDecoder;
  -import com.sun.image.codec.jpeg.JPEGDecodeParam;
  -import com.sun.image.codec.jpeg.JPEGEncodeParam;
  -import com.sun.image.codec.jpeg.ImageFormatException;
  -
  -import org.apache.avalon.framework.component.Component;
  -import org.apache.avalon.framework.component.ComponentException;
   import org.apache.avalon.framework.component.ComponentManager;
   import org.apache.avalon.framework.component.Composable;
   import org.apache.avalon.framework.parameters.Parameters;
   
  -import org.apache.cocoon.Constants;
   import org.apache.cocoon.ProcessingException;
  -import org.apache.cocoon.ResourceNotFoundException;
   import org.apache.cocoon.caching.CacheValidity;
   import org.apache.cocoon.caching.Cacheable;
   import org.apache.cocoon.caching.TimeStampCacheValidity;
  -import org.apache.cocoon.util.HashUtil;
   import org.apache.cocoon.environment.Context;
  +import org.apache.cocoon.environment.ObjectModelHelper;
   import org.apache.cocoon.environment.Request;
   import org.apache.cocoon.environment.Response;
   import org.apache.cocoon.environment.Source;
   import org.apache.cocoon.environment.SourceResolver;
  +import org.apache.cocoon.util.HashUtil;
   
  +import com.sun.image.codec.jpeg.ImageFormatException;
  +import com.sun.image.codec.jpeg.JPEGCodec;
  +import com.sun.image.codec.jpeg.JPEGDecodeParam;
  +import com.sun.image.codec.jpeg.JPEGImageDecoder;
  +import com.sun.image.codec.jpeg.JPEGImageEncoder;
   import org.xml.sax.SAXException;
   
  +import java.awt.geom.AffineTransform;
  +import java.awt.image.AffineTransformOp;
  +import java.awt.image.Raster;
  +import java.awt.image.WritableRaster;
  +import java.io.ByteArrayOutputStream;
  +import java.io.IOException;
  +import java.io.InputStream;
  +import java.io.OutputStream;
  +import java.util.Date;
  +import java.util.Map;
  +
   /**
    * The <code>ImageReader</code> component is used to serve binary image data
    * in a sitemap pipeline. It makes use of HTTP Headers to determine if
  @@ -137,8 +125,8 @@
       public void setup(SourceResolver resolver, Map objectModel, String src, Parameters
par)
           throws ProcessingException, SAXException, IOException {
           super.setup(resolver, objectModel, src, par);
  -        this.request = (Request) objectModel.get(Constants.REQUEST_OBJECT);
  -        this.response = (Response) objectModel.get(Constants.RESPONSE_OBJECT);
  +        this.request = ObjectModelHelper.getRequest(objectModel);
  +        this.response = ObjectModelHelper.getResponse(objectModel);
           this.width = par.getParameterAsInteger("width", 0);
           this.height = par.getParameterAsInteger("height", 0);
           this.expireTime = par.getParameterAsInteger("expire-time", -1);
  @@ -285,7 +273,7 @@
        * Returns the mime-type of the resource in process.
        */
       public String getMimeType() {
  -        Context ctx = (Context) objectModel.get(Constants.CONTEXT_OBJECT);
  +        Context ctx = ObjectModelHelper.getContext(objectModel);
           return (ctx != null) ? ctx.getMimeType(this.source) : null;
       }
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +14 -11    xml-cocoon2/src/scratchpad/src/org/apache/cocoon/samples/castor/TestBeanAction.java
  
  Index: TestBeanAction.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/samples/castor/TestBeanAction.java,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  --- TestBeanAction.java	7 Mar 2002 16:09:47 -0000	1.1
  +++ TestBeanAction.java	11 Jun 2002 23:54:53 -0000	1.1.2.1
  @@ -1,35 +1,38 @@
   package org.apache.cocoon.samples.castor;
   
  -import java.util.Map;
  -import org.apache.cocoon.environment.Redirector;
  -import org.apache.cocoon.environment.SourceResolver;
   import org.apache.avalon.framework.parameters.Parameters;
  -import org.apache.cocoon.acting.*;
  +
  +import org.apache.cocoon.acting.AbstractAction;
  +import org.apache.cocoon.environment.Context;
  +import org.apache.cocoon.environment.ObjectModelHelper;
  +import org.apache.cocoon.environment.Redirector;
   import org.apache.cocoon.environment.Request;
  -import org.apache.cocoon.Constants;
   import org.apache.cocoon.environment.Session;
  -import org.apache.cocoon.environment.Context;
  +import org.apache.cocoon.environment.SourceResolver;
  +
  +import java.util.Map;
   
   
   public class TestBeanAction extends AbstractAction {
   
     public TestBeanAction() {
     }
  -  public Map act(Redirector redirector, SourceResolver resolver, Map objectmodel, String
src, Parameters param) throws java.lang.Exception {
  -      Request request =(Request)objectmodel.get(Constants.REQUEST_OBJECT);
  -      Context context = (Context)objectmodel.get(Constants.CONTEXT_OBJECT);
  +
  +  public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String
src, Parameters param) throws java.lang.Exception {
  +      Request request = ObjectModelHelper.getRequest(objectModel);
  +      Context context = ObjectModelHelper.getContext(objectModel);
         if(context != null)
           request.setAttribute("Wale",new  TestBean("Wale in the big sea","context"));
   
         Session session =request.getSession(true);
         session.setAttribute("Mouse",new  TestBean("Liveing in the session","session"));
  -      objectmodel.put("Lion", new TestBean("Lion:walking on the sitemap","sitemap") );
  +      objectModel.put("Lion", new TestBean("Lion:walking on the sitemap","sitemap") );
         request.setAttribute("Hamster",new TestBean("Hamster:Wer hat nach mir gefragt","request")
 );
         session.setAttribute("Elefant",new  TestBean("Elefant:from Africa","session"));
         request.setAttribute("Elefant",new  TestBean("Elefant:from India","request"));
   
   
  -      return objectmodel;
  +      return objectModel;
   
     }
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +10 -10    xml-cocoon2/src/scratchpad/src/org/apache/cocoon/samples/xmlform/Attic/FormBinderAction.java
  
  Index: FormBinderAction.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/samples/xmlform/Attic/FormBinderAction.java,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  --- FormBinderAction.java	4 Apr 2002 12:28:49 -0000	1.1
  +++ FormBinderAction.java	11 Jun 2002 23:54:53 -0000	1.1.2.1
  @@ -1,23 +1,23 @@
   package org.apache.cocoon.samples.xmlform;
   
  -import java.util.Map;
  -import org.apache.cocoon.environment.Redirector;
  -import org.apache.cocoon.environment.SourceResolver;
   import org.apache.avalon.framework.parameters.Parameters;
  -import org.apache.cocoon.acting.*;
  +
  +import org.apache.cocoon.acting.AbstractAction;
  +import org.apache.cocoon.environment.ObjectModelHelper;
  +import org.apache.cocoon.environment.Redirector;
   import org.apache.cocoon.environment.Request;
  -import org.apache.cocoon.Constants;
   import org.apache.cocoon.environment.Session;
  -import org.apache.cocoon.environment.Context;
  -
  +import org.apache.cocoon.environment.SourceResolver;
   import org.apache.cocoon.xmlform.FormBeanBinder;
   
  +import java.util.Map;
  +
   public class FormBinderAction extends AbstractAction {
   
     public FormBinderAction() {
     }
  -  public Map act(Redirector redirector, SourceResolver resolver, Map objectmodel, String
src, Parameters param) throws java.lang.Exception {
  -      Request request =(Request)objectmodel.get(Constants.REQUEST_OBJECT);
  +  public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String
src, Parameters param) throws java.lang.Exception {
  +      Request request = ObjectModelHelper.getRequest(objectModel);
         Session session = request.getSession();
   
         String formName = "xmlform";
  @@ -36,7 +36,7 @@
           jBean.incrementCount();
           }
   
  -      return objectmodel;
  +      return objectModel;
     }
   }
   
  
  
  
  1.3.2.2   +22 -40    xml-cocoon2/src/scratchpad/src/org/apache/cocoon/samples/xmlform/Attic/ValidatingFormAction.java
  
  Index: ValidatingFormAction.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/samples/xmlform/Attic/ValidatingFormAction.java,v
  retrieving revision 1.3.2.1
  retrieving revision 1.3.2.2
  diff -u -r1.3.2.1 -r1.3.2.2
  --- ValidatingFormAction.java	24 May 2002 09:06:54 -0000	1.3.2.1
  +++ ValidatingFormAction.java	11 Jun 2002 23:54:53 -0000	1.3.2.2
  @@ -62,43 +62,28 @@
    */
   package org.apache.cocoon.samples.xmlform;
   
  +import org.apache.avalon.framework.parameters.Parameters;
   
  -// Java classes
  -import java.util.Map;
  -import java.util.HashMap;
  -import java.util.SortedSet;
  -import java.util.Iterator;
  -import java.util.Properties;
  -import java.io.InputStream;
  -import java.io.FileInputStream;
  -import java.io.File;
  -
  -// XML classes
  -import javax.xml.transform.stream.StreamSource;
  -import javax.xml.transform.TransformerException;
  -import org.xml.sax.InputSource;
  -import org.w3c.dom.Node;
  -import org.w3c.dom.NodeList;
  -
  -// Cocoon classes
  +import org.apache.cocoon.acting.AbstractAction;
  +import org.apache.cocoon.environment.ObjectModelHelper;
   import org.apache.cocoon.environment.Redirector;
  -import org.apache.cocoon.environment.SourceResolver;
  -import org.apache.avalon.framework.parameters.Parameters;
  -import org.apache.cocoon.acting.*;
   import org.apache.cocoon.environment.Request;
  -import org.apache.cocoon.Constants;
   import org.apache.cocoon.environment.Session;
  -import org.apache.cocoon.environment.Context;
  -
  -// Schematron classes
  -import org.apache.cocoon.validation.SchemaFactory;
  +import org.apache.cocoon.environment.SourceResolver;
   import org.apache.cocoon.validation.Schema;
  +import org.apache.cocoon.validation.SchemaFactory;
   import org.apache.cocoon.validation.Validator;
  -import org.apache.cocoon.validation.Violation;
  -
  -// Cocoon Form
  -import org.apache.cocoon.xmlform.FormBeanBinder;
   import org.apache.cocoon.xmlform.Form;
  +import org.apache.cocoon.xmlform.FormBeanBinder;
  +
  +import org.xml.sax.InputSource;
  +
  +import java.io.File;
  +import java.io.FileInputStream;
  +import java.io.InputStream;
  +import java.util.HashMap;
  +import java.util.Map;
  +import java.util.SortedSet;
   
   /**
    * This simple action demonstrates binding between
  @@ -128,7 +113,7 @@
     
     
     public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String
src, Parameters param) throws java.lang.Exception {
  -      Request request =(Request)objectModel.get(Constants.REQUEST_OBJECT);
  +      Request request = ObjectModelHelper.getRequest(objectModel);
         Session session = request.getSession();
   
         // initialize validator if necessary
  @@ -223,9 +208,6 @@
    
     /**
      * validates a bean 
  -   *
  -   * @param formBean the bean to be validated
  -   * @param phase the validation phase
      */
     protected synchronized SortedSet validate( Map objectModel, Form form )
     {
  @@ -233,10 +215,10 @@
     }
     
   
  -    /**
  +  /**
      * validates a bean 
      *
  -   * @param formBean the bean to be validated
  +   * @param form the bean to be validated
      * @param phase the validation phase
      */
     protected synchronized SortedSet validate( Map objectModel, Form form, String phase )
  @@ -256,7 +238,7 @@
         if (violations != null)
         {
           form.setViolation( violations );
  -        //Request request =(Request)objectModel.get(Constants.REQUEST_OBJECT);
  +        //Request request = ObjectModelHelper.getRequest(objectModel);
         }
       return violations;
     }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +35 -40    xml-cocoon2/src/scratchpad/src/org/apache/cocoon/transformation/CastorTransformer.java
  
  Index: CastorTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/transformation/CastorTransformer.java,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  --- CastorTransformer.java	7 Mar 2002 16:09:47 -0000	1.1
  +++ CastorTransformer.java	11 Jun 2002 23:54:53 -0000	1.1.2.1
  @@ -1,32 +1,28 @@
   package org.apache.cocoon.transformation;
   
  -import org.apache.cocoon.environment.SourceResolver;
  -import java.util.Map;
  +import org.apache.avalon.framework.configuration.Configurable;
  +import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.parameters.Parameters;
  -import org.apache.cocoon.transformation.*;
  -import org.apache.cocoon.xml.*;
  +
  +import org.apache.cocoon.environment.Context;
   import org.apache.cocoon.environment.Request;
  -import org.apache.cocoon.Constants;
   import org.apache.cocoon.environment.Session;
  +import org.apache.cocoon.environment.SourceResolver;
  +import org.apache.cocoon.environment.ObjectModelHelper;
   
  -import org.exolab.castor.xml.*;
   import org.exolab.castor.mapping.Mapping;
   import org.exolab.castor.mapping.MappingException;
  -
  -
  -import org.xml.sax.HandlerBase;
  +import org.exolab.castor.xml.Marshaller;
   import org.xml.sax.AttributeList;
   import org.xml.sax.Attributes;
  -import org.xml.sax.helpers.AttributesImpl;
  -import org.xml.sax.helpers.AttributeListImpl;
  +import org.xml.sax.HandlerBase;
   import org.xml.sax.SAXException;
  -import org.xml.sax.Attributes;
  -import java.util.HashMap;
  -import java.io.File;
  +import org.xml.sax.helpers.AttributesImpl;
  +
   import java.io.IOException;
  -import org.apache.avalon.framework.configuration.Configuration;
  -import org.apache.avalon.framework.configuration.Configurable;
  -import org.apache.cocoon.environment.Context;
  +import java.util.HashMap;
  +import java.util.Map;
  +
   /**
    * Description: Marshals a object from the Sitemap, Session, Request or
    * the Conext into a series of SAX events
  @@ -59,29 +55,28 @@
    * Author <a href="mailto:mauch@imkenberg.de">Thorsten Mauch</a>
    *
    */
  -
   public class CastorTransformer extends AbstractTransformer implements Configurable {
  -  private static String CASTOR_URI="http://castor.exolab.org/cocoontransfomer";
  -  private boolean in_castor_element = false;
  -  final static String CMD_INSERT_BEAN="InsertBean";
  -  final static String ATTRIB_NAME=  "name";
  -  final static String ATTRIB_SCOPE=  "scope";
  -  final static String VALUE_SITEMAP ="sitemap";
  -  final static String VALUE_SESSION ="session";
  -  final static String VALUE_REQUEST ="request";
  -  final static String VALUE_CONTEXT ="context";
  -
  -  final static String MAPPING_CONFIG ="mapping";
  -  private final static String FILE_PREFIX="file:";
  -
  -  private HandlerBase CastorEventAdapter;
  -  private Map objectModel;
  -  // stores all used mappings in the cache
  -  private static HashMap mappingCache;
  -  private String defaultmapping="castor/mapping.xml";
  -  private SourceResolver resolver;
  +    private static String CASTOR_URI="http://castor.exolab.org/cocoontransfomer";
  +    private boolean in_castor_element = false;
  +    final static String CMD_INSERT_BEAN="InsertBean";
  +    final static String ATTRIB_NAME=  "name";
  +    final static String ATTRIB_SCOPE=  "scope";
  +    final static String VALUE_SITEMAP ="sitemap";
  +    final static String VALUE_SESSION ="session";
  +    final static String VALUE_REQUEST ="request";
  +    final static String VALUE_CONTEXT ="context";
  +
  +    final static String MAPPING_CONFIG ="mapping";
  +    private final static String FILE_PREFIX="file:";
  +
  +    private HandlerBase CastorEventAdapter;
  +    private Map objectModel;
  +    // stores all used mappings in the cache
  +    private static HashMap mappingCache;
  +    private String defaultmapping="castor/mapping.xml";
  +    private SourceResolver resolver;
   
  -  public CastorTransformer() {
  +    public CastorTransformer() {
   
       /**
        * Inner class eventhandler, forward the Castor SAX events
  @@ -154,7 +149,7 @@
           String mapping = attr.getValue("mapping");
           Object toInsert;
   
  -        Request request =(Request)objectModel.get(Constants.REQUEST_OBJECT);
  +        Request request = ObjectModelHelper.getRequest(objectModel);
   
           if(name == null){
               getLogger().error("attribut to insert not set");
  @@ -192,7 +187,7 @@
               }
             }
             if(sourcemap == null || VALUE_CONTEXT.equals(sourcemap)){
  -            Context context = (Context)objectModel.get(Constants.CONTEXT_OBJECT );
  +            Context context = ObjectModelHelper.getContext(objectModel);
               if(context != null){
                 toInsert=context.getAttribute(name);
                 if(toInsert != null){
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.7.2.1   +7 -15     xml-cocoon2/src/scratchpad/src/org/apache/cocoon/transformation/pagination/Paginator.java
  
  Index: Paginator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/transformation/pagination/Paginator.java,v
  retrieving revision 1.7
  retrieving revision 1.7.2.1
  diff -u -r1.7 -r1.7.2.1
  --- Paginator.java	29 Mar 2002 20:12:08 -0000	1.7
  +++ Paginator.java	11 Jun 2002 23:54:54 -0000	1.7.2.1
  @@ -51,41 +51,33 @@
   
   package org.apache.cocoon.transformation.pagination;
   
  -import java.io.IOException;
  -import java.util.HashMap;
  -import java.util.Iterator;
  -import java.util.Map;
  -
   import org.apache.avalon.framework.activity.Disposable;
   import org.apache.avalon.framework.component.Component;
  -import org.apache.avalon.framework.component.ComponentException;
   import org.apache.avalon.framework.component.ComponentManager;
   import org.apache.avalon.framework.component.Composable;
   import org.apache.avalon.framework.parameters.Parameters;
  -import org.apache.avalon.excalibur.pool.Poolable;
   
  -import org.apache.cocoon.Constants;
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.caching.CacheValidity;
   import org.apache.cocoon.caching.Cacheable;
   import org.apache.cocoon.caching.CompositeCacheValidity;
  -import org.apache.cocoon.caching.ParametersCacheValidity;
   import org.apache.cocoon.caching.TimeStampCacheValidity;
   import org.apache.cocoon.components.parser.Parser;
   import org.apache.cocoon.components.store.Store;
  +import org.apache.cocoon.environment.ObjectModelHelper;
   import org.apache.cocoon.environment.Request;
   import org.apache.cocoon.environment.Source;
   import org.apache.cocoon.environment.SourceResolver;
  -import org.apache.cocoon.util.HashUtil;
  -import org.apache.cocoon.xml.ContentHandlerWrapper;
  -import org.apache.cocoon.xml.XMLConsumer;
   import org.apache.cocoon.transformation.AbstractTransformer;
  +import org.apache.cocoon.util.HashUtil;
   
   import org.xml.sax.Attributes;
   import org.xml.sax.SAXException;
  -import org.xml.sax.helpers.DefaultHandler;
   import org.xml.sax.helpers.AttributesImpl;
   
  +import java.io.IOException;
  +import java.util.Map;
  +
   /**
    * A paginating transformer.
    *
  @@ -169,7 +161,7 @@
           this.itemGroup = par.getParameter("item-group", "");
           getLogger().debug("Paginating with [page = " + this.page + ", item = " + this.item
+ ", item-group = " + this.itemGroup + "]");
   
  -        this.request = (Request) objectModel.get(Constants.REQUEST_OBJECT);
  +        this.request = ObjectModelHelper.getRequest(objectModel);
           this.requestURI = request.getRequestURI();
   
           // Get the pagesheet factory from the Store if available,
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message