You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Maring, Steve" <St...@tvratings.com> on 2001/04/25 22:09:57 UTC

sitemap reprocessed during runtime?

Simple question.  Is the sitemap getting reprocessed during runtime?  i.e.
If I add a resource to my sitemap, do I have to bounce my servlet container?
If not, is there some process that checks for changes?  And how often does
it do it?

thanks.
-Steve
Tarpon Springs, FL

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

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


Re: xsp database access

Posted by Berin Loritsch <bl...@apache.org>.
Berin Loritsch wrote:
> 
> Jay Wright wrote:
> >
> > I'm trying to work through the best ways to use a database with cocoon.  I
> > would like to use a bean, DataBaseBean, which gets the  loads the class
> > driver and creates a Connection object.
> >
> > I'd love to see a good example of the way someone EFFICIENTLY opens a
> > database connection in an xsp page and hear any comments on "best practices"
> > regarding this.
> >
> > Also, does the resultant Java class file extend HTTPServlet?  Can I use
> > init() and destroy() methods as I would in a servlet?
> 

I just looked at the title: XSP database access.

You will find that using the esql logicsheet will take care of almost all of your
needs.  What's more, your code will work with both Cocoon 1 and Cocoon 2.  The
esql logicsheet takes care of the connections for you.

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

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


Re: xsp database access

Posted by Berin Loritsch <bl...@apache.org>.
Jay Wright wrote:
> 
> I'm trying to work through the best ways to use a database with cocoon.  I
> would like to use a bean, DataBaseBean, which gets the  loads the class
> driver and creates a Connection object.
> 
> I'd love to see a good example of the way someone EFFICIENTLY opens a
> database connection in an xsp page and hear any comments on "best practices"
> regarding this.
> 
> Also, does the resultant Java class file extend HTTPServlet?  Can I use
> init() and destroy() methods as I would in a servlet?

Cocoon 1 or 2?

Both offer solutions for database pooling, and both offer their relative
benefits.  I am most familiar with Cocoon 2, so I can offer my viewpoints
in that regard.

In the case of Cocoon 2, I would not spend time building a DataBaseBean,
because the hard work has been done for you.  There is a DataSourceComponent
that is modeled after the JDBC 2.0 specs, and allows you to get a pooled
connection that checks to see if the server has severed the connection with
the driver.  That way, the Connection object you get is guaranteed to work.
Cocoon 2 uses the Avalon Framework, and to get at the Pool, you need to
have your Component (Generator, Transformer, Action, etc.) implement the
Composable interface.  There are some abstract classes for you to use to
make life easier:

class MyAction extends ComposerAction {
    public Map act(EntityResolver resolver, Map ObjectModel,
                   String src, Parameters param) {

         ComponentSelector dbselector = null;
         DataSourceComponent datasource = null;
         Connection connection = null;

         try {
             dbselector = (ComponentSelector) manager.lookup(Roles.DB_CONNECTION);
             datasource = (DataSourceComponent) dbselector.select("my-pool");
             connection = datasource.getConnection();

             // .... Do DB stuff

             connection.commit();
         } catch (Exception e) {
             if (connection != null) {
                 connection.rollback();
             }

             getLogger().debug("Error with database", e);
         } finally {
             if (connection != null) {
                 connection.close();
             }

             if (dbselector != null) {
                 manager.release(dbselector);
             }
         }
    }
}

Cocoon is built on a Component based architecture (conceptually more
rigid than JavaBeans, but semantically more flexible--in fact a Component
can be a JavaBean).

No matter which way you slice it, you most likely won't be extending
HTTPServlet when working with Apache Cocoon.  Cocoon is built around the
Avalon Framework.  Cocoon 1 represents a much earlier version of the
framework, and Cocoon 2 uses the current version.  You would be building
classes (or using already created classes) when working with Cocoon.

Check out the docs.  You may find that you can focus your attention on
other areas.

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

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


xsp database access

Posted by Jay Wright <bl...@teleport.com>.
I'm trying to work through the best ways to use a database with cocoon.  I
would like to use a bean, DataBaseBean, which gets the  loads the class
driver and creates a Connection object.

I'd love to see a good example of the way someone EFFICIENTLY opens a
database connection in an xsp page and hear any comments on "best practices"
regarding this.

Also, does the resultant Java class file extend HTTPServlet?  Can I use
init() and destroy() methods as I would in a servlet?

Thanks,
Jay



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

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


Re: sitemap reprocessed during runtime?

Posted by giacomo <gi...@apache.org>.

On Wed, 25 Apr 2001, Maring, Steve wrote:

> Simple question.  Is the sitemap getting reprocessed during runtime?  i.e.
> If I add a resource to my sitemap, do I have to bounce my servlet container?
> If not, is there some process that checks for changes?  And how often does
> it do it?

The modification date of the sitemap is checked on every request.
However there are options to prevent that.

Giacomo


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

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