You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Giacomo Pati <Gi...@pwr.ch> on 2000/07/07 22:20:57 UTC

[repost of] Sitemap class generation

Sorry, my mail client has messed up my message. I've shorten the line
length to make it more readable.

Giacomo

Hi all

I want to show the layout of the currently generated sitemap class for
discussion.

Some notes: a Pipeline in the context below is a object which holds a
generator, maybe several transformers and a serializer. This object has
a process method to produce the resource requested.


  class GeneratedSitemap {

    for each sitemap-component {
      define a variable to hold a reference to the 
          sitemap-component object
    }

    for each <mount> tag {
      define a variable to hold a reference to the sub-sitemap 
          object
    }

    method setConfiguration (from interface Configurable) {
      for each sitemap-component {
        collect configuration tags to build a Configuration object 
            for the component
        store an instance of the component into the variable 
            generated above
        provide the Configuration at the setConfiguration method 
            of the component 
      }

      for each <mount> tag {
        store an instance of the sub-sitemap object into the 
            variable generated above
        provide the Configuration at the setConfiguration method 
            of the sub-sitemap 
      }
    }

    for each <resource> tag {
      define a method with the process signature from interface
          Processor 
      {
        generate code to build a Pipeline which represents this 
            resource
        [see the process method how such code is generated
      }
    }

    process method (from interface Processor) {
      for each <pipeline> tag {
        try {
          generate the code to build a Pipeline object 
            [This is straight forward code generation using <match> 
            [and <choose> to
            [build if-else trees. The returned Maps of the matchers 
            [will be pushed onto a Stack
            [and a resolver method uses this Stack of Maps to resolve
            [URIs that contains xpath references to placeholders
            [references.
            [At a <serializer> tag we should have a complete Pipeline
            [object constructed 
            [which can be processed and control can be returned.
            [At a <mount> tag processing is delegate to the sub sitemap.
            [At a <redirect-to> with a uri attribute the uri of the
            [request is modified and 
            [the this process method is called again
            [At a <redirect-to> with a resource attribute the
            [corresponding method generated above
            [is called
            [At a <read> tag a utility method is called to produce the
            [resource requested
            [without processing a Pipeline
        } catch {
          build a Pipeline object from the <handle-errors> fragment
            [this uses a special generator which produces SAX from a
            [Exception
        }
      }        
    }
  }

I still have no idea (or not reflected sufficently) how views and labels
can be incorporated into this class. I hope someone can help me here.

Any comments and suggestions as very welcome.

Giacomo

-- 
PWR GmbH, Organisation & Entwicklung      Tel:   +41 (0)1 856 2202
Giacomo Pati, CTO/CEO                     Fax:   +41 (0)1 856 2201
Hintereichenstrasse 7                     Mailto:Giacomo.Pati@pwr.ch
CH-8166 Niederweningen                    Web:   http://www.pwr.ch