cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: xml-cocoon/src/org/apache/cocoon/util RoleUtils.java
Date Mon, 19 Feb 2001 21:57:56 GMT
bloritsch    01/02/19 13:57:55

  Modified:    src/org/apache/cocoon Tag: xml-cocoon2 Cocoon.java
                        ComponentFactory.java
               src/org/apache/cocoon/components/language/markup/sitemap/java
                        Tag: xml-cocoon2 sitemap.xsl
               src/org/apache/cocoon/generation Tag: xml-cocoon2
                        FragmentExtractorGenerator.java
               src/org/apache/cocoon/sitemap Tag: xml-cocoon2
                        AbstractSitemap.java Handler.java Manager.java
                        ResourcePipeline.java Sitemap.java
                        SitemapComponentSelector.java
               src/org/apache/cocoon/util Tag: xml-cocoon2 RoleUtils.java
  Removed:     src/org/apache/cocoon/sitemap Tag: xml-cocoon2
                        SitemapComponentManager.java
  Log:
  Sitemap section now using correct ComponentManagement Semantics, and FragmentGenerator is
fixed.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.4.2.57  +2 -2      xml-cocoon/src/org/apache/cocoon/Cocoon.java
  
  Index: Cocoon.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Cocoon.java,v
  retrieving revision 1.4.2.56
  retrieving revision 1.4.2.57
  diff -u -r1.4.2.56 -r1.4.2.57
  --- Cocoon.java	2001/02/17 19:08:46	1.4.2.56
  +++ Cocoon.java	2001/02/19 21:57:45	1.4.2.57
  @@ -45,7 +45,7 @@
    *
    * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
(Apache Software Foundation, Exoffice Technologies)
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.4.2.56 $ $Date: 2001/02/17 19:08:46 $
  + * @version CVS $Revision: 1.4.2.57 $ $Date: 2001/02/19 21:57:45 $
    */
   public class Cocoon extends AbstractLoggable implements Component, Initializable, Modifiable,
