cziegeler    02/05/02 05:52:58

  Modified:    .        changes.xml
               src/java/org/apache/cocoon/components/xscript
                        XScriptManager.java XScriptObjectFromURL.java
               src/scratchpad/src/org/apache/cocoon/acting/modular
                        DatabaseAction.java
  Log:
  Removed some dependencies to deprecated code
  
  Revision  Changes    Path
  1.153     +5 -1      xml-cocoon2/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/changes.xml,v
  retrieving revision 1.152
  retrieving revision 1.153
  diff -u -r1.152 -r1.153
  --- changes.xml       29 Apr 2002 07:36:03 -0000      1.152
  +++ changes.xml       2 May 2002 12:52:58 -0000       1.153
  @@ -4,7 +4,7 @@
   
   <!--
     History of Cocoon changes
  -  $Id: changes.xml,v 1.152 2002/04/29 07:36:03 cziegeler Exp $
  +  $Id: changes.xml,v 1.153 2002/05/02 12:52:58 cziegeler Exp $
   -->
   
   <changes title="History of Changes">
  @@ -37,6 +37,10 @@
    </devs>
   
    <release version="@version@" date="@date@">
  +  <action dev="CZ" type="add">
  +    Integrated the new Avalon Excalibur XSLT Processor. This deprecates the 
  +    Cocoon version.
  +  </action>
     <action dev="CH" type="add">
      New documents on databases and Cocoon, database actions and modules.
     </action>
  
  
  
  1.5       +1 -3      
xml-cocoon2/src/java/org/apache/cocoon/components/xscript/XScriptManager.java
  
  Index: XScriptManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/xscript/XScriptManager.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XScriptManager.java       22 Feb 2002 07:00:15 -0000      1.4
  +++ XScriptManager.java       2 May 2002 12:52:58 -0000       1.5
  @@ -50,15 +50,13 @@
   */
   package org.apache.cocoon.components.xscript;
   
  -import org.apache.avalon.framework.component.ComponentManager;
  -
   /**
    * <code>XScriptManager</code> is the public interface used to
    * interact with the XScript component, which implements the
    * supporting code for the XScript language.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Ovidiu Predescu</a>
  - * @version CVS $Id: XScriptManager.java,v 1.4 2002/02/22 07:00:15 cziegeler Exp $
  + * @version CVS $Id: XScriptManager.java,v 1.5 2002/05/02 12:52:58 cziegeler Exp $
    * @since August  4, 2001
    */
   public interface XScriptManager
  
  
  
  1.7       +66 -65    
xml-cocoon2/src/java/org/apache/cocoon/components/xscript/XScriptObjectFromURL.java
  
  Index: XScriptObjectFromURL.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/xscript/XScriptObjectFromURL.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XScriptObjectFromURL.java 14 Apr 2002 00:45:29 -0000      1.6
  +++ XScriptObjectFromURL.java 2 May 2002 12:52:58 -0000       1.7
  @@ -55,7 +55,9 @@
   import java.io.InputStream;
   import java.io.IOException;
   
  -import org.apache.cocoon.components.url.URLFactory;
  +import org.apache.excalibur.source.Source;
  +import org.apache.excalibur.source.SourceException;
  +import org.apache.excalibur.source.SourceResolver;
   import org.apache.cocoon.ProcessingException;
   import org.apache.avalon.framework.component.ComponentException;
   
  @@ -63,72 +65,71 @@
    * An <code>XScriptObject</code> created from the contents of a URL.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Ovidiu Predescu</a>
  - * @version CVS $Id: XScriptObjectFromURL.java,v 1.6 2002/04/14 00:45:29 vgritsenko 
Exp $
  + * @version CVS $Id: XScriptObjectFromURL.java,v 1.7 2002/05/02 12:52:58 cziegeler 
