Re: [Mav-user] I want to switch to Maverick....

2004-06-15 Thread Eelco Hillenius
Hi,

I created a small example to illustrate things...

Take this configuration file:

(maverick.xml)

--



























--

and then this control:

(XMLCtrl)

--
package nl.openedge.maverick.example.ctrl;

import java.util.HashMap;
import java.util.Map;

import org.infohazard.maverick.ctl.ThrowawayBean2;
import org.infohazard.maverick.flow.ControllerContext;

/**
 * Simple XML test for Maverick.
 * @author Eelco Hillenius
 */
public class XMLCtrl extends ThrowawayBean2
{
  // dummy doc 1
private static final String xml1 =
""
+ ""
+ "  Hi there"
+ "  "
+ " "
+ "   Page1"
+ " "
+ "  "
+ "";

  // dummy doc 2
private static final String xml2 =
""
+ ""
+ "  Again"
+ "  "
+ " "
+ "   Page2"
+ " "
+ "  "
+ "";

/** simple 'xml db' */
private static Map xmldb = new HashMap(2);
static
{
  xmldb.put("doc1", xml1);
  xmldb.put("doc2", xml2);
}

/**
 * this parameter is set by Maverick when provided as a request
 * parameter (like http://myserver/myapp/mycmd.m?view=myview);
 * we use it to get the proper view.
 */
private String view;
/**
 * the id of the xml document to use.
 */
private String docid;

/*
 * @see org.infohazard.maverick.ctl.ThrowawayBean2#perform()
 */
protected String perform() throws Exception
{
  // note that by now the properties 'view' and 'docid' should be
populated
  // from the request
ControllerContext cctx = getCtx();
String xml = getXML(docid);
cctx.setModel(xml); // will serve as concrete view for the
transforms
return view;
}

/**
 * Get the test XML document; this could also be of type
   * 
   *   java.lang.String
   *   java.io.Reader
   *   javax.xml.transform.Source
   *   org.w3c.dom.Node
   * 
 * @param docid id of the document to get
 * @return the xml doc as a String
 */
private String getXML(String docid)
{
return (String)xmldb.get(docid);
}

  // we need the getters and setters in order to be able to populate the
  // properties from the view
public String getDocid() { return docid; }
public String getView() { return view; }
public void setDocid(String string) { docid = string; }
public void setView(String string) { view = string; }
}


--

And finally, these XSLT templates:

(transform1.xsl)

--


http://www.w3.org/1999/XSL/Transform";>
  

  

  

  

  

  


  

  

  
 
  
  




Created with transform1.xsl
  

  




--

(transform2.xsl)

--

http://www.w3.org/1999/XSL/Transform";>
  

  

  

  

  

  


  

  

  
 
  
  




Created with transform2.xsl
  

  



--

Now, get this stuff into your webapp and test urls like (e.g.)
http://localhost:8080/yourwebapp/getxmldoc.m?view=view

Re: [Mav-user] I want to switch to Maverick....

2004-06-15 Thread Peter
Hi Eelco,

Thank you for your reply - you are spot on in your assumption.
I am now trying to implement a "first try" of Mav and find  it is so simple 
and clean compared to Cocoon. 

To illustrate my problem described in my previous post.

eg: http://easyspeedy.com/products/pricelist.html 
http://easyspeedy.com/products/datatransferusage.html
is this the way to implement "one directory many different documents" command.



 


or should i implement the ShuntFactory interface to make my own controller 
that exposes the request obj ? 

Peter


