a while ago, andreas suggested i file an enhancement bug for a
ConfigurableInstantiator that will take a list of files to copy. this is
probably a good idea. i wonder whether it could be made simpler than the
current one (which looks designed to frighten little children ;) if all
the patching is done not by individual sax calls but with external xsl
snippets and exported variables. like so:

* the user clicks "new publication", selects <pub_template>, enters
<pub_id> and <pub_name> and sets <pub_ac_behaviour> to either
"refer_to_template_ac", "copy_template_ac" or "create_new_ac". (the last
option would trigger the creation of a new admin account, so that the
user is not locked out.)

* the servlet looks in
context:///lenya/pubs/<pub_template>/config/instantiate.xml, which looks
like this:

<!--
  This configuration file governs the instantiation of publications that
  use this one as a template. All paths are relative to this
  publication's base dir (pubs/<this-pub>).
  Include all files that need to be copied over to the new publication
  (mode="copy") or referenced by it (mode="fallback"). You can patch the
  files on the fly with xsl:template statements.
-->
<instantiate>
<!--
  The following variables are exported by the
  publication.createPublicationFromTemplate usecase:
-->
  <!-- the name of the template (=this publication)-->
  <xsl:param name="pub_template"/>

  <!-- the id of the new pub -->
  <xsl:param name="pub_id"/>

  <!-- the name of the new pub -->
  <xsl:param name="pub_name"/>

  <!-- how to handle access control. can be one of
    "refer_to_template_ac",
    "copy_template_ac" or
    "create_new_ac".
  -->
  <xsl:param name="pub_ac_behaviour"/>

  <file mode="copy" src="publication.xml">
    <xsl:template match="lenya:name">
      <lenya:name><xsl:value-of select="$pub_name"/></lenya:name>
    </xsl:template>
    <xsl:template match="lenya:description">
      <lenya:description>
        This publication is an instance of the template
        "<xsl:value-of select="$pub_template"/>". Refer to <a
href="some/doc.html">the documentation</a> for manual fine-tuning.
      </lenya:description>      
    </xsl:template>
  <file>
<!--
        same for config/publication.xconf,
        config/index_manager_index.xconf, config/index_manager.xconf,
        config/ac/passwd/, config/ac/ac.xconf,
        config/ac/policies/, config/ac/usecase-policies.xml,
        config/workflow/workflow.xml, content/
-->
</instantiate>

the ac-related stuff would have all sorts of <xsl:choose> tags depending
on the value of $pub_ac_behaviour, but you get the idea.

i did not give an example for <file mode="fallback"/>, since i'm not
sure how to do it. is there a generic way to create an xml file that
basically says "look somewhere else", either with a fallback:// uri or a
static context:// uri?


as mentioned in another posting, i think the user should not be required
to touch java code in order to use and tune the behaviour of templates.
xsl OTOH is a mandatory skill for lenya anyway, and ideally it would be
used for most of the non-gui-interaction with lenya's internals.


i'd appreciate your comments.

regards,

jörn



-- 
"Án nýrra verka, án nútimans, hættir fortíðin að vekja áhuga."
"Without new works, without the present the past will cease to be of
interest."
        - Ásmundur Sveinsson (1893-1982)

--
Jörn Nettingsmeier, EDV-Administrator
Institut für Politikwissenschaft
Universität Duisburg-Essen, Standort Duisburg
Mail: [EMAIL PROTECTED], Telefon: 0203/379-2736


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to