Exp $
    * @since August 30, 2001
    */
   public class XScriptObjectFromURL extends XScriptObject
   {
  -  /**
  -   * The content obtained from this URL becomes the content of this
  -   * instance.
  -   */
  -  String systemId;
  -
  -  /**
  -   * The content length.
  -   */
  -  int contentLength;
  -
  -  /**
  -   * When was the content of the URL last modified.
  -   */
  -  long lastModified;
  -
  -  public XScriptObjectFromURL(XScriptManager manager, String systemId)
  -  {
  -    super(manager);
  -    this.systemId = systemId;
  -  }
  -
  -  public InputStream getInputStream()
  -    throws ProcessingException, IOException
  -  {
  -    try {
  -      URLFactory urlFactory = (URLFactory)componentManager.lookup(URLFactory.ROLE);
  -      URL url = urlFactory.getURL(systemId);
  -      URLConnection conn = url.openConnection();
  -      InputStream is = conn.getInputStream();
  -      contentLength = conn.getContentLength();
  -      componentManager.release(urlFactory);
  -
  -      return is;
  -    } catch (ComponentException ex) {
  -      throw new ProcessingException(ex);
  -    }
  -  }
  -
  -  public long getContentLength()
  -  {
  -    return contentLength;
  -  }
  -
  -  public long getLastModified()
  -  {
  -    return lastModified;
  -  }
  -
  -  public String getSystemId()
  -  {
  -    // FIXME: generate a real system id to represent this object
  -    return "xscript:url:" + systemId;
  -  }
  -
  -  public void recycle()
  -  {
  -  }
  -
  -  public String toString()
  -  {
  -    return new StringBuffer("XScriptObjectFromURL(systemId = 
").append(systemId).append(")").toString();
  -  }
  +    /**
  +     * The content obtained from this URL becomes the content of this
  +     * instance.
  +    */
  +    String systemId;
  +
  +    /**
  +     * The content length.
  +     */
  +    int contentLength;
  +
  +    /**
  +     * When was the content of the URL last modified.
  +     */
  +    long lastModified;
  +
  +
  +    public XScriptObjectFromURL(XScriptManager manager, String systemId) {
  +        super(manager);
  +        this.systemId = systemId;
  +    }
  +
  +    public InputStream getInputStream()
  +    throws ProcessingException, IOException {
  +        SourceResolver resolver = null;
  +        Source source = null;
  +        try {
  +            resolver = (SourceResolver)componentManager.lookup(SourceResolver.ROLE);
  +            source = resolver.resolveURI( this.systemId );
  +
  +            return source.getInputStream();
  +        } catch (SourceException ex) {
  +            throw new ProcessingException(ex);
  +        } catch (ComponentException ex) {
  +            throw new ProcessingException(ex);
  +        } finally {
  +            if (resolver != null) {
  +                resolver.release(source);
  +                componentManager.release( resolver );
  +            }
  +        }
  +    }
  +
  +    public long getContentLength() {
  +        return -1;
  +    }
  +
  +    public long getLastModified() {
  +        return 0;
  +    }
  +
  +    public String getSystemId() {
  +        // FIXME: generate a real system id to represent this object
  +        return "xscript:url:" + systemId;
  +    }
  +
  +    public void recycle() {
  +    }
  +
  +    public String toString() {
  +        return new StringBuffer("XScriptObjectFromURL(systemId = 
").append(systemId).append(")").toString();
  +    }
   }
  
  
  
  1.3       +23 -24    
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/acting/modular/DatabaseAction.java
  
  Index: DatabaseAction.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/acting/modular/DatabaseAction.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DatabaseAction.java       28 Apr 2002 20:02:22 -0000      1.2
  +++ DatabaseAction.java       2 May 2002 12:52:58 -0000       1.3
  @@ -95,7 +95,6 @@
   import org.apache.cocoon.Constants;
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.components.classloader.RepositoryClassLoader;
  -import org.apache.cocoon.components.url.URLFactory;
   import org.apache.cocoon.environment.ObjectModelHelper;
   import org.apache.cocoon.environment.Request;
   import org.apache.cocoon.environment.Redirector;
  @@ -142,7 +141,7 @@
    * </table>
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Christian Haul</a>
  - * @version CVS $Id: DatabaseAction.java,v 1.2 2002/04/28 20:02:22 haul Exp $
  + * @version CVS $Id: DatabaseAction.java,v 1.3 2002/05/02 12:52:58 cziegeler Exp $
    * @see org.apache.cocoon.modules.input
    * @see org.apache.cocoon.modules.output
    * @see org.apache.cocoon.modules.database
  @@ -244,7 +243,7 @@
   
   
   
  -    // set up default modes 
  +    // set up default modes
       // <input/>
       // <output/>
       // <autoincrement/>
  @@ -295,7 +294,7 @@
           OutputModule output = null;
           String outputMode = null;
           try {
  -            outputSelector=(ComponentSelector) 
this.manager.lookup(OUTPUT_MODULE_SELECTOR); 
  +            outputSelector=(ComponentSelector) 
this.manager.lookup(OUTPUT_MODULE_SELECTOR);
               outputMode = (String) request.getAttribute(ATTRIBUTE_KEY);
               if (outputMode != null && outputSelector != null && 
outputSelector.hasComponent(outputMode)){
                   output = (OutputModule) outputSelector.select(outputMode);
  @@ -309,7 +308,7 @@
                                  + ":" + e.getMessage() );
           } finally {
               if (outputSelector != null) {
  -                if (output != null) 
  +                if (output != null)
                       outputSelector.release(output);
                   this.manager.release(outputSelector);
               }
  @@ -353,7 +352,7 @@
           // read global parameter settings
           boolean reloadable = Constants.DESCRIPTOR_RELOADABLE_DEFAULT;
           Request request = ObjectModelHelper.getRequest(objectModel);
  -            
  +
           // call specific default modes apart from output mode are not supported
           // set request attribute
           String outputMode = param.getParameter("output", (String) 
defaultModeNames.get(MODE_OUTPUT));
  @@ -368,7 +367,7 @@
                   this.getConfiguration(param.getParameter("descriptor", (String) 
this.settings.get("descriptor")),
                                         resolver,
                                         
param.getParameterAsBoolean("reloadable",reloadable));
  -            
  +
               // get database connection and try to turn off autocommit
               datasource = this.getDataSource(conf, param);
               conn = datasource.getConnection();
  @@ -454,7 +453,7 @@
               ComponentSelector outputSelector = null;
               OutputModule output = null;
               try {
  -                outputSelector=(ComponentSelector) 
this.manager.lookup(OUTPUT_MODULE_SELECTOR); 
  +                outputSelector=(ComponentSelector) 
this.manager.lookup(OUTPUT_MODULE_SELECTOR);
                   if (outputMode != null && outputSelector != null && 
outputSelector.hasComponent(outputMode)){
                       output = (OutputModule) outputSelector.select(outputMode);
                   }
  @@ -467,7 +466,7 @@
                                  + ":" + e.getMessage() );
               } finally {
                   if (outputSelector != null) {
  -                    if (output != null) 
  +                    if (output != null)
                           outputSelector.release(output);
                       this.manager.release(outputSelector);
                   }
  @@ -485,7 +484,7 @@
                       ComponentSelector outputSelector = null;
                       OutputModule output = null;
                       try {
  -                        outputSelector=(ComponentSelector) 
this.manager.lookup(OUTPUT_MODULE_SELECTOR); 
  +                        outputSelector=(ComponentSelector) 
this.manager.lookup(OUTPUT_MODULE_SELECTOR);
                           if (outputMode != null && outputSelector != null && 
outputSelector.hasComponent(outputMode)){
                               output = (OutputModule) 
outputSelector.select(outputMode);
                           }
  @@ -498,7 +497,7 @@
                                          + ":" + e2.getMessage() );
                       } finally {
                           if (outputSelector != null) {
  -                            if (output != null) 
  +                            if (output != null)
                                   outputSelector.release(output);
                               this.manager.release(outputSelector);
                           }
  @@ -546,7 +545,7 @@
           }
   
           return (results == null? results : Collections.unmodifiableMap(results));
  -    } 
  +    }
   
   
   
  @@ -567,7 +566,7 @@
           try {
               LookUpKey luk = new LookUpKey(table, modeTypes);
               CacheHelper queryData = null;
  -            
  +
               getLogger().debug("modeTypes : "+ modeTypes);
   
               // get cached data
  @@ -684,12 +683,12 @@
           } else {
               Object[] values;
               String cname = getOutputName( tableConf, column.columnConf );
  -            
  +
               // obtain input module and read values
               ComponentSelector inputSelector = null;
               InputModule input = null;
               try {
  -                inputSelector=(ComponentSelector) 
this.manager.lookup(INPUT_MODULE_SELECTOR); 
  +                inputSelector=(ComponentSelector) 
this.manager.lookup(INPUT_MODULE_SELECTOR);
                   if (column.mode != null && inputSelector != null && 
inputSelector.hasComponent(column.mode)){
                       input = (InputModule) inputSelector.select(column.mode);
                   }
  @@ -714,12 +713,12 @@
   
               } finally {
                   if (inputSelector != null) {
  -                    if (input != null) 
  +                    if (input != null)
                           inputSelector.release(input);
                       this.manager.release(inputSelector);
                   }
               }
  -            
  +
               return values;
           }
       }
  @@ -781,11 +780,11 @@
       protected void storeKeyValue( Configuration tableConf, Column key, int 
rowIndex, Connection conn,
                                     Statement statement, Request request, Map results 
)
           throws SQLException, ConfigurationException, ComponentException {
  -        
  +
           ComponentSelector autoincrSelector = null;
           AutoIncrementModule autoincr = null;
           try {
  -            autoincrSelector=(ComponentSelector) 
this.manager.lookup(DATABASE_MODULE_SELECTOR); 
  +            autoincrSelector=(ComponentSelector) 
this.manager.lookup(DATABASE_MODULE_SELECTOR);
               if (key.mode != null && autoincrSelector != null && 
autoincrSelector.hasComponent(key.mode)){
                   autoincr = (AutoIncrementModule) autoincrSelector.select(key.mode);
               }
  @@ -801,12 +800,12 @@
   
           } finally {
               if (autoincrSelector != null) {
  -                if (autoincr != null) 
  +                if (autoincr != null)
                       autoincrSelector.release(autoincr);
                   this.manager.release(autoincrSelector);
               }
            }
  -        
  +
       }
   
   
  @@ -829,11 +828,11 @@
   
           int columnCount = 0;
   
  -        
  +
           ComponentSelector autoincrSelector = null;
           AutoIncrementModule autoincr = null;
           try {
  -            autoincrSelector=(ComponentSelector) 
this.manager.lookup(DATABASE_MODULE_SELECTOR); 
  +            autoincrSelector=(ComponentSelector) 
this.manager.lookup(DATABASE_MODULE_SELECTOR);
               if (column.mode != null && autoincrSelector != null && 
autoincrSelector.hasComponent(column.mode)){
                   autoincr = (AutoIncrementModule) 
autoincrSelector.select(column.mode);
               }
  @@ -856,7 +855,7 @@
   
           } finally {
               if (autoincrSelector != null) {
  -                if (autoincr != null) 
  +                if (autoincr != null)
                       autoincrSelector.release(autoincr);
                   this.manager.release(autoincrSelector);
               }
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to