cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Miles Elam <mi...@pcextremist.com>
Subject Flow questions
Date Fri, 17 Jan 2003 04:17:46 GMT
With the hope of using WebDAV or XML POST to update XML items on the 
server, I've been looking at Flow.  If you just want to see my flow 
questions, feel free to skip the preamble.

<PREAMBLE>

The back end data store is a PostgreSQL database whose relevant table 
looks something like this.  It has been abbreviated for clarity.

CREATE TABLE "shows" (
  "id" serial NOT NULL,
  "category" character varying(96), -- Useful for searches by topic
  "topic" character varying(64) NOT NULL,
  "abstract" character varying(1024),
  "promo" character varying(1024),
  "content" text,
  "liveDate" timestamp(0) with time zone,
  Constraint "shows_pkey" Primary Key ("id")
);

The incoming XML is based upon simplified docbook and looks something 
like this:

<show xmlns="http://geekspeak.org/2.0">
  <showinfo>
    <pubdate>2003-01-20T18:30:00-08:00</pubdate>
    <topic>Small Web Dev Survival</topic>
    <participationgroup>
      <participant userid="3"/>
      <participant userid="5"/>
      <participant userid="7"/>
    </participationgroup>
    <promo>On the next Geek Speak: Jasper Larence, CEO of Words and 
Images of
      Santa Cruz, joins the Geeks for a discussion about the status of
      web development as a business.  [The quick growth of the Internet 
lead to
      an acute need for web development companies.  The crash saw the 
death of
      many of these new ventures.]  The survival of the web creation 
industry
      on GeekSpeak, Monday [tomorrow/tonight] at 6:30pm on Central Coast 
Public
      Radio, KUSP.</promo>
    <abstract>
      <para>Jasper Larence, CEO of
        <orgname><ulink url="http://www.wordsandimages.com">Words &amp;
        Images</ulink></orgname> of Santa Cruz, joins the Geeks for a
        discussion about the status of web development as a business.  The
        quick growth of the Internet lead to a large need for web 
development
        companies.  The crash saw the death of many of these new 
ventures, but
        some companies like Words &amp; Images are still around.  Learn
        why.</para>
    </abstract>
  </showinfo>
  <section>
    <title>What is web development?</title>
    <para>Blah blah blah blah blah...</para>
  </section>
</show>

At first, I thought to convert the XML into XSP/ESQL.  That turned out 
to be a mess to the third power: a completely unmaintainable mess of 
markup and Java code.  I wouldn't expect anyone to happily fix any of my 
bugs in that rats nest nor would I expect to happily fix them myself six 
months down the road.

The next thought was Actions, but that was just keeping the code 
relatively out of sight.  It seemed fairly clumsy for any non-trivial 
amount (more than 100 lines) of logic and made the sitemap kinda crufty 
as well.

</PREAMBLE>



Next came Flow.  Although I didn't have multiple pages to work with as 
is the case with a wizard, it seemed to make a lot of sense in a 
predominantly procedural logic approach.  However, I ran into a few 
snags -- mostly related to lack of documentation (yes, I realize it's 
alpha and the API may be pulled out from under me...I'm prepared to deal 
with the search/replace/debug repercussions).  I'll keep my code snippet 
as short as possible.

function saveShow () {
  var showData;
  try {
    var factory      = 
javax.xml.parsers.DocumentBuilderFactory.newInstance();
    var builder      = factory.newDocumentBuilder();
    var showDocument = builder.parse( /* Somehow get the XML POST data 
in here */ );

    var showData = getShowData(showDocument);
  } catch ( e ) {
    sendPageAndContinue("showerror");
  }

  try {
    var dbConn = /* Somehow get the datasource by name */.getConnection();
    var dbStatement = dbConn.createStatement();
    // ...snip a whole bunch of extraneous JDBC logic...
  } catch (sqle) {
    sendPageAndContinue("showerror");
  }
}

1) How do I get XML POST data into the function (eg. equivalent to 
StreamGenerator)?
2) How do I look up a Cocoon datasource by name in JavaScript/Flow?
3) BSF question: Do I always have to call "foo.getBar()" or will 
"foo.bar" work?
4) Am I doing something that will drive me into a brick wall, but I 
can't see it yet?  (Is this the correct approach to the problem?)

Thanks,

- Miles



---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>


Mime
View raw message