On Tuesday 15 June 2004 20:45, Eelco Hillenius wrote:
> 1. It sounds to me that you do not need a lot of different commands, but
> possibly a lot of different views... If you need to do some Java action on
> a specific request, you can do that with a controller. You will (probably)
> at least end up with the number commands that you need to have controller
> classes. On the other hand, if most of your processing actually takes place
> in the XSL processing, and most of the time your controller does little
> more than just getting the XML from your XML repository, you could just
> define one command for that, and e.g. use a request parameter to figurure
> out which view (and thus which XSL transform) to use.
>
> 2. If the above works for you, your configuration file is probably not that
> big. Note that you can define your views globally (with all the transforms
> etc.) and reference them in the command definitions. If it still is too
> big, see if pre-prosessing the config file with XSLT works for you. See
> configuration option 'configTransform'.
>
> Eelco
>
> - Original Message -
> From: "Peter L-S" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, June 15, 2004 1:12 PM
> Subject: [Mav-user] I want to switch to Maverick
>
> > Hi,
> >
> > We have used Cocoon for 2 years and sadly it has evolved into a 234 armed
> > octopus.
> > Last night I was again trying to "fix" another Cocoon2 issue, and in
> > desperation I started googleing for another "java xml xslt framework"
> > than Cocoon.
> >
> > After a some time I ended up with Maverick.java
> >
> > We are running a live website using Cocoon2/eXist xmldb/xslt/jBoss and if
> > possible move slowly towards Maverick, implementing the Maverick servlet
> > alongside the cocoon servlet.
> >
> > I have read the manual looked at the examples downloaded the source and
> > is very impressed of the simplicity of this implementation.
> >
> >
> > 1. we have a ton of xml docs located in the eXist db. They are all
>
> transformed
>
> > using xslt and serialized as html. I can do all this using xslt in Mav.
> > without any problem but how do I serve all these html pages just using
> > one  (is this right).
> >
> > 1a. can i use wildcard/regex in the  ?
> >
> > 3. what html form template/validation system is the defacto standard with
>
> Mav.
>
> > 4. does it require 2 Mav. servlets to serve /product/xx.html and
> > /distros/xx.html.
> >
> > 5. can is split the maverick.xml file into more files so it would be
>
> easier to
>
> > manage. (some of our cocoon.xml files are +1500 lines)
> >
> >
> > Thanks in advance.
> >
> >
> > --
> > Med venlig hilsen / Yours sincerely
> >
> > Peter
> > http://easyspeedy.com
> > ___
> > European Dedicated Server Hosting
> > Extremely low prices, secure, and reliable
> > Linux and BSD distributions only
> > ___
> >
> >
> > ---
> > This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
> > Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
> > Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
> > REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
> > [INVALID FOOTER]
>
> ---
> This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
> Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
> Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
> REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
> [INVALID FOOTER]

-- 
Med venlig hilsen / Yours sincerely 
 
Peter
http://easyspeedy.com 
___ 
European Dedicated Server Hosting 
Extremely low prices, secure, and reliable
Linux and BSD distributions only 
___


---
This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
[INVALID FOOTER]


Re: [Mav-user] I want to switch to Maverick....

2004-06-15 Thread Peter
Hi Jaap,

Thanks - 