Processor, Contextualizable {
       /** The application context */
  @@ -157,7 +157,7 @@
           getLogger().debug("Setting up the sitemap.");
           // Create the sitemap
           Configuration sconf = conf.getChild("sitemap");
  -        this.sitemapManager = new Manager(null);
  +        this.sitemapManager = new Manager();
           this.sitemapManager.contextualize(this.context);
           this.sitemapManager.setLogger(getLogger());
           this.sitemapManager.compose(this.componentManager);
  
  
  
  1.1.2.9   +5 -5      xml-cocoon/src/org/apache/cocoon/Attic/ComponentFactory.java
  
  Index: ComponentFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/ComponentFactory.java,v
  retrieving revision 1.1.2.8
  retrieving revision 1.1.2.9
  diff -u -r1.1.2.8 -r1.1.2.9
  --- ComponentFactory.java	2001/02/16 20:28:54	1.1.2.8
  +++ ComponentFactory.java	2001/02/19 21:57:45	1.1.2.9
  @@ -25,7 +25,7 @@
   
   /** Factory for Cocoon components.
    * @author <a href="mailto:paul@luminas.co.uk">Paul Russell</a>
  - * @version CVS $Revision: 1.1.2.8 $ $Date: 2001/02/16 20:28:54 $
  + * @version CVS $Revision: 1.1.2.9 $ $Date: 2001/02/19 21:57:45 $
    */
   public class ComponentFactory implements ObjectFactory, PoolClient, ThreadSafe, Loggable
{
       private Logger log;
  @@ -90,12 +90,12 @@
               ((Loggable)comp).setLogger(this.log);
           }
   
  -        if ( comp instanceof Configurable ) {
  -            ((Configurable)comp).configure(this.conf);
  -        }
  -
           if ( comp instanceof Composer) {
               ((Composer)comp).compose(this.manager);
  +        }
  +
  +        if ( comp instanceof Configurable ) {
  +            ((Configurable)comp).configure(this.conf);
           }
   
           if ( comp instanceof PoolClient) {
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.79  +24 -18    xml-cocoon/src/org/apache/cocoon/components/language/markup/sitemap/java/Attic/sitemap.xsl
  
  Index: sitemap.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/sitemap/java/Attic/sitemap.xsl,v
  retrieving revision 1.1.2.78
  retrieving revision 1.1.2.79
  diff -u -r1.1.2.78 -r1.1.2.79
  --- sitemap.xsl	2001/02/16 22:07:35	1.1.2.78
  +++ sitemap.xsl	2001/02/19 21:57:47	1.1.2.79
  @@ -94,7 +94,7 @@
        *
        * @author &lt;a href="mailto:giacomo@apache.org"&gt;Giacomo Pati&lt;/a&gt;
        * @author &lt;a href="mailto:bloritsch@apache.org"&gt;Berin Loritsch&lt;/a&gt;
  -     * @version CVS $Id: sitemap.xsl,v 1.1.2.78 2001/02/16 22:07:35 bloritsch Exp $
  +     * @version CVS $Id: sitemap.xsl,v 1.1.2.79 2001/02/19 21:57:47 bloritsch Exp $
        */
       public class <xsl:value-of select="@file-name"/> extends AbstractSitemap {
         static final String LOCATION = "<xsl:value-of select="translate(@file-path, '/',
'.')"/>.<xsl:value-of select="@file-name"/>";
  @@ -190,14 +190,14 @@
          * &lt;code&gt;Configurable&lt;/code&gt; class.
          */
         public void configure(Configuration conf) throws ConfigurationException {
  -        this.sitemapManager = new Manager(super.sitemapComponentManager);
  +        this.sitemapManager = new Manager();
           this.sitemapManager.setLogger(getLogger());
           this.sitemapManager.compose(this.manager);
           this.sitemapManager.configure(conf);
           try {
             <!-- configure well known components first -->
  -          load_component ("!generator:error-notifier!", "org.apache.cocoon.sitemap.ErrorNotifier",
new DefaultConfiguration("", LOCATION), null);
  -          load_component ("!transformer:link-translator!", "org.apache.cocoon.sitemap.LinkTranslator",
new DefaultConfiguration("", LOCATION), null);
  +          load_component (Sitemap.GENERATOR, "!error-notifier!", "org.apache.cocoon.sitemap.ErrorNotifier",
new DefaultConfiguration("", LOCATION), null);
  +          load_component (Sitemap.TRANSFORMER, "!link-translator!", "org.apache.cocoon.sitemap.LinkTranslator",
new DefaultConfiguration("", LOCATION), null);
   
             Configurer configurer = new Configurer(this, LOCATION);
             configurer.configGenerators();
  @@ -373,7 +373,8 @@
         throws Exception {
           /* the &lt;code&gt;ResourcePipeline&lt;/code&gt; used to collect
the sitemap
              components to produce the requested resource */
  -        ResourcePipeline pipeline = new ResourcePipeline (super.sitemapComponentManager);
  +        ResourcePipeline pipeline = new ResourcePipeline ();
  +        pipeline.compose(this.manager);
           /* the &lt;code&gt;List&lt;/code&gt; objects to hold the replacement
values
              delivered from matchers and selectors to replace occurences of
              XPath kind expressions in values of src attribute used with
  @@ -419,11 +420,12 @@
           <xsl:if test="(./map:handle-errors)">
             private boolean error_process_<xsl:value-of select="$pipeline-position"/>
(Environment environment, Map objectModel, Exception e)
             throws Exception {
  -            ResourcePipeline pipeline = new ResourcePipeline (super.sitemapComponentManager);
  +            ResourcePipeline pipeline = new ResourcePipeline ();
  +            pipeline.compose(this.manager);
               List listOfMaps = (List)(new ArrayList());
               Map map;
               Parameters param;
  -            pipeline.setGenerator ("!generator:error-notifier!", e.getMessage(), emptyParam,
e);
  +            pipeline.setGenerator ("!error-notifier!", e.getMessage(), emptyParam, e);
               <xsl:apply-templates select="./map:handle-errors/*"/>
               return false;
             }
  @@ -488,7 +490,7 @@
             <xsl:value-of select="$matcher-name2"/>
           </xsl:when>
           <xsl:otherwise>
  -          ((Matcher)super.sitemapComponentManager.lookup("matcher:<xsl:value-of select="$matcher-type"/>")).match
  +          ((Matcher)this.matchers.select("<xsl:value-of select="$matcher-type"/>")).match
           </xsl:otherwise>
         </xsl:choose>
       </xsl:variable>
  @@ -561,7 +563,7 @@
               <xsl:value-of select="$selector-name2"/>
             </xsl:when>
             <xsl:otherwise>
  -            ((Selector)super.sitemapComponentManager.lookup("selector:<xsl:value-of
select="$selector-type"/>")).select
  +            ((Selector)this.selectors.select("<xsl:value-of select="$selector-type"/>")).select
             </xsl:otherwise>
           </xsl:choose>
         </xsl:variable>
  @@ -606,7 +608,7 @@
   
       <!-- gets the string how the action is to be invoced in java code -->
       <xsl:variable name="action-name">
  -      ((Action)super.sitemapComponentManager.lookup("action:<xsl:value-of select="$action-type"/>")).act
  +      ((Action)this.actions.select("<xsl:value-of select="$action-type"/>")).act
       </xsl:variable>
   
       <!-- test if we have to define parameters for this action -->
  @@ -666,7 +668,7 @@
   
       <!-- gets the string how the action is to be invoced in java code -->
       <xsl:variable name="action-name">
  -      ((Action)super.sitemapComponentManager.lookup("action:<xsl:value-of select="$action-type"/>")).act
  +      ((Action)this.actions.select("<xsl:value-of select="$action-type"/>")).act
       </xsl:variable>
   
       <!-- test if we have to define parameters for this action -->
  @@ -888,6 +890,10 @@
       <xsl:param name="name"/>
       <xsl:param name="components"/>
   
  +    <xsl:variable name="type">
  +      <xsl:value-of select="translate($name, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
  +    </xsl:variable>
  +
       <xsl:variable name="qname">
         <xsl:value-of select="concat($nsprefix, ':value')"/>
       </xsl:variable>
  @@ -916,10 +922,10 @@
   
           <xsl:choose>
             <xsl:when test="@mime-type">
  -            sitemap.load_component ("<xsl:value-of select="$name"/>:<xsl:value-of
select="@name"/>", "<xsl:value-of select="@src"/>", cconf1, "<xsl:value-of select="@mime-type"/>");
  +            sitemap.load_component (Sitemap.<xsl:value-of select="$type"/>, "<xsl:value-of
select="@name"/>", "<xsl:value-of select="@src"/>", cconf1, "<xsl:value-of select="@mime-type"/>");
             </xsl:when>
             <xsl:otherwise>
  -            sitemap.load_component ("<xsl:value-of select="$name"/>:<xsl:value-of
select="@name"/>", "<xsl:value-of select="@src"/>", cconf1, null);
  +            sitemap.load_component (Sitemap.<xsl:value-of select="$type"/>, "<xsl:value-of
select="@name"/>", "<xsl:value-of select="@src"/>", cconf1, null);
             </xsl:otherwise>
           </xsl:choose>
       }
  @@ -993,7 +999,7 @@
           </xsl:for-each>
           // performing link translation
           if (environment.getObjectModel().containsKey(Constants.LINK_OBJECT)) {
  -            pipeline.addTransformer ("!transformer:link-translator!", null, emptyParam);
  +            pipeline.addTransformer ("!link-translator!", null, emptyParam);
           }
         </xsl:if>
       </xsl:if>
  @@ -1041,12 +1047,12 @@
           <xsl:choose>
             <xsl:when test="$mime-type!=''">
               getLogger().debug("Mime-type: <xsl:value-of select="$mime-type"/>");
  -            pipeline.<xsl:value-of select="$method"/> ("<xsl:value-of select="$prefix"/>:<xsl:value-of
select="$component-type"/>",
  +            pipeline.<xsl:value-of select="$method"/> ("<xsl:value-of select="$component-type"/>",
                 null, <xsl:value-of select="$component-param"/>,"<xsl:value-of select="$mime-type"/>"
               );
             </xsl:when>
             <xsl:otherwise>
  -            pipeline.<xsl:value-of select="$method"/> ("<xsl:value-of select="$prefix"/>:<xsl:value-of
select="$component-type"/>",
  +            pipeline.<xsl:value-of select="$method"/> ("<xsl:value-of select="$component-type"/>",
                 null, <xsl:value-of select="$component-param"/>
               );
             </xsl:otherwise>
  @@ -1057,12 +1063,12 @@
           <xsl:choose>
             <xsl:when test="$mime-type!=''">
               getLogger().debug("Mime-type: <xsl:value-of select="$mime-type"/>");
  -            pipeline.<xsl:value-of select="$method"/> ("<xsl:value-of select="$prefix"/>:<xsl:value-of
select="$component-type"/>",
  +            pipeline.<xsl:value-of select="$method"/> ("<xsl:value-of select="$component-type"/>",
                   substitute(listOfMaps,"<xsl:value-of select="$component-source"/>"),
                   <xsl:value-of select="$component-param"/>,"<xsl:value-of select="$mime-type"/>");
             </xsl:when>
             <xsl:otherwise>
  -            pipeline.<xsl:value-of select="$method"/> ("<xsl:value-of select="$prefix"/>:<xsl:value-of
select="$component-type"/>",
  +            pipeline.<xsl:value-of select="$method"/> ("<xsl:value-of select="$component-type"/>",
                   substitute(listOfMaps,"<xsl:value-of select="$component-source"/>"),
                   <xsl:value-of select="$component-param"/>);
             </xsl:otherwise>
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.5   +19 -15    xml-cocoon/src/org/apache/cocoon/generation/Attic/FragmentExtractorGenerator.java
  
  Index: FragmentExtractorGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/generation/Attic/FragmentExtractorGenerator.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- FragmentExtractorGenerator.java	2001/02/19 21:13:31	1.1.2.4
  +++ FragmentExtractorGenerator.java	2001/02/19 21:57:48	1.1.2.5
  @@ -29,12 +29,12 @@
    * This is by no means complete yet, but it should prove useful, particularly
    * for offline generation.
    * @author <a href="mailto:paul@luminas.co.uk">Paul Russell</a>
  - * @version CVS $Revision: 1.1.2.4 $ $Date: 2001/02/19 21:13:31 $
  + * @version CVS $Revision: 1.1.2.5 $ $Date: 2001/02/19 21:57:48 $
    */
   public class FragmentExtractorGenerator extends AbstractGenerator implements PoolClient
{
   
       /** The fragment store. */
  -    private static Map fragmentStore;
  +    private static Map fragmentStore = new HashMap();
   
       private Pool pool;
   
  @@ -51,35 +51,39 @@
        * per-instance.
        */
       public FragmentExtractorGenerator() {
  -        synchronized(this) {
  -            if ( fragmentStore == null ) {
  -                fragmentStore = Collections.synchronizedMap(new HashMap());
  -            }
  -        }
       }
   
       public void setup(EntityResolver resolver, Map objectModel, String src, Parameters
par)
           throws ProcessingException, SAXException, IOException {
           super.setup(resolver,objectModel,src,par);
  -        if ( fragmentStore.get(source) == null ) {
  -            throw new ResourceNotFoundException("Could not find fragment " + source + ".");
  -        }
   
  +        synchronized (FragmentExtractorGenerator.fragmentStore) {
  +            if ( FragmentExtractorGenerator.fragmentStore.get(source) == null ) {
  +                throw new ResourceNotFoundException("Could not find fragment " + source
+ ".");
  +            }
  +        }
       }
   
       public void generate() throws SAXException {
           // Obtain the fragmentID  (which is simply the filename portion of the source)
           getLogger().debug("FragmentExtractorGenerator retrieving document " + source +
".");
  -        Document doc = (Document) fragmentStore.get(source);
  -        DOMStreamer streamer = new DOMStreamer(this.contentHandler,this.lexicalHandler);
   
  -        streamer.stream(doc);
  -        fragmentStore.remove(source);
  +        synchronized (FragmentExtractorGenerator.fragmentStore) {
  +            Document doc = (Document) FragmentExtractorGenerator.fragmentStore.get(source);
  +            DOMStreamer streamer = new DOMStreamer(this.contentHandler,this.lexicalHandler);
  +
  +            streamer.stream(doc);
  +            FragmentExtractorGenerator.fragmentStore.remove(source);
  +        }
       }
   
       public static String store(Document doc) {
           String id = (new UID()).toString();
  -        fragmentStore.put(id,doc);
  +
  +        synchronized (FragmentExtractorGenerator.fragmentStore) {
  +            fragmentStore.put(id,doc);
  +        }
  +
           return id;
       }
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.23  +41 -25    xml-cocoon/src/org/apache/cocoon/sitemap/Attic/AbstractSitemap.java
  
  Index: AbstractSitemap.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/AbstractSitemap.java,v
  retrieving revision 1.1.2.22
  retrieving revision 1.1.2.23
  diff -u -r1.1.2.22 -r1.1.2.23
  --- AbstractSitemap.java	2001/02/17 19:55:41	1.1.2.22
  +++ AbstractSitemap.java	2001/02/19 21:57:49	1.1.2.23
  @@ -26,6 +26,7 @@
   import org.apache.avalon.ComponentManagerException;
   import org.apache.avalon.ComponentNotFoundException;
   
  +import org.apache.cocoon.CocoonComponentSelector;
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.Processor;
   import org.apache.cocoon.Roles;
  @@ -33,7 +34,6 @@
   import org.apache.cocoon.components.classloader.RepositoryClassLoader;
   import org.apache.cocoon.components.language.generator.AbstractCompiledComponent;
   import org.apache.cocoon.environment.Environment;
  -import org.apache.cocoon.sitemap.SitemapComponentManager;
   import org.apache.cocoon.util.ClassUtils;
   
   import org.xml.sax.SAXException;
  @@ -42,7 +42,7 @@
    * Base class for generated <code>Sitemap</code> classes
    *
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
  - * @version CVS $Revision: 1.1.2.22 $ $Date: 2001/02/17 19:55:41 $
  + * @version CVS $Revision: 1.1.2.23 $ $Date: 2001/02/19 21:57:49 $
    */
   public abstract class AbstractSitemap extends AbstractCompiledComponent implements Sitemap
{
       private Context context;
  @@ -52,9 +52,6 @@
       /** The component manager instance */
       protected ComponentManager manager;
   
  -    /** The sitemap component manager instance */
  -    protected SitemapComponentManager sitemapComponentManager;
  -
       /** The sitemap manager instance */
       protected Manager sitemapManager;
   
  @@ -64,16 +61,13 @@
       /** The creation date */
       protected static long dateCreated = -1L;
   
  -    /**
  -     * Set the current <code>ComponentManager</code> instance used by this
  -     * <code>Composer</code>.
  -     */
  -    public void setParentSitemapComponentManager(SitemapComponentManager parentSitemapComponentManager)
{
  -        this.sitemapComponentManager = new SitemapComponentManager (parentSitemapComponentManager);
  -        this.sitemapComponentManager.contextualize(this.context);
  -        this.sitemapComponentManager.setLogger(getLogger());
  -        this.sitemapComponentManager.compose(this.manager);
  -    }
  +    protected CocoonComponentSelector generators;
  +    protected CocoonComponentSelector transformers;
  +    protected SitemapComponentSelector serializers;
  +    protected SitemapComponentSelector readers;
  +    protected CocoonComponentSelector actions;
  +    protected CocoonComponentSelector matchers;
  +    protected CocoonComponentSelector selectors;
   
       /**
        * Set the current <code>ComponentManager</code> instance used by this
  @@ -83,9 +77,16 @@
           this.manager = manager;
   
           try {
  -            this.urlFactory = (URLFactory)manager.lookup(Roles.URL_FACTORY);
  +            this.urlFactory = (URLFactory) this.manager.lookup(Roles.URL_FACTORY);
  +            this.generators = (CocoonComponentSelector) this.manager.lookup(Roles.GENERATORS);
  +            this.transformers = (CocoonComponentSelector) this.manager.lookup(Roles.TRANSFORMERS);
  +            this.serializers = (SitemapComponentSelector) this.manager.lookup(Roles.SERIALIZERS);
  +            this.readers = (SitemapComponentSelector) this.manager.lookup(Roles.READERS);
  +            this.actions = (CocoonComponentSelector) this.manager.lookup(Roles.ACTIONS);
  +            this.matchers = (CocoonComponentSelector) this.manager.lookup(Roles.MATCHERS);
  +            this.selectors = (CocoonComponentSelector) this.manager.lookup(Roles.SELECTORS);
           } catch (Exception e) {
  -            getLogger().error("cannot obtain the URLFactory", e);
  +            getLogger().error("cannot obtain the Component", e);
               throw new ComponentNotFoundException ("cannot obtain the URLFactory", e);
           }
       }
  @@ -121,7 +122,7 @@
         * Loads a class specified in a sitemap component definition and
         * initialize it
         */
  -    public void load_component(String type, String classURL, Configuration configuration,
String mime_type)
  +    public void load_component(int type, Object hint, String classURL, Configuration configuration,
String mime_type)
       throws Exception {
           Class clazz;
           //FIXME(GP): Is it true that a class name containing a colon should be an URL?
  @@ -136,14 +137,29 @@
               throw new IllegalAccessException ("Object " + classURL + " is not a Component");
           }
   
  -        if (this.sitemapComponentManager == null) {
  -            this.sitemapComponentManager = new SitemapComponentManager();
  -            this.sitemapComponentManager.contextualize(this.context);
  -            this.sitemapComponentManager.setLogger(getLogger());
  -            this.sitemapComponentManager.compose(this.manager);
  +        switch (type) {
  +            case Sitemap.GENERATOR:
  +                this.generators.addComponent(hint, clazz, configuration);
  +                break;
  +            case Sitemap.TRANSFORMER:
  +                this.transformers.addComponent(hint, clazz, configuration);
  +                break;
  +            case Sitemap.SERIALIZER:
  +                this.serializers.addSitemapComponent(hint, clazz, configuration, mime_type);
  +                break;
  +            case Sitemap.READER:
  +                this.readers.addSitemapComponent(hint, clazz, configuration, mime_type);
  +                break;
  +            case Sitemap.ACTION:
  +                this.actions.addComponent(hint, clazz, configuration);
  +                break;
  +            case Sitemap.MATCHER:
  +                this.matchers.addComponent(hint, clazz, configuration);
  +                break;
  +            case Sitemap.SELECTOR:
  +                this.selectors.addComponent(hint, clazz, configuration);
  +                break;
           }
  -
  -        this.sitemapComponentManager.addSitemapComponent(type, clazz, configuration, mime_type);
       }
   
       private byte [] getByteArrayFromStream (InputStream stream) {
  
  
  
  1.1.2.17  +5 -8      xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Handler.java
  
  Index: Handler.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Handler.java,v
  retrieving revision 1.1.2.16
  retrieving revision 1.1.2.17
  diff -u -r1.1.2.16 -r1.1.2.17
  --- Handler.java	2001/02/16 22:07:46	1.1.2.16
  +++ Handler.java	2001/02/19 21:57:50	1.1.2.17
  @@ -40,7 +40,7 @@
    *
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.1.2.16 $ $Date: 2001/02/16 22:07:46 $
  + * @version CVS $Revision: 1.1.2.17 $ $Date: 2001/02/19 21:57:50 $
    */
   public class Handler extends AbstractLoggable implements Runnable, Configurable, Composer,
Contextualizable, Processor {
       private Context context;
  @@ -51,9 +51,6 @@
       /** the component manager */
       private ComponentManager manager;
   
  -    /** the parent sitemap component manager */
  -    private SitemapComponentManager parentSitemapComponentManager;
  -
       /** the source of this sitemap */
       private String source;
       private File sourceFile;
  @@ -94,9 +91,8 @@
           this.context = context;
       }
   
  -    protected Handler (SitemapComponentManager sitemapComponentManager, String source,
boolean check_reload)
  +    protected Handler (String source, boolean check_reload)
       throws FileNotFoundException {
  -        this.parentSitemapComponentManager = sitemapComponentManager;
           this.check_reload = check_reload;
           this.source = source;
       }
  @@ -175,8 +171,9 @@
           try {
               ProgramGenerator programGenerator = (ProgramGenerator) this.manager.lookup(Roles.PROGRAM_GENERATOR);
               smap = (Sitemap) programGenerator.load(this.sourceFile, markupLanguage, programmingLanguage,
environment);
  -            smap.setParentSitemapComponentManager (this.parentSitemapComponentManager);
  -            if (smap instanceof Configurable) smap.configure(this.conf);
  +            smap.contextualize(this.context);
  +            smap.compose(this.manager);
  +            smap.configure(this.conf);
   
               this.sitemap = smap;
               getLogger().debug("Sitemap regeneration complete");
  
  
  
  1.1.2.8   +2 -9      xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Manager.java
  
  Index: Manager.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Manager.java,v
  retrieving revision 1.1.2.7
  retrieving revision 1.1.2.8
  diff -u -r1.1.2.7 -r1.1.2.8
  --- Manager.java	2001/02/16 22:07:46	1.1.2.7
  +++ Manager.java	2001/02/19 21:57:50	1.1.2.8
  @@ -36,7 +36,7 @@
    * checking regeneration of the sub <code>Sitemap</code>
    *
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
  - * @version CVS $Revision: 1.1.2.7 $ $Date: 2001/02/16 22:07:46 $
  + * @version CVS $Revision: 1.1.2.8 $ $Date: 2001/02/19 21:57:50 $
    */
   public class Manager extends AbstractLoggable implements Configurable, Composer, Contextualizable
{
   
  @@ -51,13 +51,6 @@
       /** The component manager */
       private ComponentManager manager;
   
  -    /** The parent sitemap component manager */
  -    private SitemapComponentManager parentSitemapComponentManager;
  -
  -    public Manager (SitemapComponentManager sitemapComponentManager) {
  -        this.parentSitemapComponentManager = sitemapComponentManager;
  -    }
  -
       public void configure (Configuration conf) {
           this.conf = conf;
       }
  @@ -92,7 +85,7 @@
                   sitemapHandler.regenerate(environment);
               }
           } else {
  -            sitemapHandler = new Handler(parentSitemapComponentManager, source, check_reload);
  +            sitemapHandler = new Handler(source, check_reload);
               sitemapHandler.contextualize(this.context);
               sitemapHandler.setLogger(getLogger());
               sitemapHandler.compose(this.manager);
  
  
  
  1.1.2.21  +13 -14    xml-cocoon/src/org/apache/cocoon/sitemap/Attic/ResourcePipeline.java
  
  Index: ResourcePipeline.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/ResourcePipeline.java,v
  retrieving revision 1.1.2.20
  retrieving revision 1.1.2.21
  diff -u -r1.1.2.20 -r1.1.2.21
  --- ResourcePipeline.java	2001/02/19 15:58:10	1.1.2.20
  +++ ResourcePipeline.java	2001/02/19 21:57:50	1.1.2.21
  @@ -14,6 +14,7 @@
   import org.apache.avalon.Configuration;
   import org.apache.avalon.Configurable;
   import org.apache.avalon.ComponentManager;
  +import org.apache.avalon.ComponentSelector;
   import org.apache.avalon.Component;
   import org.apache.avalon.Composer;
   import org.apache.avalon.Parameters;
  @@ -26,6 +27,7 @@
   import org.apache.cocoon.serialization.Serializer;
   import org.apache.cocoon.xml.XMLProducer;
   import org.apache.cocoon.PoolClient;
  +import org.apache.cocoon.Roles;
   
   import org.apache.cocoon.sitemap.ErrorNotifier;
   
  @@ -34,7 +36,7 @@
   
   /**
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
  - * @version CVS $Revision: 1.1.2.20 $ $Date: 2001/02/19 15:58:10 $
  + * @version CVS $Revision: 1.1.2.21 $ $Date: 2001/02/19 21:57:50 $
    */
   public class ResourcePipeline implements Composer {
       private Generator generator;
  @@ -58,13 +60,6 @@
       /** the component manager */
       private ComponentManager manager;
   
  -    /** the sitemap component manager */
  -    private SitemapComponentManager sitemapComponentManager;
  -
  -    public ResourcePipeline (SitemapComponentManager sitemapComponentManager) {
  -        this.sitemapComponentManager = sitemapComponentManager;
  -    }
  -
       public void compose (ComponentManager manager) {
           this.manager = manager;
       }
  @@ -80,7 +75,8 @@
           if (this.generator != null) {
               throw new ProcessingException ("Generator already set. You can only select
one Generator (" + role + ")");
           }
  -        this.generator = (Generator)sitemapComponentManager.lookup(role);
  +        ComponentSelector selector = (ComponentSelector) this.manager.lookup(Roles.GENERATORS);
  +        this.generator = (Generator) selector.select(role);
           this.generatorSource = source;
           this.generatorParam = param;
       }
  @@ -95,11 +91,12 @@
           if (this.reader != null) {
               throw new ProcessingException ("Reader already set. You can only select one
Reader (" + role + ")");
           }
  -        this.reader = (Reader)sitemapComponentManager.lookup(role);
  +        SitemapComponentSelector selector = (SitemapComponentSelector) this.manager.lookup(Roles.READERS);
  +        this.reader = (Reader)selector.select(role);
           this.readerSource = source;
           this.readerParam = param;
           this.readerMimeType = mimeType;
  -        this.sitemapReaderMimeType = this.sitemapComponentManager.getMimeTypeForRole(role);
  +        this.sitemapReaderMimeType = selector.getMimeTypeForRole(role);
       }
   
       public void setSerializer (String role, String source, Parameters param)
  @@ -112,16 +109,18 @@
           if (this.serializer != null) {
               throw new ProcessingException ("Serializer already set. You can only select
one Serializer (" + role + ")");
           }
  -        this.serializer = (Serializer)sitemapComponentManager.lookup(role);
  +        SitemapComponentSelector selector = (SitemapComponentSelector) this.manager.lookup(Roles.SERIALIZERS);
  +        this.serializer = (Serializer)selector.select(role);
           this.serializerSource = source;
           this.serializerParam = param;
           this.serializerMimeType = mimeType;
  -        this.sitemapSerializerMimeType = this.sitemapComponentManager.getMimeTypeForRole(role);
  +        this.sitemapSerializerMimeType = selector.getMimeTypeForRole(role);
       }
   
       public void addTransformer (String role, String source, Parameters param)
       throws Exception {
  -        this.transformers.add ((Transformer)sitemapComponentManager.lookup(role));
  +        ComponentSelector selector = (ComponentSelector) this.manager.lookup(Roles.TRANSFORMERS);
  +        this.transformers.add ((Transformer)selector.select(role));
           this.transformerSources.add (source);
           this.transformerParams.add (param);
       }
  
  
  
  1.1.4.14  +8 -2      xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Sitemap.java
  
  Index: Sitemap.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Sitemap.java,v
  retrieving revision 1.1.4.13
  retrieving revision 1.1.4.14
  diff -u -r1.1.4.13 -r1.1.4.14
  --- Sitemap.java	2001/02/16 22:07:47	1.1.4.13
  +++ Sitemap.java	2001/02/19 21:57:51	1.1.4.14
  @@ -18,8 +18,14 @@
    * Base interface for generated <code>Sitemap</code> classes
    *
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
  - * @version CVS $Revision: 1.1.4.13 $ $Date: 2001/02/16 22:07:47 $
  + * @version CVS $Revision: 1.1.4.14 $ $Date: 2001/02/19 21:57:51 $
    */
   public interface Sitemap extends CompiledComponent, Configurable, Contextualizable, Processor
{
  -    void setParentSitemapComponentManager (SitemapComponentManager sitemapComponentManager);
  +    int GENERATOR = 1;
  +    int TRANSFORMER = GENERATOR << 1;
  +    int SERIALIZER = TRANSFORMER << 1;
  +    int READER = SERIALIZER << 1;
  +    int ACTION = READER << 1;
  +    int MATCHER = ACTION << 1;
  +    int SELECTOR = MATCHER << 1;
   }
  
  
  
  1.1.2.2   +4 -4      xml-cocoon/src/org/apache/cocoon/sitemap/Attic/SitemapComponentSelector.java
  
  Index: SitemapComponentSelector.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/SitemapComponentSelector.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- SitemapComponentSelector.java	2001/02/19 18:21:05	1.1.2.1
  +++ SitemapComponentSelector.java	2001/02/19 21:57:52	1.1.2.2
  @@ -23,7 +23,7 @@
   
   /** Default component manager for Cocoon's sitemap components.
    * @author <a href="mailto:giacomo@apache.org">Giacomo Pati</a>
  - * @version CVS $Id: SitemapComponentSelector.java,v 1.1.2.1 2001/02/19 18:21:05 bloritsch
Exp $
  + * @version CVS $Id: SitemapComponentSelector.java,v 1.1.2.2 2001/02/19 21:57:52 bloritsch
Exp $
    */
   public class SitemapComponentSelector extends CocoonComponentSelector {
       HashMap mime_types;
  @@ -39,10 +39,10 @@
           return (String) this.mime_types.get(role);
       }
   
  -    protected void addSitemapComponent(String type, Class component, Configuration conf,
String mime_type)
  +    protected void addSitemapComponent(Object hint, Class component, Configuration conf,
String mime_type)
       throws ComponentManagerException,
              ConfigurationException {
  -        super.addComponent(type, component, conf);
  -        this.mime_types.put(type, mime_type);
  +        super.addComponent(hint, component, conf);
  +        this.mime_types.put(hint, mime_type);
       }
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.9   +3 -3      xml-cocoon/src/org/apache/cocoon/util/Attic/RoleUtils.java
  
  Index: RoleUtils.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/util/Attic/RoleUtils.java,v
  retrieving revision 1.1.2.8
  retrieving revision 1.1.2.9
  diff -u -r1.1.2.8 -r1.1.2.9
  --- RoleUtils.java	2001/02/19 18:10:38	1.1.2.8
  +++ RoleUtils.java	2001/02/19 21:57:54	1.1.2.9
  @@ -19,7 +19,7 @@
    * role aliases and the real Avalon role names.
    *
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - * @version CVS $Revision: 1.1.2.8 $ $Date: 2001/02/19 18:10:38 $
  + * @version CVS $Revision: 1.1.2.9 $ $Date: 2001/02/19 21:57:54 $
    */
   
   public class RoleUtils {
  @@ -62,8 +62,8 @@
           setup.put(Roles.SELECTORS, "org.apache.cocoon.CocoonComponentSelector");
           setup.put(Roles.GENERATORS, "org.apache.cocoon.CocoonComponentSelector");
           setup.put(Roles.TRANSFORMERS, "org.apache.cocoon.CocoonComponentSelector");
  -        setup.put(Roles.SERIALIZERS, "org.apache.cocoon.SitemapComponentSelector");
  -        setup.put(Roles.READERS, "org.apache.cocoon.SitemapComponentSelector");
  +        setup.put(Roles.SERIALIZERS, "org.apache.cocoon.sitemap.SitemapComponentSelector");
  +        setup.put(Roles.READERS, "org.apache.cocoon.sitemap.SitemapComponentSelector");
   
           classname = Collections.unmodifiableMap(setup);
       }
  
  
  

Mime
View raw message