cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Upayavira" ...@upaya.co.uk>
Subject [CLI] Breaking CocoonBean Interface
Date Mon, 02 Jun 2003 09:53:42 GMT
Dear All,

As my first commit, I want to post some changes to the CLI that I've had waiting 
for some time. Before doing so, I wanted to make sure that these do not cause 
any problems, as they break the current interface of the CocoonBean.

Please let me know if there is any reason why I shouldn't commit this. If I don't 
hear any, I'll just get on and do it.

The changes include:
1) Improved broken link handling
   Specify whether or not a broken link file should be generated
   Specify whether the broken link file should be plain text or XML
   Specify whether a file should be generated for a broken link
   Specify whether this generated file should have an extension appended
   None of this breaks any interfaces, so it should be non-contentious
   Default behaviour is as before
2) Replaced Destination interface with ModifiableSources

If you use a URI file, or provide the URI to spider via a command line argument, 
behaviour should remain the same (i.e. specify a destination folder and one or 
more Cocoon URIs to generate).

If you use the xconf file, you have new options (old behaviour still works). These 
all relate to how the final file's URI is built up from the generated page's URI and 
the specified destination URI.

   <!-- The old behaviour - appends uri to the specified destination directory -->
   <uri>documents/index.html</uri>

   <!-- Append: append the generated page's URI to the end of the source URI. -->
   <uri type="append" src-prefix="documents/" src="index.html" dest="build/dest/"/>

   <-- Replace: Completely ignore the generated page's URI - just use the 
destination URI -->
   <uri type="replace" src-prefix="documents/" src="index.html" 
dest="build/dest/docs.html"/>

   <!-- Insert: Insert generated page's URI into the destination URI at the point 
marked with a * (example uses fictional zip protocol) -->
   <uri type="insert" src-prefix="documents/" src="index.html" 
dest="zip://*.zip/page.html"/>

It is this that breaks the interface to the CocoonBean. Now, instead of passing a 
Map of destinations, or a single destination, you call addTarget(). There are a 
number of versions of this method, with increasing functionality:

CocoonBean cocoon = new CocoonBean();

// Functionality most like before:
cocoon.setDestDir("built/dest/");
cocoon.addTarget("documents/index.html");

// Another way of achieving the same (allows multiple targets to use different
// destination directories)
cocoon.addTarget("documents/index.html", "build/dest/");

// Allows you to specify a prefix for the source URI, which is excluded from the 
// URI of the final generated file
cocoon.addTarget("documents/", "index.html", "build/dest/");

// Allows you to specify all the above, including a method for creating the 
// destination URI from the generated page's URI and the specified destination
// URI
cocoon.addTarget("append", "documents/", "index.html", "build/dest");

In any of the above that specify a destination URI, you can use any URI that is 
Modifiable, such as FTP, XML databases, CVS repositories, etc.

One of my next tasks is a VFS source, giving access to some nice new 
ModifiableSources.

I'll update the Wiki (with a new 2.1 doc and a CocoonBean page too) soon.

I hope you all like it.

Regards, Upayavira


Mime
View raw message