Peter
On Tuesday 15 June 2004 18:29, Jaap van Hengstum wrote:
> To answer your last question, maybe you can split your xml file using
> external entities (as explained f.e. here:
> http://xml.oreilly.com/news/learningxml_0101.html?CMP=ILC-0PY480989785).
> Though I did not use this personally with the maverick xml file, it should
> work with any xml file.
>
>
> ---
> This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
> Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
> Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
> REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
> [INVALID FOOTER]

-- 
Med venlig hilsen / Yours sincerely 
 
Peter
http://easyspeedy.com 
___ 
European Dedicated Server Hosting 
Extremely low prices, secure, and reliable
Linux and BSD distributions only 
___


---
This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
[INVALID FOOTER]


Re: [Mav-user] I want to switch to Maverick....

2004-06-15 Thread Eelco Hillenius
1. It sounds to me that you do not need a lot of different commands, but
possibly a lot of different views... If you need to do some Java action on a
specific request, you can do that with a controller. You will (probably) at
least end up with the number commands that you need to have controller
classes. On the other hand, if most of your processing actually takes place
in the XSL processing, and most of the time your controller does little more
than just getting the XML from your XML repository, you could just define
one command for that, and e.g. use a request parameter to figurure out which
view (and thus which XSL transform) to use.

2. If the above works for you, your configuration file is probably not that
big. Note that you can define your views globally (with all the transforms
etc.) and reference them in the command definitions. If it still is too big,
see if pre-prosessing the config file with XSLT works for you. See
configuration option 'configTransform'.

Eelco

- Original Message - 
From: "Peter L-S" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 15, 2004 1:12 PM
Subject: [Mav-user] I want to switch to Maverick


> Hi,
>
> We have used Cocoon for 2 years and sadly it has evolved into a 234 armed
> octopus.
> Last night I was again trying to "fix" another Cocoon2 issue, and in
> desperation I started googleing for another "java xml xslt framework" than
> Cocoon.
>
> After a some time I ended up with Maverick.java
>
> We are running a live website using Cocoon2/eXist xmldb/xslt/jBoss and if
> possible move slowly towards Maverick, implementing the Maverick servlet
> alongside the cocoon servlet.
>
> I have read the manual looked at the examples downloaded the source and is
> very impressed of the simplicity of this implementation.
>
>
> 1. we have a ton of xml docs located in the eXist db. They are all
transformed
> using xslt and serialized as html. I can do all this using xslt in Mav.
> without any problem but how do I serve all these html pages just using one
>  (is this right).
>
> 1a. can i use wildcard/regex in the  ?
>
> 3. what html form template/validation system is the defacto standard with
Mav.
>
> 4. does it require 2 Mav. servlets to serve /product/xx.html and
> /distros/xx.html.
>
> 5. can is split the maverick.xml file into more files so it would be
easier to
> manage. (some of our cocoon.xml files are +1500 lines)
>
>
> Thanks in advance.
>
>
> -- 
> Med venlig hilsen / Yours sincerely
>
> Peter
> http://easyspeedy.com
> ___
> European Dedicated Server Hosting
> Extremely low prices, secure, and reliable
> Linux and BSD distributions only
> ___
>
>
> ---
> This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
> Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
> Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
> REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
> [INVALID FOOTER]



---
This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
[INVALID FOOTER]


RE: [Mav-user] I want to switch to Maverick....

2004-06-15 Thread Jaap van Hengstum
To answer your last question, maybe you can split your xml file using external 
entities (as explained f.e. here: 
http://xml.oreilly.com/news/learningxml_0101.html?CMP=ILC-0PY480989785). Though I did 
not use this personally with the maverick xml file, it should work with any xml file.


---
This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
[INVALID FOOTER]


[Mav-user] I want to switch to Maverick....

2004-06-15 Thread Peter L-S
Hi,

We have used Cocoon for 2 years and sadly it has evolved into a 234 armed 
octopus. 
Last night I was again trying to "fix" another Cocoon2 issue, and in 
desperation I started googleing for another "java xml xslt framework" than 
Cocoon.

After a some time I ended up with Maverick.java

We are running a live website using Cocoon2/eXist xmldb/xslt/jBoss and if 
possible move slowly towards Maverick, implementing the Maverick servlet 
alongside the cocoon servlet.

I have read the manual looked at the examples downloaded the source and is 
very impressed of the simplicity of this implementation. 


1. we have a ton of xml docs located in the eXist db. They are all transformed 
using xslt and serialized as html. I can do all this using xslt in Mav. 
without any problem but how do I serve all these html pages just using one 
 (is this right).

1a. can i use wildcard/regex in the  ?

3. what html form template/validation system is the defacto standard with Mav. 

4. does it require 2 Mav. servlets to serve /product/xx.html and 
/distros/xx.html.

5. can is split the maverick.xml file into more files so it would be easier to 
manage. (some of our cocoon.xml files are +1500 lines) 


Thanks in advance.


-- 
Med venlig hilsen / Yours sincerely 
 
Peter
http://easyspeedy.com 
___ 
European Dedicated Server Hosting 
Extremely low prices, secure, and reliable
Linux and BSD distributions only 
___


---
This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
[INVALID FOOTER]