cziegeler    02/04/26 03:42:17

  Modified:    src/java/org/apache/cocoon Cocoon.java
               src/java/org/apache/cocoon/components/language/markup
                        NamedLogicsheet.java
               src/java/org/apache/cocoon/components/source
                        SourceHandler.java SourceHandlerImpl.java
               src/java/org/apache/cocoon/components/source/impl
                        AvalonToCocoonSource.java
               src/java/org/apache/cocoon/components/treeprocessor
                        TreeProcessor.java
               src/java/org/apache/cocoon/environment
                        AbstractEnvironment.java Environment.java
               src/java/org/apache/cocoon/environment/wrapper
                        EnvironmentWrapper.java
               src/java/org/apache/cocoon/serialization RTFSerializer.java
               src/scratchpad/src/org/apache/cocoon/components/source
                        BlobSource.java
               src/scratchpad/src/org/apache/cocoon/treeprocessor
                        TreeProcessor.java
               src/webapp/WEB-INF cocoon.xconf
  Removed:     src/java/org/apache/cocoon/sitemap AbstractSitemap.java
                        Handler.java Manager.java Sitemap.java
                        SitemapManager.java
  Log:
  Some minor movement to the new source resolving
  
  Revision  Changes    Path
  1.26      +7 -10     xml-cocoon2/src/java/org/apache/cocoon/Cocoon.java
  
  Index: Cocoon.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/Cocoon.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- Cocoon.java       25 Apr 2002 14:53:15 -0000      1.25
  +++ Cocoon.java       26 Apr 2002 10:42:15 -0000      1.26
  @@ -74,14 +74,12 @@
   import org.apache.cocoon.components.pipeline.EventPipeline;
   import org.apache.cocoon.components.pipeline.StreamPipeline;
   import org.apache.cocoon.components.source.DelayedRefreshSourceWrapper;
  -import org.apache.cocoon.components.source.SourceHandler;
   import org.apache.cocoon.components.source.URLSource;
   import org.apache.cocoon.environment.Environment;
   import org.apache.cocoon.environment.ModifiableSource;
   import org.apache.cocoon.environment.ObjectModelHelper;
   import org.apache.cocoon.environment.Request;
   import org.apache.cocoon.environment.Session;
  -import org.apache.cocoon.sitemap.SitemapManager;
   import org.apache.cocoon.util.ClassUtils;
   import org.xml.sax.InputSource;
   
  @@ -99,7 +97,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Pierpaolo Fumagalli</a> (Apache 
Software Foundation, Exoffice Technologies)
    * @author <a href="mailto:[EMAIL PROTECTED]";>Stefano Mazzocchi</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Leo Sutic</a>
  - * @version CVS $Id: Cocoon.java,v 1.25 2002/04/25 14:53:15 cziegeler Exp $
  + * @version CVS $Id: Cocoon.java,v 1.26 2002/04/26 10:42:15 cziegeler Exp $
    */
   public class Cocoon
           extends AbstractLoggable
  @@ -656,6 +654,7 @@
        */
       public void generateSitemap(Environment environment)
       throws Exception {
  +        /**
           Component processor = this.componentManager.lookup(Processor.ROLE);
           try {
               if (processor instanceof SitemapManager) {
  @@ -664,6 +663,7 @@
           } finally {
               this.componentManager.release(processor);
           }
  +        */
       }
   
       /**
  @@ -673,19 +673,18 @@
        * @param environment an <code>Environment</code> value
        * @exception Exception if an error occurs
        */
  -    public void precompile(String fileName, Environment environment, String 
markupLanguage, String programmingLanguage)
  +    public void precompile(String fileName,
  +                           Environment environment,
  +                           String markupLanguage,
  +                           String programmingLanguage)
       throws Exception {
           ProgramGenerator programGenerator = null;
  -        SourceHandler oldSourceHandler = environment.getSourceHandler();
  -        SourceHandler sourceHandler = null;
           try {
               if (getLogger().isDebugEnabled()) {
                   getLogger().debug("XSP generation begin:" + fileName);
               }
   
               programGenerator = (ProgramGenerator) 
this.componentManager.lookup(ProgramGenerator.ROLE);
  -            sourceHandler = (SourceHandler) 
this.componentManager.lookup(SourceHandler.ROLE);
  -            environment.setSourceHandler(sourceHandler);
   
               CompiledComponent xsp = programGenerator.load(this.componentManager, 
fileName, markupLanguage, programmingLanguage, environment);
               if (getLogger().isDebugEnabled()) {
  @@ -696,9 +695,7 @@
               getLogger().error("Main: Error compiling XSP", e);
               throw e;
           } finally {
  -            environment.setSourceHandler(oldSourceHandler);
               this.componentManager.release(programGenerator);
  -            this.componentManager.release(sourceHandler);
           }
       }
   
  
  
  
  1.9       +1 -2      
xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/NamedLogicsheet.java
  
  Index: NamedLogicsheet.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/NamedLogicsheet.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- NamedLogicsheet.java      22 Feb 2002 07:00:08 -0000      1.8
  +++ NamedLogicsheet.java      26 Apr 2002 10:42:16 -0000      1.9
  @@ -51,7 +51,6 @@
   package org.apache.cocoon.components.language.markup;
   
   import org.apache.avalon.framework.component.ComponentManager;
  -import org.apache.cocoon.components.url.URLFactory;
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.environment.SourceResolver;
   
  @@ -68,7 +67,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Ricardo Rocha</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Ovidiu Predescu</a>
  - * @version CVS $Id: NamedLogicsheet.java,v 1.8 2002/02/22 07:00:08 cziegeler Exp $
  + * @version CVS $Id: NamedLogicsheet.java,v 1.9 2002/04/26 10:42:16 cziegeler Exp $
    */
   public class NamedLogicsheet extends Logicsheet {
       /**
  
  
  
  1.4       +3 -1      
xml-cocoon2/src/java/org/apache/cocoon/components/source/SourceHandler.java
  
  Index: SourceHandler.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/source/SourceHandler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SourceHandler.java        22 Feb 2002 07:00:13 -0000      1.3
  +++ SourceHandler.java        26 Apr 2002 10:42:16 -0000      1.4
  @@ -60,8 +60,10 @@
   import java.net.URL;
   
   /**
  + * @deprecated The Avalon Excalibur Source Resolving is now used.
  + *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
  - * @version $Id: SourceHandler.java,v 1.3 2002/02/22 07:00:13 cziegeler Exp $
  + * @version $Id: SourceHandler.java,v 1.4 2002/04/26 10:42:16 cziegeler Exp $
    */
   public interface SourceHandler extends Component {
   
  
  
  
  1.9       +3 -1      
xml-cocoon2/src/java/org/apache/cocoon/components/source/SourceHandlerImpl.java
  
  Index: SourceHandlerImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/source/SourceHandlerImpl.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- SourceHandlerImpl.java    21 Mar 2002 04:51:22 -0000      1.8
  +++ SourceHandlerImpl.java    26 Apr 2002 10:42:16 -0000      1.9
  @@ -78,8 +78,10 @@
   import java.util.Map;
   
   /**
  + * @deprecated The Avalon Excalibur Source Resolving is now used.
  + *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
  - * @version $Id: SourceHandlerImpl.java,v 1.8 2002/03/21 04:51:22 vgritsenko Exp $
  + * @version $Id: SourceHandlerImpl.java,v 1.9 2002/04/26 10:42:16 cziegeler Exp $
    */
   public final class SourceHandlerImpl
   extends AbstractLoggable
  
  
  
  1.3       +6 -2      
xml-cocoon2/src/java/org/apache/cocoon/components/source/impl/AvalonToCocoonSource.java
  
  Index: AvalonToCocoonSource.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/source/impl/AvalonToCocoonSource.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AvalonToCocoonSource.java 25 Apr 2002 09:30:48 -0000      1.2
  +++ AvalonToCocoonSource.java 26 Apr 2002 10:42:16 -0000      1.3
  @@ -54,6 +54,7 @@
   import java.io.InputStream;
   import org.apache.avalon.excalibur.xml.XMLizable;
   import org.apache.excalibur.source.*;
  +import org.apache.excalibur.source.impl.validity.TimeStampValidity;
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.environment.Environment;
   import org.apache.cocoon.environment.ModifiableSource;
  @@ -67,7 +68,7 @@
    * resolve() method of the environment!
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.2 $ $Date: 2002/04/25 09:30:48 $
  + * @version CVS $Revision: 1.3 $ $Date: 2002/04/26 10:42:16 $
    */
   
   public final class AvalonToCocoonSource
  @@ -98,7 +99,10 @@
        * is not possible to determine the date.
        */
       public long getLastModified() {
  -        // We have no possibility to get this!
  +        final SourceValidity validity = this.source.getValidity();
  +        if (validity instanceof TimeStampValidity) {
  +            return ((TimeStampValidity)validity).getTimeStamp();
  +        }
           return 0;
       }
   
  
  
  
  1.6       +2 -22     
xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java
  
  Index: TreeProcessor.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TreeProcessor.java        24 Apr 2002 09:59:48 -0000      1.5
  +++ TreeProcessor.java        26 Apr 2002 10:42:16 -0000      1.6
  @@ -56,7 +56,6 @@
   import org.apache.avalon.excalibur.logger.LogKitManager;
   
   import org.apache.avalon.framework.activity.Disposable;
  -import org.apache.avalon.framework.activity.Initializable;
   
   import org.apache.avalon.framework.component.Component;
   import org.apache.avalon.framework.component.ComponentException;
  @@ -84,9 +83,7 @@
   import org.apache.cocoon.components.LifecycleHelper;
   import org.apache.cocoon.components.pipeline.EventPipeline;
   import org.apache.cocoon.components.pipeline.StreamPipeline;
  -import org.apache.cocoon.components.source.CocoonSourceFactory;
   import org.apache.cocoon.components.source.DelayedRefreshSourceWrapper;
  -import org.apache.cocoon.components.source.SourceHandler;
   import org.apache.cocoon.components.source.URLSource;
   import org.apache.cocoon.components.url.URLFactory;
   import org.apache.cocoon.environment.Environment;
  @@ -99,11 +96,11 @@
    * Interpreted tree-traversal implementation of a pipeline assembly language.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Sylvain Wallez</a>
  - * @version CVS $Id: TreeProcessor.java,v 1.5 2002/04/24 09:59:48 cziegeler Exp $
  + * @version CVS $Id: TreeProcessor.java,v 1.6 2002/04/26 10:42:16 cziegeler Exp $
    */
   
   public class TreeProcessor extends AbstractLoggable implements ThreadSafe, 
Processor,
  -  Composable, Configurable, LogKitManageable, RoleManageable, Initializable, 
Contextualizable, Disposable {
  +  Composable, Configurable, LogKitManageable, RoleManageable, Contextualizable, 
Disposable {
   
       private static final String XCONF_URL =
           
"resource://org/apache/cocoon/components/treeprocessor/treeprocessor-builtins.xml";
  @@ -147,8 +144,6 @@
       /** The current language configuration */
       protected Configuration currentLanguage;
   
  -    protected SourceHandler sourceHandler;
  -
       /**
        * Create a TreeProcessor.
        */
  @@ -190,7 +185,6 @@
   
           TreeProcessor child = new TreeProcessor(this, manager, language);
           child.setLogger(getLogger());
  -        child.initialize();
           // FIXME : make delay configurable
           child.source = new DelayedRefreshSourceWrapper(source, 1000L);
           return child;
  @@ -274,16 +268,6 @@
           }
       }
   
  -    public void initialize() throws Exception {
  -
  -        // Get a new Source handler
  -        this.sourceHandler = (SourceHandler)this.manager.lookup(SourceHandler.ROLE);
  -
  -        // and add the special "cocoon:" source factory
  -        this.sourceHandler.addFactory("cocoon", new CocoonSourceFactory(this, 
this.manager));
  -
  -    }
  -
       public boolean process(Environment environment) throws Exception {
           InvokeContext context = new InvokeContext();
   
  @@ -312,18 +296,15 @@
       protected boolean process(Environment environment, InvokeContext context)
         throws Exception {
   
  -        SourceHandler oldSourceHandler = environment.getSourceHandler();
           CocoonComponentManager.enterEnvironment(environment, 
environment.getObjectModel(), this);
   
           try {
  -            environment.setSourceHandler(this.sourceHandler);
               if (this.rootNode == null || this.source.getLastModified() > 
this.lastModified) {
                   setupRootNode(environment);
               }
               return this.rootNode.invoke(environment, context);
           } finally {
               CocoonComponentManager.leaveEnvironment();
  -            environment.setSourceHandler(oldSourceHandler);
           }
       }
   
  @@ -376,7 +357,6 @@
   
       public void dispose() {
           disposeTree();
  -        this.manager.release(this.sourceHandler);
           if (this.parent == null) {
               // root processor : dispose the builder selector
               this.builderSelector.dispose();
  
  
  
  1.19      +4 -6      
xml-cocoon2/src/java/org/apache/cocoon/environment/AbstractEnvironment.java
  
  Index: AbstractEnvironment.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/environment/AbstractEnvironment.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- AbstractEnvironment.java  26 Apr 2002 08:41:52 -0000      1.18
  +++ AbstractEnvironment.java  26 Apr 2002 10:42:16 -0000      1.19
  @@ -73,7 +73,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Giacomo Pati</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
  - * @version CVS $Id: AbstractEnvironment.java,v 1.18 2002/04/26 08:41:52 cziegeler 
Exp $
  + * @version CVS $Id: AbstractEnvironment.java,v 1.19 2002/04/26 10:42:16 cziegeler 
Exp $
    */
   public abstract class AbstractEnvironment extends AbstractLoggable implements 
Environment {
   
  @@ -98,9 +98,6 @@
       /** The servlet object model */
       protected HashMap objectModel = null;
   
  -    /** The source handler for the current environment */
  -    protected SourceHandler sourceHandler;
  -
       /** The real source resolver */
       protected org.apache.excalibur.source.SourceResolver sourceResolver;
   
  @@ -157,16 +154,17 @@
   
       /**
        * Get the <code>SourceHandler</code> for the current request
  +     * @deprecated Not used anymore (FIXME - This should be removed)
        */
       public SourceHandler getSourceHandler() {
  -        return this.sourceHandler;
  +        return null;
       }
   
       /**
        * Set the <code>SourceHandler</code> for the current request
  +     * @deprecated Not used anymore (FIXME - This should be removed)
        */
       public void setSourceHandler(SourceHandler sourceHandler) {
  -        this.sourceHandler = sourceHandler;
       }
   
       /**
  
  
  
  1.10      +3 -1      
xml-cocoon2/src/java/org/apache/cocoon/environment/Environment.java
  
  Index: Environment.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/environment/Environment.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Environment.java  25 Apr 2002 09:37:01 -0000      1.9
  +++ Environment.java  26 Apr 2002 10:42:16 -0000      1.10
  @@ -63,7 +63,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Giacomo Pati</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
  - * @version CVS $Id: Environment.java,v 1.9 2002/04/25 09:37:01 cziegeler Exp $
  + * @version CVS $Id: Environment.java,v 1.10 2002/04/26 10:42:16 cziegeler Exp $
    */
   
   public interface Environment
  @@ -71,11 +71,13 @@
   
       /**
        * Get the <code>SourceHandler</code> for the current request
  +     * @deprecated Not used anymore (FIXME - This should be removed)
        */
       SourceHandler getSourceHandler();
   
       /**
        * Set the <code>SourceHandler</code> for the current request
  +     * @deprecated Not used anymore (FIXME - This should be removed)
        */
       void setSourceHandler(SourceHandler sourceHandler);
   
  
  
  
  1.15      +1 -2      
xml-cocoon2/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java
  
  Index: EnvironmentWrapper.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- EnvironmentWrapper.java   26 Apr 2002 08:41:52 -0000      1.14
  +++ EnvironmentWrapper.java   26 Apr 2002 10:42:17 -0000      1.15
  @@ -73,7 +73,7 @@
    * contains a <code>RequestWrapper</code> object.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
  - * @version $Id: EnvironmentWrapper.java,v 1.14 2002/04/26 08:41:52 cziegeler Exp $
  + * @version $Id: EnvironmentWrapper.java,v 1.15 2002/04/26 10:42:17 cziegeler Exp $
    */
   public class EnvironmentWrapper extends AbstractEnvironment implements Environment {
   
  @@ -131,7 +131,6 @@
           this.context = env.getContext();
           this.prefix = new StringBuffer(env.getURIPrefix());
   
  -        this.setSourceHandler(env.getSourceHandler());
           // create new object model and replace the request object
           this.objectModel = new HashMap(4);
           Map oldObjectModel = env.getObjectModel();
  
  
  
  1.6       +1 -3      
xml-cocoon2/src/java/org/apache/cocoon/serialization/RTFSerializer.java
  
  Index: RTFSerializer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/serialization/RTFSerializer.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- RTFSerializer.java        22 Feb 2002 07:03:55 -0000      1.5
  +++ RTFSerializer.java        26 Apr 2002 10:42:17 -0000      1.6
  @@ -56,8 +56,6 @@
   import org.apache.avalon.framework.component.ComponentManager;
   import org.apache.avalon.framework.component.Composable;
   
  -import org.apache.cocoon.components.url.URLFactory;
  -
   import org.apache.log.Priority;
   import org.apache.log.util.OutputStreamLogger;
   
  @@ -80,7 +78,7 @@
    * to serialize XSL:FO documents to RTF streams.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Gianugo Rabellino</a>
  - * @version CVS $Id: RTFSerializer.java,v 1.5 2002/02/22 07:03:55 cziegeler Exp $
  + * @version CVS $Id: RTFSerializer.java,v 1.6 2002/04/26 10:42:17 cziegeler Exp $
    */
   
   public class RTFSerializer extends AbstractTextSerializer
  
  
  
  1.3       +43 -47    
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/BlobSource.java
  
  Index: BlobSource.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/BlobSource.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BlobSource.java   3 Apr 2002 12:22:11 -0000       1.2
  +++ BlobSource.java   26 Apr 2002 10:42:17 -0000      1.3
  @@ -86,64 +86,60 @@
    * <p>For example, "<code>blob:/personel/people/photo[userid='foo']</code>"
    * will fetch the first column returned by the statement "<code>SELECT photo
    * from people where userid='foo'</code>" in the datasource "<code>personel</code>"
  - * 
  + *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Sylvain Wallez</a>
  - * @version $Id: BlobSource.java,v 1.2 2002/04/03 12:22:11 sylvain Exp $
  + * @version $Id: BlobSource.java,v 1.3 2002/04/26 10:42:17 cziegeler Exp $
    */
   
   public class BlobSource extends AbstractStreamSource {
  -    
  +
       /**
        * The system ID for this source
        */
       private String systemId;
  -    
  +
       private String datasourceName;
  -    
  +
       private String tableName;
  -    
  +
       private String columnName;
  -    
  +
       private String condition;
  -    
  +
       private final static String URL_PREFIX = "blob:/";
       private final static int URL_PREFIX_LEN = URL_PREFIX.length();
  -    
  +
       /**
        * Create a file source from a 'blob:' url and a component manager.
        * <p>The url is of the form "blob:/datasource/table/column[condition]
        */
       public BlobSource(String url, ComponentManager manager) throws 
MalformedURLException {
  -        
  +
           super(manager);
  -        
  -        if (!url.startsWith("blob:/")) {
  -            throw new MalformedURLException("Malformed url for a blob source : " + 
url);
  -        }
  -        
  +
           this.systemId = url;
  -        
  +
           // Parse the url
           int start = URL_PREFIX_LEN;
           int end;
  -        
  +
           // Datasource
           end = url.indexOf('/', start);
           if (end == -1) {
               throw new MalformedURLException("Malformed blob source (cannot find 
datasource) : " + url);
           }
  -        
  +
           this.datasourceName = url.substring(start, end);
  -        
  +
           // Table
           start = end + 1;
           end = url.indexOf('/', start);
           if (end == -1) {
               throw new MalformedURLException("Malformed blob source (cannot find 
table name) : " + url);
           }
  -        
  +
           this.tableName = url.substring(start, end);
  -        
  +
           // Column
           start = end + 1;
           end = url.indexOf('[', start);
  @@ -151,7 +147,7 @@
               this.columnName = url.substring(start);
           } else {
               this.columnName = url.substring(start, end);
  -            
  +
               // Condition
               start = end + 1;
               end = url.length() - 1;
  @@ -183,39 +179,39 @@
   
           Connection cnx = null;
           Statement stmt = null;
  -        
  +
           try {
               cnx = getConnection();
               stmt = cnx.createStatement();
  -        
  +
               StringBuffer selectBuf = new StringBuffer("SELECT 
").append(this.columnName).
                   append(" FROM ").append(this.tableName);
  -            
  +
               if (this.condition != null) {
                   selectBuf.append(" WHERE ").append(this.condition);
               }
  -            
  +
               String select = selectBuf.toString();
               if (getLogger().isDebugEnabled()) {
                   getLogger().debug("Executing statement " + select);
               }
  -            
  +
               ResultSet rs = stmt.executeQuery(select);
               rs.next();
  -            
  +
               int colType = rs.getMetaData().getColumnType(1);
  -            
  +
               switch(colType) {
                   case Types.BLOB :
                       Blob blob = rs.getBlob(1);
                       return new JDBCInputStream(blob.getBinaryStream(), cnx);
                   //break;
  -                
  +
                   case Types.CLOB :
                       Clob clob = rs.getClob(1);
                       return new JDBCInputStream(clob.getAsciiStream(), cnx);
                   //break;
  -                
  +
                   default :
                       String value = rs.getString(1);
                       stmt.close();
  @@ -226,7 +222,7 @@
           } catch(SQLException sqle) {
               String msg = "Cannot retrieve content from " + this.systemId;
               getLogger().error(msg, sqle);
  -            
  +
               try {
                   if (cnx != null) {
                       cnx.close();
  @@ -240,7 +236,7 @@
               throw new ProcessingException(msg, sqle);
           }
       }
  -    
  +
       private Connection getConnection() throws ProcessingException {
   
           ComponentSelector selector = null;
  @@ -249,15 +245,15 @@
           try {
               try {
                   selector = 
(ComponentSelector)this.manager.lookup(DataSourceComponent.ROLE + "Selector");
  -                    
  +
                   datasource = 
(DataSourceComponent)selector.select(this.datasourceName);
  -    
  +
               } catch(Exception e) {
                   String msg = "Cannot get datasource '" + this.datasourceName + "'";
                   getLogger().error(msg);
                   throw new ProcessingException(msg, e);
               }
  -            
  +
               try {
                   return datasource.getConnection();
               } catch(Exception e) {
  @@ -272,15 +268,15 @@
               }
           }
       }
  -        
  +
       /**
        * An OutputStream that will close the connection that created it on
        * close.
        */
       private class JDBCInputStream extends FilterInputStream {
  -        
  +
           Connection cnx;
  -        
  +
           private final void closeCnx() throws IOException {
               if (this.cnx != null) {
                   try {
  @@ -294,7 +290,7 @@
                   }
               }
           }
  -        
  +
           public JDBCInputStream(InputStream stream, Connection cnx) {
               super(stream);
               this.cnx = cnx;
  @@ -311,8 +307,8 @@
                   closeCnx();
                   throw e;
               }
  -        }        
  -        
  +        }
  +
           public int read(byte[] b) throws IOException {
               try {
                   int result = in.read(b);
  @@ -324,8 +320,8 @@
                   closeCnx();
                   throw e;
               }
  -        }        
  -        
  +        }
  +
           public int read(byte[] b, int off, int len) throws IOException {
               try {
                   int result = in.read(b, off, len);
  @@ -337,12 +333,12 @@
                   closeCnx();
                   throw e;
               }
  -        }        
  -        
  +        }
  +
           public void close() throws IOException {
               super.close();
               closeCnx();
           }
       }
   }
  -    
  +
  
  
  
  1.12      +7 -4      
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/TreeProcessor.java
  
  Index: TreeProcessor.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/treeprocessor/TreeProcessor.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- TreeProcessor.java        5 Mar 2002 08:26:24 -0000       1.11
  +++ TreeProcessor.java        26 Apr 2002 10:42:17 -0000      1.12
  @@ -50,19 +50,22 @@
   */
   package org.apache.cocoon.treeprocessor;
   
  +import org.apache.avalon.framework.component.ComponentException;
  +import org.apache.avalon.framework.component.ComponentManager;
  +
   /**
    * @deprecated Moved to org.apache.cocoon.components.treeprocessor.TreeProcessor
    * @author <a href="mailto:[EMAIL PROTECTED]";>Sylvain Wallez</a>
  - * @version CVS $Id: TreeProcessor.java,v 1.11 2002/03/05 08:26:24 sylvain Exp $
  + * @version CVS $Id: TreeProcessor.java,v 1.12 2002/04/26 10:42:17 cziegeler Exp $
    */
   
   public class TreeProcessor extends 
org.apache.cocoon.components.treeprocessor.TreeProcessor {
   
  -    public void initialize() throws Exception {
  -     
  +    public void compose(ComponentManager manager) throws ComponentException {
  +
           getLogger().warn("The class 'org.apache.cocoon.treeprocessor.Treeprocessor' 
has moved to " +
               "'org.apache.cocoon.components.treeprocessor.TreeProcessor'.");
   
  -        super.initialize();
  +        super.compose(manager);
       }
   }
  
  
  
  1.11      +2 -30     xml-cocoon2/src/webapp/WEB-INF/cocoon.xconf
  
  Index: cocoon.xconf
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/webapp/WEB-INF/cocoon.xconf,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- cocoon.xconf      25 Apr 2002 09:30:48 -0000      1.10
  +++ cocoon.xconf      26 Apr 2002 10:42:17 -0000      1.11
  @@ -148,6 +148,7 @@
       The url factory adds special url protocols to the system, they are then
       available inside Cocoon, e.g. as a source argument for one of the sitemap
       components.
  +    THIS COMPONENT IS DEPRECATED AND SHOULD NOT BE USED ANYMORE 
     -->
     <url-factory logger="core.url-factory">
       <!-- Allows access to resources available from the ClassLoader,
  @@ -163,6 +164,7 @@
       The source handler adds special url protocols to the system, they are
       then available inside Cocoon, e.g. as a source argument for one of the
       sitemap components.
  +    THIS COMPONENT IS DEPRECATED AND SHOULD NOT BE USED ANYMORE 
     -->
     <source-handler logger="core.source-handler">
       <!-- file protocol : this is a WriteableSource -->
  @@ -458,36 +460,6 @@
     </monitor>
   
   <!-- ======================== The sitemap  ============================== -->
  -
  -  <!--
  -    Compiled sitemap engine. This is the original engine, that is now replaced
  -    by the interpreted engine (see above).
  -
  -    If you want to use this engine, uncomment this element and comment the
  -    defaut one below.
  -
  -    Reloading of the sitemap:
  -    The check-reload attribute determines if the sitemap is reloaded on change.
  -    Set to "no", the sitemap is generated once at startup.
  -    Set to "yes", the sitemap is regenerated if it changes.
  -
  -    The reload-method specifies the method for the regeneration:
  -    asynchron: If the sitemap changes, the sitemap is regenerated at the
  -               next request in the background and the incoming request is
  -               served with the old sitemap. All subsequent requests are
  -               served with the old sitemap until the regeneration in the
  -               background has finished.
  -    synchron: If the sitemap changes, the sitemap is regenerated at the
  -              next request. When the regeneration is finished, the request
  -              (and all subsequent ones) is served with the new sitemap.
  -
  -    For development environment, set the reload-method to synchron and the
  -    check-reload to yes.
  -    For production environment, it is advisable to set the reload-method to
  -    asynchron and for more safety the check-reload to no.
  -  -->
  -  <!--sitemap class="org.apache.cocoon.sitemap.SitemapManager"
  -           file="sitemap.xmap" reload-method="asynchron" check-reload="yes" 
logger="sitemap"/-->
   
     <!--
       New implementation of the sitemap. It is interpreted, so load times are 
super-fast,
  
  
  

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