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 CastorTransformer.java
Date Tue, 11 Jun 2002 23:54:54 GMT
vgritsenko    2002/06/11 16:54:54

  Modified:    src/scratchpad/src/org/apache/cocoon/transformation
                        CastorTransformer.java
  Log:
  Use ObjectModelHelper instead of deprecated Constants
  
  Revision  Changes    Path
  1.2       +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.2
  diff -u -r1.1 -r1.2
  --- CastorTransformer.java	7 Mar 2002 16:09:47 -0000	1.1
  +++ CastorTransformer.java	11 Jun 2002 23:54:54 -0000	1.2
  @@ -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){
  
  
  

----------------------------------------------------------------------
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