RE: redirect at the end of a pipeline/match

2003-06-05 Thread Neil Palmer
I'm looking to do the same thing - I'm using Cocoon purely for it's 
XML generation/transformation capabilities, while my actual application
is using JBoss/Jetty  Struts.

Basically I have an admin app that allows you to marshall a business 
object via Castor, perform various transformations on it and then 
serialize the result to an XML file.  This XML file will then get 
pushed out to production for use on the front end customer facing app.
However, I'd love to be able to redirect back to the admin home page 
after the xml serializaton.  I'm not actually using Cocoon for any
content presentation.

I've only been using Cocoon (2.0.4) for a couple of months, so if
there's a better way of doing this, I'm all ears.  While the redirect
after the serialization isn't critical, it'd certainly be nice.

cheers,
neil.

-Original Message-
From: Geoff Howard [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 04, 2003 2:05 PM
To: [EMAIL PROTECTED]
Subject: Re: redirect at the end of a pipeline/match

What would the purpose be of sending xml back as a result and then
redirecting the client?  This need keeps coming up when using the
transformers with side effects, of which the sql transformer is one.

Again, why do you need to redirect?  Why not serve them the content
you want them to have right away?

Geoff

At 01:46 PM 6/4/2003, you wrote:
I'm looking for a clean way to 'redirect' a user back to a page, at the

end of a pipeline.

map:match pattern='comment'
map:generate src=xml/insert_comment.xml/
map:transform type=sql
map:parameter name=use-connection value=myconnection/
map:transform
map:serialize type=xml/
REDIRECT or something here/
/map:match

map:redirect doesn't work because it skips the generate and transform. 
Browsing through the mail archive someone suggest's using a meta
redirect 
tag in generated html. 
(http://marc.theaimsgroup.com/?l=xml-cocoon-usersm=105464887116737w=2
)

This would work but it seems clunky.. There must be a cleaner way to 
accomplish this.?

-Daniel


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


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



TextParserGenerator question

2003-03-27 Thread Neil Davies
Is there actually a working TextParserGenerator? I've not seen any 
examples of anyone using it on the web.

I can't get Cocoon to recognise it in the sitemap decleration.

Thanks

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


error trying to use TextParserGenerator

2003-03-26 Thread Neil Davies




Apologies if this has been answered previously but I'm a relative newbie to Cocoon2.

I have a structured text file which is exported from a database (non SQL, a complete mess so there's no chance of using standard xsl logic to extract data) and need to convert it into ead-xml.

I am trying to see if I am capable of doing this using a TextParserGenerator to get it into an XML format that I can manipulate into ead. Unfortunately I keep getting the following Internal Server Error:

type fatal
message Error in sitemap configuration : org.apache.cocoon.generation.TextParserGenerator
description org.apache.avalon.framework.configuration.ConfigurationException: Error in sitemap configuration : org.apache.cocoon.generation.TextParserGenerator
sender org.apache.cocoon.servlet.CocoonServlet
source Cocoon servlet

Here's the bulk of the sitemap:

map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0"
map:components
	map:generators default="file"
map:generator name="textparser"
	   src=""/
/map:generators
-- other components --
/map:components
map:pipelines
map:pipeline
map:match pattern=""
map:generate src="" type="textparser"
		map:parameter name="grammar" value="ead.grm"/
		map:parameter name="includeignorabletokens" value="false"/
/map:generate
map:serialize type="xml"/
/map:match
/map:pipeline
/map:pipelines
/map:sitemap

If the grammer file would be helpful I'll post it, but I'll try and keep this minimal for now.

Thanks.





Re: error trying to use TextParserGenerator

2003-03-26 Thread Neil Davies


Is there a detailed exception in the logs under WEB-INF/logs/*.log ?
(Perhaps you must set the log level higher)
With this exception I can only draw the conclusion, that the generator
have problems with the configuration within the components section.
Stephan.

Okay. I have looked at the error.log file, I meant to mention this in my 
last email but I sent it without realising I hadn't, and it mentioned a 
ClassNotFoundException on the TextParserGenerator. I have looked in the 
sitemap.xmap in the jakara-home/webapps/cocoon directory and there is no 
mention of a TextParserGenerator in there, which must be causing the 
problem.

I am using Cocoon 2.0.4, which is the latest version I think. Is the 
TextParserGenerator included with this? The other generators work 
without any bother.

Can anyone point me in the direction of some information on this 
subject? I have looked at the user-documentation on the 
TextParserGenerator online.

Here is the error-report if it is of any help:

ERROR   (2003-03-26) 17:24.25:543   [core.manager] (/cocoon/eadcairs) 
Thread-10/Handler: Error compiling sitemap
org.apache.avalon.framework.configuration.ConfigurationException: Error 
in sitemap configuration : org.apache.cocoon.generation.TextParserGenerator
   at 
org.apache.cocoon.www.file_.C_.jakarta_tomcat.webapps.cocoon.c2.eadcairs.sitemap_xmap.configure(C:\jakarta-tomcat\work\Standalone\localhost\cocoon\cocoon-files\org/apache/cocoon/www/file_/C_/jakarta_tomcat/webapps/cocoon/c2/eadcairs\sitemap_xmap.java:148)
   at 
org.apache.avalon.excalibur.component.DefaultComponentFactory.newInstance(DefaultComponentFactory.java:264)
   at 
org.apache.avalon.excalibur.component.ThreadSafeComponentHandler.initialize(ThreadSafeComponentHandler.java:98)
   at 
org.apache.cocoon.components.language.generator.GeneratorSelector.addGenerator(GeneratorSelector.java:187)
   at 
org.apache.cocoon.components.language.generator.ProgramGeneratorImpl.createResource(ProgramGeneratorImpl.java:357)
   at 
org.apache.cocoon.components.language.generator.ProgramGeneratorImpl.load(ProgramGeneratorImpl.java:312)
   at org.apache.cocoon.sitemap.Handler.run(Handler.java:267)
   at java.lang.Thread.run(Thread.java:536)
Caused by: java.lang.ClassNotFoundException: 
org.apache.cocoon.generation.TextParserGenerator
at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1428)
   at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1274)
   at org.apache.cocoon.util.ClassUtils.loadClass(ClassUtils.java:88)
   at 
org.apache.cocoon.sitemap.AbstractSitemap.load_component(AbstractSitemap.java:263)
   at 
org.apache.cocoon.www.file_.C_.jakarta_tomcat.webapps.cocoon.c2.eadcairs.sitemap_xmap$Configurer.configGenerators(C:\jakarta-tomcat\work\Standalone\localhost\cocoon\cocoon-files\org/apache/cocoon/www/file_/C_/jakarta_tomcat/webapps/cocoon/c2/eadcairs\sitemap_xmap.java:170)
   at 
org.apache.cocoon.www.file_.C_.jakarta_tomcat.webapps.cocoon.c2.eadcairs.sitemap_xmap.configure(C:\jakarta-tomcat\work\Standalone\localhost\cocoon\cocoon-files\org/apache/cocoon/www/file_/C_/jakarta_tomcat/webapps/cocoon/c2/eadcairs\sitemap_xmap.java:126)
   at 
org.apache.avalon.excalibur.component.DefaultComponentFactory.newInstance(DefaultComponentFactory.java:264)
   at 
org.apache.avalon.excalibur.component.ThreadSafeComponentHandler.initialize(ThreadSafeComponentHandler.java:98)
   at 
org.apache.cocoon.components.language.generator.GeneratorSelector.addGenerator(GeneratorSelector.java:187)
   at 
org.apache.cocoon.components.language.generator.ProgramGeneratorImpl.createResource(ProgramGeneratorImpl.java:357)
   at 
org.apache.cocoon.components.language.generator.ProgramGeneratorImpl.load(ProgramGeneratorImpl.java:312)
   at org.apache.cocoon.sitemap.Handler.run(Handler.java:267)
   at java.lang.Thread.run(Thread.java:536)

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


Re: Cocoon-2.1-dev build fails

2003-03-25 Thread neil
Re: http://marc.theaimsgroup.com/?l=xml-cocoon-usersm=104862608911688w=2

I like the way the build tries to let you include just what you want, but there
are a few little problems with it. Yesterday I checked out the CVS HEAD and now
using jdk-1.4.1, windows2000/cygwin ...

1.
I tried excluding blocks I don't need by using local.blocks.properties, but when I ran
cocoon (in tomcat-4.1.18) I got:

java.lang.NoClassDefFoundError: EDU/oswego/cs/dl/util/concurrent/Executor
at org.apache.cocoon.Cocoon.contextualize(Cocoon.java:204)
at 
org.apache.cocoon.servlet.CocoonServlet.createCocoon(CocoonServlet.java:1304)
at org.apache.cocoon.servlet.CocoonServlet.init(CocoonServlet.java:505)
at 
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:934)

It seems that src/blocks/xmldb/lib/xmldb-api-2001.jar includes the package
EDU/oswego/cs/dl/util/concurrent which is referenced elsewhere. So the xmldb block
cannot be excluded.

2.
I tried to exclude samples and docs:

./build.sh  -Dinclude.webapp.libs=yes \
-Dexclude.webapp.samples=yes \
-Dexclude.webapp.documenation=yes \
-Dexclude.webapp.javadocs=yes war

and got:

Writing: C:\cocoon-2.1\build\webapp\WEB-INF\cocoon.xconf

scratchpad-samples:
Copying 57 files to C:\cocoon-2.1\build\webapp\samples
Copied 1 empty directory to C:\cocoon-2.1\build\webapp\samples
Copying 87 files to C:\cocoon-2.1\build\webapp\samples

BUILD FAILED
file:///C:/cocoon-2.1/build.xml:637: IOException: java.io.FileNotFoundException:
 C:\cocoon-2.1\build\webapp\samples\samples.xml (The system cannot find the file
 specified)


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



RE: Cocoon-2.1-dev build fails

2003-03-25 Thread neil
Re: http://marc.theaimsgroup.com/?l=xml-cocoon-usersm=104865067609362w=2

1. Ok, lib/core/util.concurrent-1.3.1.jar has been added to fix this.
   (I'd added 1.3.2 locally and that also works).

2. I had a look at build.xml and figured out that I need:

./build.sh \
 -Dinclude.webapp.libs=yes \
 -Dexclude.webapp.samples=yes \
 -Dexclude.webapp.documenation=yes \
 -Dexclude.webapp.javadocs=yes \
 -Dexclude.scratchpad=yes \
 -Dexclude.webapp.scratchpad=yes \
 -Dexclude.webapp.idldocs=yes \
 war

to build a minimal cocoon.war. This works fine.
(got a runtime error (when running cocoon) when I also tried -Dexclude.deprecated=yes).

Cheers,
Neil Bacon

-Original Message-
From: Geoff Howard [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 26 March 2003 3:06 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: Cocoon-2.1-dev build fails


Neil, I can't reproduce this problem.  I did build clean and excluded xmldb
block via local.blocks.properties.  The build ran fine, and cocoon started
up with no error (in jetty, but still...).  After trying a fresh cvs update,
and a build clean if you still have this problem can you specify what other
blocks you're excluding if any and how to reproduce the no class def error
(like what samples page?).  Also, since you obviously have both tomcat and
jetty ready to go, can you try it in jetty (cocoon.bat servlet).

Geoff

 -Original Message-
 From: neil [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, March 25, 2003 5:22 PM
 To: Cocoon-Users (E-mail)
 Subject: Re: Cocoon-2.1-dev build fails


 Re: http://marc.theaimsgroup.com/?l=xml-cocoon-usersm=104862608911688w=2

 I like the way the build tries to let you include just what you
 want, but there
 are a few little problems with it. Yesterday I checked out the
 CVS HEAD and now
 using jdk-1.4.1, windows2000/cygwin ...

 1.
 I tried excluding blocks I don't need by using
 local.blocks.properties, but when I ran
 cocoon (in tomcat-4.1.18) I got:

 java.lang.NoClassDefFoundError: EDU/oswego/cs/dl/util/concurrent/Executor
   at org.apache.cocoon.Cocoon.contextualize(Cocoon.java:204)
   at
 org.apache.cocoon.servlet.CocoonServlet.createCocoon(CocoonServlet
 .java:1304)
   at
 org.apache.cocoon.servlet.CocoonServlet.init(CocoonServlet.java:505)
   at
 org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapp
 er.java:934)

 It seems that src/blocks/xmldb/lib/xmldb-api-2001.jar
 includes the package
 EDU/oswego/cs/dl/util/concurrent which is referenced elsewhere.
 So the xmldb block
 cannot be excluded.

 2.
 I tried to exclude samples and docs:

 ./build.sh  -Dinclude.webapp.libs=yes \
 -Dexclude.webapp.samples=yes \
 -Dexclude.webapp.documenation=yes \
 -Dexclude.webapp.javadocs=yes war

 and got:

 Writing: C:\cocoon-2.1\build\webapp\WEB-INF\cocoon.xconf

 scratchpad-samples:
 Copying 57 files to C:\cocoon-2.1\build\webapp\samples
 Copied 1 empty directory to C:\cocoon-2.1\build\webapp\samples
 Copying 87 files to C:\cocoon-2.1\build\webapp\samples

 BUILD FAILED
 file:///C:/cocoon-2.1/build.xml:637: IOException:
 java.io.FileNotFoundException:
  C:\cocoon-2.1\build\webapp\samples\samples.xml (The system
 cannot find the file
  specified)


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






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



Re: writing excel files with merge and coloured cells

2003-03-11 Thread neil
In reply to: http://marc.theaimsgroup.com/?l=xml-cocoon-usersm=104725042020751w=2

Although gnumeric xml allows any colour to be specified, excel only has a 56 colour 
palette.
This page shows excel's default palette (some details depend on the version):
  http://www.mvps.org/dmcritchie/excel/colors.htm
If you choose a colour that isn't in the palette I think you get white. All the 
colours I've tried
from this palette have worked except no. 45: #FF9900.




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



patch for esql:skip-rows and esql:max-rows with Sybase and MS SQL server

2003-02-17 Thread neil
The new implementation for esql:skip-rows and esql:max-rows
in 
src/java/org/apache/cocoon/components/language/markup/xsp/AbstractEsqlConnection.java
is pretty neat, especially for oracle.

1) Unfortunately, Sybase Adaptive Server Enterprise does not support select TOP,
   only Sybase Adaptive Server Anywhere. Both use urls starting with jdbc:sybase:
   so some other means must be used to distinguish between them.

2) MS SQL Server also supports select TOP, so SybaseEsqlQuery should be used with it 
too.

Here is a patch to address this stuff:

--- 
/cygdrive/c/xml-cocoon2/src/blocks/databases/java/org/apache/cocoon/components/language/markup/xsp/AbstractEsqlConnection.java
Sat Feb  1 09:49:18 2003
+++ 
+../src/java/org/apache/cocoon/components/language/markup/xsp/AbstractEsqlConnection.java
+Tue Feb 18 12:00:38 2003
@@ -122,6 +122,19 @@


 /**
+ * Sybase has 2 RDBMS products. The Sybase JDBC driver uses a url starting with 
+jdbc:sybase: for both.
+ * Here are the product names and versions returned from the Sybase JDBC driver:
+ *getMetaData().getDatabaseProductName()  
+getMetaData().getDatabaseProductVersion()
+ * 1) Adaptive Server Anywhere7.0.4.3373
+ * 2) Sybase SQL Server   Adaptive Server 
+Enterprise/12.0.0.3/P/SWR 9777 ESD 4/NT (IX86)/OS
4.0/1699/32bit/OPT/Wed Sep 05 21:14:50 2001
+ * The first supports select TOP as used by SybaseEsqlQuery, but the second 
+does not.
+ */
+private boolean isSybaseAdaptiveServerAnywhere() throws SQLException {
+   String databaseProductName = 
+getConnection().getMetaData().getDatabaseProductName().toLowerCase();
+   return databaseProductName.indexOf(anywhere)  -1;
+}
+
+/**
  * Factory method for creating an EsqlQuery object. If type is set to
  *  or auto it will try to find type from the JDBC connection URL.
  * If this does not succeed the generic JDBC type will be assumed.
@@ -144,6 +157,15 @@
 query = new MysqlEsqlQuery(this,queryString);
 }
 else if (url.startsWith(jdbc:sybase:)) {
+   if (isSybaseAdaptiveServerAnywhere()) {
+   query = new SybaseEsqlQuery(this,queryString);
+   } else {
+   query = new JdbcEsqlQuery(this,queryString);
+   }
+}
+   else if(url.startsWith(jdbc:microsoft:sqlserver:)) {
+   // MS SQL Server also supports select TOP like Sybase ASA
+   // Maybe SybaseEsqlQuery should be renamed to something like 
+SelectTopEsqlQuery?
 query = new SybaseEsqlQuery(this,queryString);
 }
 else if (url.startsWith(jdbc:oracle:)) {
@@ -155,6 +177,13 @@
 }
 }
 else if (sybase.equalsIgnoreCase(type)) {
+   if (isSybaseAdaptiveServerAnywhere()) {
+   query = new SybaseEsqlQuery(this,queryString);
+   } else {
+   query = new JdbcEsqlQuery(this,queryString);
+   }
+}
+else if (mssqlserver.equalsIgnoreCase(type)) {
 query = new SybaseEsqlQuery(this,queryString);
 }
 else if (postgresql.equalsIgnoreCase(type)) { query = new 
PostgresEsqlQuery(this,queryString);


-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Re: Excel needs filename?

2003-01-27 Thread neil
Problem: IE not recognizing Excel data generated by cocoon as being an Excel 
spreadsheet.

1) This is due to a bug in HSSFSerializer.java, where the mime-type is hardcoded as 
vnd.ms-excel
   (the correct mime-type for Excel is application/vnd.ms-excel). Once this is fixed 
it works fine
   with IE/Excel so the problem is not due to a bug in IE.

2) HSSFSerializer.java ignores any mime-type configured in the sitemap. This is 
reasonable
   because there is only one correct value so it may as well be hardcoded. 
Unfortunately the example
   sitemap includes this mime-type configuration and this has misled many innocent 
folk into thinking
   that they are using the correct mime-type when they are not.

ref to previous discussion on this:
http://marc.theaimsgroup.com/?l=xml-cocoon-usersm=103895523032418w=2
Subject: Re: HSSFSerializer mime-type
Date:2002-12-03

-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Cocoon generated Excel data and IIS with WebDav

2003-01-27 Thread neil
People generating dynamic Excel data and using MS IIS may hit this problem. I've 
posted it because it affects cocoon users, even
though its not really anything to do with cocoon.

Environment
---
MS IIS v5 web server with dynamic content redirected to tomcat/cocoon.


Problem
---
Some client PC's see cocoon generated excel data correctly (data shown in an Excel 
spreadsheet inside the IE window), but other PC's
get the applications session timed out HTML page displayed inside Excel!
I'm not sure if its related to the version of IE, but I sometimes had the problem with 
IE5 and sometimes didn't have
it with IE6.
The problem goes away if the client bypasses IIS by using tomcat's port 8080.


Solution

Disable webdav in IIS v5 by adding an entry to the registry. Put the following in a 
*.reg file then double click it.

REGEDIT4
; Disable WebDAV for IIS 5.0 - see 
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q241520;
; otherwise some IE browser's perform a WebDAV LOCK on the URL after downloading an 
Excel spreadsheet.
; Cocoon seems to treat the LOCK as a GET, but since the request has no sessionID it 
redirects to the
; SessionTimedOut page.
; If you need WebDAV then removing NTFS write access from all files and dirs in the 
application should
; also work.
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC\Parameters]
DisableWebDAV=dword:0001


Cause
-
WebDAV allows you to use your web browser to open/lock/write files served by a web 
server.
In IIS5 WebDAV is always enabled for any files/dirs that have NTFS write permission 
unless you disable it using regedit.

IIS  cocoon logs show that when some versions of IE download a cocoon generated excel 
spreadsheet they do this:

METHOD: POST on URL /cocoon/pinnacle/asReportByType.xsp
this generates the excel data

METHOD: OPTIONS (an HTTP 1.1 method) on URL /cocoon/pinnacle
since I've configured only *.xsp to be redirected IIS responds.
IIS must say something about whether the URL is WebDAV editable.

METHOD: LOCK (a WebDAV extension to HTTP 1.1) on URL 
/cocoon/pinnacle/asReportByType.xsp
This request is generated by the browser, but it has no session and has a header:
  user-agent=Microsoft Data Access Internet Publishing Provider DAV 1.1

Cocoon logs the method as LOCK but treats it the same as a GET (and my application 
doesn't check the method).
Since there's no session my application redirects to the session timed out page.
This page gets displayed inside Excel instead of the Excel report.


-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Re: Does Cocoon work in Jetty?

2002-12-04 Thread neil
Yes I've got cocoon-2.0.3_branch and 2.1-dev working in both jetty-4.2.2 and 
tomcat-4.1.12 with no hassles
(but I'm not using JSP or jboss). I do get this exception when jetty starts - maybe 
its related to your problem:

10:20:42.207 WARN!!
org.mortbay.util.MultiException[java.lang.ClassNotFoundException: org.apache.jas
per.servlet.JspServlet]
at org.mortbay.http.HttpServer.start(HttpServer.java:655)
at org.mortbay.jetty.Server.main(Server.java:404)
[0]=java.lang.ClassNotFoundException: org.apache.jasper.servlet.JspServlet
at java.net.URLClassLoader$1.run(URLClassLoader.java:198)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
at org.mortbay.http.ContextLoader.loadClass(ContextLoader.java:236)
at org.mortbay.http.ContextLoader.loadClass(ContextLoader.java:200)
at org.mortbay.http.HttpContext.loadClass(HttpContext.java:1315)
at org.mortbay.jetty.servlet.Holder.start(Holder.java:161)
at org.mortbay.jetty.servlet.ServletHolder.start(ServletHolder.java:204)

at org.mortbay.jetty.servlet.ServletHandler.initializeServlets(ServletHa
ndler.java:445)
at org.mortbay.jetty.servlet.WebApplicationHandler.initializeServlets(We
bApplicationHandler.java:163)
at org.mortbay.jetty.servlet.WebApplicationContext.start(WebApplicationC
ontext.java:502)
at org.mortbay.http.HttpServer.start(HttpServer.java:678)
at org.mortbay.jetty.Server.main(Server.java:404)


-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Re: HSSFSerializer mime-type

2002-12-03 Thread neil
No, although the example sitemap includes config that looks like its setting the 
mime-type
HSSFSerializer.java doesn't actually use it. Its hardcoded - and I think its 
reasonable to
hardcode it as there is only one correct value (its just that the current hardcoded 
value
isn't it).

Andrew C. Oliver [EMAIL PROTECTED] wrote:
 IIRC this is configurable...  

 neil wrote:

 The HSSFSerializer hardcodes the mime-type as vnd.ms-excel whereas I think it \
 should be application/vnd.ms-excel (at lease that works better for me). Without \
 this I got erratic behavior with IE/Excel - sometimes the spreadsheet would appear \
 inside the IE window (excel inside IE) and othertimes it would appear inside a \
 separate Excel window. 


-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Re: Problem with a store procedure in a XSP page

2002-11-24 Thread neil
Since the 2.0.3 release there have been fixes applied to esql in the 
cocoon_2_0_3_branch (that's a CVS tag). These fixes are for
stored procedure support, so I suggest you try them. I've been using them with stored 
procs in Oracle 8i, SQL Server (7  2000),
Sybase (ASA  ASE) and it works great.


-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




XSP caching with 2.1-dev

2002-11-21 Thread neil
Hi cocooners,
I'm just trying the CVS HEAD and have a problem with some of my old 2.0.3 XSP's which 
used to be cached for 30mins.

generateValidity() now has to return a org.apache.excalibur.source.SourceValidity 
instead of a
org.apache.cocoon.caching.CacheValidity.
I used to return org.apache.cocoon.caching.DeltaTimeCacheValidity(30, 0) to cache for 
30 mins.
Is there a new substitute for this or do I have to write my own?

P.S. I like the look of the XForm  flow stuff and the performance of xsltc!
Cheers,
Neil.


-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Re: Redirect in XSP

2002-11-08 Thread Neil A
Hi all

I joined the cocoon users list today to ask a very similar question.

I have a list of external URLs held in XML and I have a pipeline to 
pick the right one.  I want to use map:redirect-to within the 
sitemap, but I can't find a way to get the URL out of XML and make it a 
sitemap parameter for map:redirect-to to use.

Can anyone help us both?

Thanks,

Neil.


On Friday, November 8, 2002, at 09:41 AM, Witold Treliski wrote:

Hi!

I have a question. How to make o redirection in XSP from one page to 
other
depeneding on some code in xsp:logic? I tried 
xsp-response:send-redirect
url=any/ and it doesn't work.

WT


-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




RE: avalon.excalibur ping of oracle fails

2002-10-15 Thread neil

In cocoon.xconf, the oradb attribute in pool-controller oradb=true is apparently no 
longer used.
Instead, a child element allows you to specify the sql to be used to ping the database 
connection
like this:
  pool-controller max=5 min=2
keep-alive disable=falseselect 1 from dual/keep-alive
  /pool-controller
If you don't specify keep-alive it defaults to select 1, which seems to be OK for 
everything
except Oracle.

-Original Message-
From: neil [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, 10 September 2002 3:23 PM
To: Cocoon-Users (E-mail)
Subject: avalon.excalibur ping of oracle fails


Hi,
Has anyone using oracle already solved this one?

Although my app works OK, I'm getting debug messages (shown below) indicating that the 
database ping fails
so cocoon is dicarding the connection and creating a new one.
I guess its going slower than it could due to this.

I do have
  datasources
jdbc ...
  pool-controller oradb=true ...
in my cocoon.xconf, but this doesn't seem to be finding its way into
org.apache.avalon.excalibur.datasource.AbstractJdbcConnection where it executes the 
query
to ping the database (a different query for oracle than for other rdbms's).

My cocoon is a snapshot of the cocoon_2_0_3_branch taken on 2002-08-16 and
has WEB-INF/lib/avalon-excalibur-vm14-20020705.jar.


-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




fix EncodeURLTransformer to process page that generates the session

2002-09-18 Thread neil

Hi,
I've just started using org.apache.cocoon.transformation.EncodeURLTransformer and 
found it works fine
except for the first page generated after my login page i.e. the page that creates the 
session.

I see that it uses
request.isRequestedSessionIdFromURL()
to determine whether any encoding is required, but this is false for the page that 
creates the session.

If I change the test from
if ( request.isRequestedSessionIdFromURL() ) {
to
  final String fred = fred.html;
if ( request.isRequestedSessionIdFromURL() || 
!fred.equals(response.encodeURL(fred)) ) {
then it works for this page too. Maybe there's a neater way to do the same thing?

Without this fix a workaround would be to create the session when the login form is 
generated
instead of when its posted.
Cheers,
Neil.


-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




avalon.excalibur ping of oracle fails

2002-09-09 Thread neil

Hi,
Has anyone using oracle already solved this one?

Although my app works OK, I'm getting debug messages (shown below) indicating that the 
database ping fails
so cocoon is dicarding the connection and creating a new one.
I guess its going slower than it could due to this.

I do have
  datasources
jdbc ...
  pool-controller oradb=true ...
in my cocoon.xconf, but this doesn't seem to be finding its way into 
org.apache.avalon.excalibur.datasource.AbstractJdbcConnection
where it executes the query
to ping the database (a different query for oracle than for other rdbms's).

My cocoon is a snapshot of the cocoon_2_0_3_branch taken on 2002-08-16 and
has WEB-INF/lib/avalon-excalibur-vm14-20020705.jar.

The avalon-excalibur src can be examined here:
http://cvs.apache.org/viewcvs.cgi/jakarta-avalon-excalibur/datasource/src/java/org/apache/avalon/excalibur/datasource/AbstractJdbcCo
nnection.java?rev=1.16content-type=text/vnd.viewcvs-markup



DEBUG   (2002-09-10) 13:54.51:787   [core.datasources.webtest_ora] 
(/cocoon/pinnacle/assetDetail.xsp)
HttpProcessor[8080][1]/ResourceLimitingPool: Got a 
org.apache.avalon.excalibur.datasource.Jdbc3Connection from the pool.
DEBUG   (2002-09-10) 13:54.51:787   [core.datasources.webtest_ora] 
(/cocoon/pinnacle/assetDetail.xsp)
HttpProcessor[8080][1]/AbstractJdbcConnection: Pinging database after 6910ms of 
inactivity.
DEBUG   (2002-09-10) 13:54.51:837   [core.datasources.webtest_ora] 
(/cocoon/pinnacle/assetDetail.xsp)
HttpProcessor[8080][1]/AbstractJdbcConnection: Ping of connection failed.
java.sql.SQLException: ORA-00923: FROM keyword not found where expected

at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:643)
at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:1674)
at 
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1870)
at 
oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:363)
at 
oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:314)
at 
org.apache.avalon.excalibur.datasource.AbstractJdbcConnection.isClosed(AbstractJdbcConnection.java:154)
at
org.apache.avalon.excalibur.datasource.ResourceLimitingJdbcConnectionPool.validatePoolable(ResourceLimitingJdbcConnectionPool.java:1
08)
at 
org.apache.avalon.excalibur.pool.ValidatedResourceLimitingPool.get(ValidatedResourceLimitingPool.java:99)
at 
org.apache.avalon.excalibur.datasource.ResourceLimitingJdbcDataSource.getConnection(ResourceLimitingJdbcDataSource.java:174)
at
org.apache.cocoon.www.file_.C_.jakarta_tomcat_4_0_4_LE_jdk14.webapps.cocoon.pinnacle.oracle.locationAction_xsp.generate(C:\jakarta-t
omcat-4.0.4-LE-jdk14\work\Standalone\localhost\cocoon\cocoon-files\org/apache/cocoon/www/file_/C_/jakarta_tomcat_4_0_4_LE_jdk14/weba
pps/cocoon/pinnacle/oracle\locationAction_xsp.java:335)


-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




RE: esql patch for paging and ResultSets from Oracle stored procs

2002-08-18 Thread neil

I would rather esql copied the type from esql:parameter direction=out 
type=oracle.jdbc.driver.OracleTypes.CURSOR/
directly into the generated code than use reflection as in EsqlQuery.getType() to get 
the int value (this is a change
made after cocoon-2.0.3). The generated code is DBMS specific either way so there is 
nothing wrong with it referencing
a DBMS specific class.

SQLTransformer has to use reflection because its acting as an interpreter and 
executing the queries directly rather than generating
code to do so.
Regards,
Neil.



-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




RE: esql patch for paging and ResultSets from Oracle stored procs

2002-08-18 Thread neil

Here is a small patch to esql.xsl r1.13.2.8

1) fix runtime compilation error described in a previous posting to this thread
copy the type from esql:parameter direction=out 
type=oracle.jdbc.driver.OracleTypes.CURSOR/
directly into the generated code rather than use reflection as in EsqlQuery.getType()
(which should be removed if this patch is applied). Argument for doing this was 
presented in my
previous posting.

2) add paging for result set obtained from a column
e.g.
esql:call-results
  esql:use-results
esql:resultesql:get-object column=8 from-call=true//esql:result

esql:skip-rowsxsp:exprsessionData.getRow() - 
1/xsp:expr/esql:skip-rows

esql:max-rowsxsp:exprsessionData.getRowsPerPage()/xsp:expr/esql:max-rows


Index: src/java/org/apache/cocoon/components/language/markup/xsp/java/esql.xsl
===
RCS file: 
/home/cvspublic/xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/java/esql.xsl,v
retrieving revision 1.13.2.8
diff -u -b -r1.13.2.8 esql.xsl
--- src/java/org/apache/cocoon/components/language/markup/xsp/java/esql.xsl 11 Aug 
2002 20:08:57 -  1.13.2.8
+++ src/java/org/apache/cocoon/components/language/markup/xsp/java/esql.xsl 19 Aug 
+2002 01:06:50 -
@@ -1,6 +1,7 @@
 ?xml version=1.0?!-- -*- xsl -*- --

-!-- $Id: esql.xsl,v 1.13.2.8 2002/08/11 20:08:57 haul Exp $--
+!-- $Id: esql.xsl,v 1.15 2002/08/19 00:24:23 neil Exp $--
+!-- Modified from Apache's Id: esql.xsl,v 1.13.2.8 2002/08/11 20:08:57 haul Exp --
 !--

  
@@ -56,7 +57,7 @@
  * ESQL Logicsheet
  *
  * @author ?
- * @version CVS $Revision: 1.13.2.8 $ $Date: 2002/08/11 20:08:57 $
+ * @version CVS $Revision: 1.15 $ $Date: 2002/08/19 00:24:23 $
 --

 xsl:stylesheet version=1.0
@@ -978,12 +979,27 @@

 xspdoc:desccreates a nested query like block that uses the result set obtained from 
a column as current result set./xspdoc:desc
 xsl:template name=use-results match=esql:use-results[child::esql:result]
+  xsl:variable name=maxrowsxsl:call-template 
+name=get-nested-stringxsl:with-param name=content
select=esql:max-rows//xsl:call-template/xsl:variable
+  xsl:variable name=skiprowsxsl:call-template 
+name=get-nested-stringxsl:with-param name=content
select=esql:skip-rows//xsl:call-template/xsl:variable
 xsp:logic
   // nested result set
 if (_esql_query != null) {
   _esql_queries.push(_esql_query);
 }
 _esql_query = new EsqlQuery((ResultSet) xsl:apply-templates 
select=esql:result/*/);
+
+xsl:if test=esql:max-rows
+  try {
+_esql_query.setMaxRows( Integer.parseInt(String.valueOf(xsl:copy-of 
+select=$maxrows/).trim()) );
+  } catch (NumberFormatException e) {}
+/xsl:if
+
+xsl:if test=esql:skip-rows
+  try {
+_esql_query.setSkipRows( Integer.parseInt(String.valueOf(xsl:copy-of 
+select=$skiprows/).trim()) );
+  } catch (NumberFormatException e) {}
+/xsl:if
+
 {
xsl:call-template name=do-results/
 }
@@ -1098,7 +1114,8 @@
 xsl:when test=$type='AsciiStream'Types.LONGVARCHAR/xsl:when
 xsl:when test=$type='UnicodeStream'Types.LONGVARCHAR/xsl:when
 xsl:when test=$type='BinaryStream'Types.VARBINARY/xsl:when
-xsl:when test=contains($type,'.')EsqlQuery.getType(xsl:value-of 
select=$type/)/xsl:when
+!-- handle DBMS specific types e.g. oracle.jdbc.driver.OracleTypes.CURSOR --
+xsl:when test=contains($type,'.')xsl:value-of select=$type//xsl:when
 xsl:otherwiseTypes.xsl:value-of
select=translate(@type,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')//xsl:otherwise
   /xsl:choose
 /xsl:template



-Original Message-
From: neil [mailto:[EMAIL PROTECTED]]
Sent: Monday, 19 August 2002 9:57 AM
To: '[EMAIL PROTECTED]'; Cocoon-Users (E-mail)
Subject: RE: esql patch for paging and ResultSets from Oracle stored
procs


I would rather esql copied the type from esql:parameter direction=out 
type=oracle.jdbc.driver.OracleTypes.CURSOR/
directly into the generated code than use reflection as in EsqlQuery.getType() to get 
the int value (this is a change
made after cocoon-2.0.3). The generated code is DBMS specific either way so there is 
nothing wrong with it referencing
a DBMS specific class.

SQLTransformer has to use reflection because its acting as an interpreter and 
executing the queries directly rather than generating
code to do so.
Regards,
Neil.



-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




RE: esql patch for paging and ResultSets from Oracle stored procs

2002-08-16 Thread neil

I just tried the latest from the cocoon_2_0_3_branch and got...

org.apache.cocoon.components.language.LanguageException: Error compiling control_xsp:
Line 448, column 45:  unreported exception: java.lang.IllegalAccessException; must be 
caught or declared to be thrown

Line 448 in control_xsp.java is:
registerOutParameter(1, 
EsqlQuery.getType(oracle.jdbc.driver.OracleTypes.CURSOR));

EsqlQuery.getType(String typeName) throws ClassNotFoundException, 
NoSuchFieldException, IllegalAccessException

These need to be declared as thrown in the generated code (or caught, logged, and 
something else thrown).




Also, I don't think paging works within esql:call-results/esql:use-results e.g.:

esql:call-results
  esql:use-results
esql:resultesql:get-object column=8 from-call=true//esql:result

esql:skip-rowsxsp:exprsessionData.getRow() - 
1/xsp:expr/esql:skip-rows

esql:max-rowsxsp:exprsessionData.getRowsPerPage()/xsp:expr/esql:max-rows
I'll look into this one next week.

Regards,
Neil.


-Original Message-
From: Christian Haul [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 8 August 2002 6:51 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: esql patch for paging and ResultSets from Oracle stored
procs

[snip]

 Changed get-Sql-Type so that an unrecognized type is copied verbatim into
 the java code without having Types.

Not applied -- I believe it's better to follow the SQLTransformer here
that uses Class.forName(). Reason: reduce XSP dependency from
DBMS. Drawback: Since it's runtime it's slightly slower, OTOH an
intelligent compiler could optimize it away. Hence, different patch
applied.

[snip]


-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




patch to fix NullPointerException from xsp-request:get-parameter-values

2002-06-03 Thread neil

I've got a form that posts multiple values for a request parameter (multiple
instances of input type=text name=paramName/).

request.getParameterValues() returns a String[] with an element for each
posted value.
If nothing is entered into into one of the text fields the corresponding
element in the String[] is null, but this isn't handled by
xsp-request:get-parameter-values. The stacktrace is included in the
following patch to fix the problem:


--- XSPRequestHelper.java.1.11  Tue Jun  4 15:32:54 2002
+++ XSPRequestHelper.java   Tue Jun  4 15:05:28 2002
@@ -68,8 +68,19 @@

 /**
  * The codeRequest/code object helper
+ * pre
+ * Modified by Pinnacle Software to fix:
+ *
+ * java.lang.NullPointerException
+ * at
org.apache.cocoon.components.language.markup.xsp.XSPObjectHelper.data(XSPObj
ectHelper.java:196)
+ * at
org.apache.cocoon.components.language.markup.xsp.XSPObjectHelper.elementData
(XSPObjectHelper.java:93)
+ * at
org.apache.cocoon.components.language.markup.xsp.XSPRequestHelper.getParamet
erValues(XSPRequestHelper.java:291)
+ * at
org.apache.cocoon.www.pinnacle.assetComponents_xsp.generate(C:\jakarta-tomca
t-4.0.4-b3\work\Standalone\localhost\cocoon\cocoon-files\org/apache/cocoon/w
ww/pinnacle\assetComponents_xsp.java:1299)
+ * at
org.apache.cocoon.generation.ServerPagesGenerator.generate(ServerPagesGenera
tor.java:260)
+ * /pre
  *
  * @author a href=mailto:[EMAIL PROTECTED];Ricardo Rocha/a
+ * @version Modified from Apache's version CVS Id: XSPRequestHelper.java,v
1.11 2002/02/27 05:33:50 vgritsenko Exp
  * @version CVS $Id: XSPRequestHelper.java,v 1.1 2002/06/04 04:52:31 neil
Exp $
  */
 public class XSPRequestHelper {
@@ -278,15 +289,18 @@
 String[] values = request.getParameterValues(name);
 if (values != null) {
 for (int i = 0; i  values.length; i++) {
-if(form_encoding != null  values[i] != null 
-values[i].length()  0) {
-try {
-values[i] = new
String(values[i].getBytes(container_encoding),
-form_encoding);
-} catch(java.io.UnsupportedEncodingException uee) {
-throw new RuntimeException(Unsupported Encoding
Exception:  +
-uee.getMessage());
-}
+   if (values[i] != null) {
+   if(form_encoding != null  values[i].length()  0) {
+   try {
+   values[i] = new 
+String(values[i].getBytes(container_encoding),
+  form_encoding);
+   } catch(java.io.UnsupportedEncodingException uee) {
+   throw new RuntimeException(Unsupported Encoding 
+Exception:  +
+  uee.getMessage());
+   }
+   }
+   } else {
+   values[i] = ;
 }
 XSPObjectHelper.elementData(URI, PREFIX, contentHandler,
 value, values[i]);


-
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: esql v1.22 multiple returned update counts and ResultSets

2002-05-22 Thread neil

   I settled for Torstens solution without @index. Both requirements
  (different /
   same esql:results) are difficult to provide. Please suggest a syntax
for
  that.
  Some possibilities are to reuse the last one or to add a 'default'
attribute
  or some such.
  But I wouldn't bother unless there is some consensus that its a good
idea.

 I'm undecided on this one. I fear both solutions are difficult to work
 with. But as I hardly have the requirement to process several results,
 I have no strong opinion.

I'll try your changes out sometime soon, but for now I'm still using my
patch but with your switch
statements added. I've added a default case to the switch:

  xsl:for-each select=esql:update-results
  case xsl:value-of select=position()/: xsl:apply-templates
select=./
break;
  /xsl:for-each
  default: xsl:apply-templates
select=esql:update-results[last()]/
break;

This allows you to reuse the same esql:update-results if you want to.
Likewise for esql:results and esql:no-results.
Its not difficult to work with and I think its an option worth having even
though its not strictly necessary.

Cheers,
Neil.


-
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: esql v1.22 multiple returned update counts and ResultSets

2002-05-21 Thread neil

On 22 May 2002 Christian Haul wrote:

  The loop test cannot be:
   } while(_esql_query.getMoreResults());
  because this would stop the loop whenever the next result is an update
count
  (without processing this update count and any following results). Please
  read the javadoc carefully any try experimenting with a simple
standalone
  test programme.

 Neil, please look at the actual code. EsqlQuery.getMoreResults() does a
lot
 more than Statement.getMoreResults().
OK. I didn't spot that your change depends on updates to other files too.
Picky minor point: Although I don't like the semantics of JDBCs
getMoreResults()
I like even less having different semantics for the same method name in
EsqlQuery.

  Please also note from the JDK javadocs: For maximum portability, a
call's
  ResultSet objects and update counts should be processed prior to getting
the
  values of output parameters.
  This was the wrong way around in esql 1.22.

 Again, please look at the code. EsqlQuery.getMoreResults() retrieves the
 update count and keeps it for later reference. Further calls to
EsqlQuery.getUpdateCount()
 will return the buffered result.
Thats nice, but not relevant to the Sun doco that I quoted. I'll rephrase
it: fetching OUT
parameters should be done after processing all returned results.

From esql.xsl 1.24:
  xsl:if test=esql:call
// call results
xsp:content
  xsl:apply-templates select=esql:call-results/
/xsp:content
  /xsl:if

  xsl:call-template name=do-results/

My understanding is that fetching OUT parameters is done within
esql:call-results
and processing returned results is done by esql:do-results. If so it is done
the
wrong way around.

 I settled for Torstens solution without @index. Both requirements
(different /
 same esql:results) are difficult to provide. Please suggest a syntax for
that.
Some possibilities are to reuse the last one or to add a 'default' attribute
or some such.
But I wouldn't bother unless there is some consensus that its a good idea.

 So, could you please check with the current code whether it does what it
should?
I'm trying to get minimum modifications to cocoon-2.0.2 to do what I need.
I can't just switch from a stable release to the latest CVS snapshot (boring
I know).
Do you think I should try the latest esql.xsl, EsqlQuery.java 
EsqlHelper.java
over cocoon-2.0.2 or do you know of other updates that these depend on
(those are the only files I had to update for my patch).

  PRIVILEGED - PRIVATE AND CONFIDENTIAL
  This email and any files transmitted with it are intended solely for the
use

 Does this indicated we would not be able to use your patch?
Anybody may use it. I'll try to remove that from future postings.

Thanks for your help and the good stuff in esql.
Regards,
Neil.


-
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: esql v1.22 multiple returned update counts and ResultSets

2002-05-19 Thread neil

Re: http://marc.theaimsgroup.com/?l=xml-cocoon-usersm=102165197728849w=2

 note that you are always calling getUpdateCount on the same statement.
will
 it's state be changed?!? That would be indeed a ugly behaviour...
The code I included in the original post is abridged working code that
correctly handles result sets and update counts in any order, as described
in the JDK javadocs. In the case that several update counts are returned
before the first result set then you simply go through the else part of
the loop several times before the if part.
Yes - cs.getMoreResults() changes the state of cs.

 I believe that we actually should expect

 (resultset, update count)
No. The JDK javadoc is quite clear that each result is either:
- a result set (true returned from execute() or getMoreResults()) or
- an update count (false returned)
and not both of these and the code provided shows that it works as
documented.

The loop test cannot be:
 } while(_esql_query.getMoreResults());
because this would stop the loop whenever the next result is an update count
(without processing this update count and any following results). Please
read the javadoc carefully any try experimenting with a simple standalone
test programme.

Please also note from the JDK javadocs: For maximum portability, a call's
ResultSet objects and update counts should be processed prior to getting the
values of output parameters.
This was the wrong way around in esql 1.22.

Its a nice idea to add an index attribute or some such to allow a different
esql:row-results or esql:no-results for each returned result set. But
there should still be a way to use the same esql:row-results or
esql:no-results (maybe a default to use if the index isn't matched).

Here's my patch to esql.xsl v1.22:
- handles any number of result sets and update counts returned in any order
- processes returned result sets and update counts prior to getting the
values of output parameters
but it doesn't add an index attribute to allow different esql:row-results
or esql:no-results for each returned result set.

Its only been tested with MS SQLServer jdbc driver and stored procs
returning one result set (sometimes as the first result and other times
after multiple update counts) and no OUT parameters, but it is hopefully
more general that this.


--- org/apache/cocoon/components/language/markup/xsp/java/esql.xsl.1.22 Fri
May 17 00:41:14 2002
+++ org/apache/cocoon/components/language/markup/xsp/java/esql.xsl  Fri May
17 07:12:56 2002
@@ -1,6 +1,16 @@
 ?xml version=1.0?

-!-- $Id: esql.xsl,v 1.22 2002/05/16 16:10:07 haul Exp $--
+!-- Modified by Pinnacle Software to handle multiple values returned
+ from stored procedures. The values returned can be any sequence of
+ ResultSets and update counts.
+ Pinnacle Software version:
+   $Id: esql.xsl,v 1.5 2002/05/17 07:12:56 neil Exp $
+ Modified copy of Apache's version:
+   Id: esql.xsl,v 1.22 2002/05/16 16:10:07 haul Exp
+ Works with Apache's:
+   EsqlQuery.java,v 1.15
+   EsqlHelper.java,v 1.9
+--
 !--



@@ -56,7 +66,7 @@
  * ESQL Logicsheet
  *
  * @author ?
- * @version CVS $Revision: 1.22 $ $Date: 2002/05/16 16:10:07 $
+ * @version CVS $Revision: 1.5 $ $Date: 2002/05/17 07:12:56 $
 --

 xsl:stylesheet version=1.0
@@ -428,7 +438,7 @@
   /xsl:for-each
   xsl:choose
 xsl:when test=esql:call[@needs-query='true' or
@needs-query='yes']_esql_query.execute(true);/xsl:when
-xsl:when
test=esql:call[@resultset-from-object]_esql_query.execute(xsl:copy-of
select=esql:call[@resultset-from-object]/);/xsl:when
+xsl:when
test=esql:call[@resultset-from-object]_esql_query.execute(xsl:value-of
select=esql:call/@resultset-from-object/);/xsl:when
 xsl:otherwise_esql_query.execute();/xsl:otherwise
   /xsl:choose
 /xsl:when
@@ -445,16 +455,12 @@
 /xsl:otherwise
   /xsl:choose
   getLogger().debug(esql query:  + _esql_query.getQueryString());
-  xsl:if test=esql:call
-// call results
-xsp:content
-  xsl:apply-templates select=esql:call-results/
-/xsp:content
-  /xsl:if
-  if (_esql_query.hasResultSet()) {
-do {
+  // start handling multiple returned update counts and ResultSets ...
+  int countReturnedResults = 0;
+  for ( boolean nextResultIsResultSet = _esql_query.hasResultSet();
true; nextResultIsResultSet = _esql_query.getMoreResults() ) {
+if (nextResultIsResultSet) {
+  ++countReturnedResults;
   _esql_query.getResultRows();
-
   if (_esql_query.nextRow()) {
 xsl:apply-templates select=esql:results/
   }
@@ -462,16 +468,29 @@
 xsl:apply-templates select=esql:no-results/
   }
   _esql_query.getResultSet().close();
-
-} while(_esql_query.getMoreResults());
   } else

SQLTransformer bug that appears under load

2002-04-08 Thread neil

I've been load testing my cocoon app with jmeter and I think I've found a
SQLTransformer bug.
My (MS SQL Server) JDBC driver was complaining about attempts to use various
objects after they had been closed (Connections, ResultSets and Statements).

In Query.execute() I think this bit should be removed:
} finally {
conn.close();
conn = null;// To make sure we don't use this
connection again.
}

as it's incorrect to close the connection before you've finished with the
ResultSets, Statements etc.
The connection is closed later when SQLTransformer.executeQuery() calls
Query.close() anyway.

I know Connection.close() doesn't really close the connection to the DB
(because its a pooled connection it just allows it to be recycled), but I
think its reuse under load does cause problems. By removing these lines I
was able to get my app to work correctly under heavy loads on a dual CPU
Windows 2000 box.


-
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




build error: cocoon-2.0.2, jdk-1.4, Win2000

2002-03-26 Thread neil

In a dos box:
  set PATH=C:\WINNT\system32;C:\WINNT
  set CLASSPATH=
  build clean
  build

First error:

C:\Neil\cocoon-2.0.2\build\cocoon\src\org\apache\cocoon\components\language\
mark
up\xsp\EsqlConnection.java:66: class
org.apache.cocoon.components.language.marku
p.xsp.EsqlConnection must be declared abstract. It does not define int
getHoldability() from interface java.sql.Connection.
public class EsqlConnection implements Connection {

followed by 11 more.

An earlier post:
http://marc.theaimsgroup.com/?l=xml-cocoon-usersm=101622718100348w=2
suggested to ensure that no older jdk's are in the PATH or CLASSPATH,
but I think I've taken care of that.

Some echos I've added to build.xml seem to show that jdbc3.present is
properly set:
filter-jdbc:
nofilter-jdbc:
 [echo] in nofilter-jdbc



-
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Object Oriented Cocoon

2002-03-01 Thread Ellis, Neil (FNB)

Dear All

Firstly Wow! 

What a framework, I am inspired by the level of thought that has gone into
this app/framework.

Anyway, I've been using a simple scripting language I wrote which merely
translates to XSLT with extensions.

Now I've been looking at taking some of the better concepts behind Zope (teh
object oriented python application server) and translate to the world of
XSL/XSLT/XPath et al.

It seems to me that if the sitemaps and translators etc were built from a
script then we can define object types from the sitemap and
translators/serializers etc. With the addition of object oriented features
of inheritance etc then I'm half the way there. Glue on Xindice as an object
store and we've got Zope with a whole load more bells and whistles and
importantly a solid enterprise structure behind it.

I'm interested in hearing if anyone is going down this path already or if
anyone has any views.  I am very new to cocoon and am in search of the right
platform for this venture.

Many regards
Neil Ellis


-
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: sunRise tutorial here

2002-02-28 Thread Ellis, Neil (FNB)

Hi I've just installed cocoon on a linux box redhat 7.1 with sun jdk, tomcat
4.0 and got this ... I've searched the web to no avail... any ideas?
I got a 500 error with:
javax.servlet.ServletException: Servlet.init() for servlet Cocoon2 threw
exception
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:93
5)
at
org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:653)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:214)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:190)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:170)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170
)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
1012)
at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107
)
at java.lang.Thread.run(Thread.java:484)
root cause 
java.lang.NoClassDefFoundError: javax/xml/transform/URIResolver
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:493)
at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
at
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLo
ader.java:1631)
at
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.jav
a:926)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
a:1360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:292)
at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
at
org.apache.avalon.excalibur.component.ExcaliburComponentManager.configure(Ex
caliburComponentManager.java:408)
at org.apache.cocoon.Cocoon.configure(Cocoon.java:406)
at org.apache.cocoon.Cocoon.initialize(Cocoon.java:267)
at
org.apache.cocoon.servlet.CocoonServlet.createCocoon(CocoonServlet.java:991)
at
org.apache.cocoon.servlet.CocoonServlet.init(CocoonServlet.java:308)
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:91
6)
at
org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:653)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:214)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:190)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5

RE: sunRise tutorial here

2002-02-28 Thread Ellis, Neil (FNB)

My thanks.

 -Original Message-
 From: Jean-Philippe Courson [SMTP:[EMAIL PROTECTED]]
 Sent: 28 February 2002 16:38
 To:   [EMAIL PROTECTED]
 Subject:  Re: sunRise tutorial here
 
 You are using tomcat 4.0.2 that causes some problems. For now, use 
 tomcat 4.0.1
 
 Ellis, Neil (FNB) wrote:
  Hi I've just installed cocoon on a linux box redhat 7.1 with sun jdk,
 tomcat
  4.0 and got this ... I've searched the web to no avail... any ideas?
  I got a 500 error with:
  javax.servlet.ServletException: Servlet.init() for servlet Cocoon2 threw
  exception
  at
 
 org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:
 93
  5)
  at
 
 org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:653
 )
  at
 
 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.
 ja
  va:214)
  at
 
 org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java
 :5
  66)
  at
 
 org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472
 )
  at
  org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
  at
 
 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.
 ja
  va:190)
  at
 
 org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java
 :5
  66)
  at
 
 org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472
 )
  at
  org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
  at
 
 org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
  at
 
 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:1
 80
  )
  at
 
 org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java
 :5
  66)
  at
 
 org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValv
 e.
  java:170)
  at
 
 org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java
 :5
  64)
  at
 
 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:1
 70
  )
  at
 
 org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java
 :5
  64)
  at
 
 org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
  at
 
 org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java
 :5
  64)
  at
 
 org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472
 )
  at
  org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
  at
 
 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.ja
 va
  :174)
  at
 
 org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java
 :5
  66)
  at
 
 org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472
 )
  at
  org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
  at
 
 org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.jav
 a:
  1012)
  at
 
 org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:11
 07
  )
  at java.lang.Thread.run(Thread.java:484)
  root cause 
  java.lang.NoClassDefFoundError: javax/xml/transform/URIResolver
  at java.lang.ClassLoader.defineClass0(Native Method)
  at java.lang.ClassLoader.defineClass(ClassLoader.java:493)
  at
  java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
  at
 
 org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClass
 Lo
  ader.java:1631)
  at
 
 org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.j
 av
  a:926)
  at
 
 org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.j
 av
  a:1360)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:292)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
  at
 
 org.apache.avalon.excalibur.component.ExcaliburComponentManager.configure(
 Ex
  caliburComponentManager.java:408)
  at org.apache.cocoon.Cocoon.configure(Cocoon.java:406)
  at org.apache.cocoon.Cocoon.initialize(Cocoon.java:267)
  at
 
 org.apache.cocoon.servlet.CocoonServlet.createCocoon(CocoonServlet.java:99
 1)
  at
  org.apache.cocoon.servlet.CocoonServlet.init(CocoonServlet.java:308)
  at
 
 org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:
 91
  6)
  at
 
 org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:653
 )
  at
 
 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.
 ja
  va:214)
  at
 
 org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java
 :5
  66)
  at
 
 org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472
 )
  at
  org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
  at
 
 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.
 ja
  va:190)
  at
 
 org.apache.catalina.core.StandardPipeline.invokeNext

RE: Calling MS SQL stored procedure

2002-02-21 Thread neil

I'm using substitute-value instead of IN parameters:
query isstoredprocedure=true{ ? = call sp(
'substitute-value sql:name=string_value/',
substitute-value sql:name=int_value/
) }/query

The MS JDBC driver had trouble parsing a query with new lines in it,
but at least it gets by with one long line.

In reply to:
http://marc.theaimsgroup.com/?l=xml-cocoon-usersm=101429060624988w=2


-
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Example use of writeDOMsession / readDOMsession

2002-02-11 Thread neil

Here's a sitemap example (for cocoon-2.0) using writeDOMsession /
readDOMsession (as suggested in the docs) to avoid repetitive queries of
reference tables. It works fine, but I haven't done any benchmarking to find
out if it was worth the trouble (and it was quite a bit of trouble)!

Questions:

1. Is there some way this global data could be saved globally rather than
per session?
I guess a new set of global data matchers, selectors and read/writeDOMGlobal
would be required
(more trouble that its worth to me).

2. Has anybody found this approach to be worthwhile or otherwise?

3. Has anybody got a better way of doing it?

Cheers,
Neil.


!--
Get reference table data.
e.g. Lookup.Staff returns data from the Staff table (query 
defined in
Staff.xml file)
TO DO: make this a 'resource' so its not available externally.

If session attribute org.apache.cocoon.SessionState does not 
contain the
string ,Staff,
then this string is appended to the attribute, the query is 
executed and
the result is saved
to the session attribute pinnacle.Staff.
Otherwise the query is not executed and result is fetched from 
the
session attribute pinnacle.Staff.

SessionState is used because I can match its value against 
various string
values, but I don't know how to
test for the existence of a non-string valued session 
attribute like
pinnacle.Staff.
--
map:match pattern=Lookup.*
!-- If session attribute 
org.apache.cocoon.SessionState does contain
the string ,Staff, --
map:match type=sessionState pattern=*,{1},*
!-- for debugging - In browser's URL field 
you see
LookupStaff.wasNotSetIsNow --
!-- map:redirect-to 
uri=Lookup{../1}.wasAlreadySet/ --
map:generate type=file src=BlankPage.xml/
!-- only contains a page/ --
!--
Append content from session attribute 
pinnacle.Staff after page/
element.
We end up with: page/page... stuff we 
want.../page.
--
map:transform type=readDOMsession
map:parameter name=dom-name 
value=pinnacle.{../1}/
map:parameter name=trigger-element 
value=page/
map:parameter name=position 
value=in/
/map:transform
map:serialize type=xml/
/map:match
!-- Else session attribute 
org.apache.cocoon.SessionState does not
contain the string ,Staff, --
map:match type=sessionState pattern=**
map:act type=sessionState
map:parameter name=new-state 
value={1},{../1},/
!-- append ,Staff, --
!-- for debugging - In browser's URL 
field you see
LookupStaff.wasNotSetIsNow --
!-- map:redirect-to 
uri=Lookup{../../1}.wasNotSetIsNow/ --
!-- execute query defined in 
Staff.xml. --
map:generate type=file 
src={../../1}.xml/
map:transform type=sql
map:parameter 
name=use-connection value=poracle/
/map:transform
!--
Shouldn't really need an XSLT 
transform here, but without it I get
org.xml.sax.SAXException: URI not 
declared
at
org.apache.cocoon.transformation.WriteDOMSessionTransformer.startElement()
in 
cocoon\WEB-INF\logs\cocoon.log.01
Some problem with the sql: namespace 
not being declared.
--
map:transform type=xslt 
src=LookupTables.xsl/
!-- save page element (and its 
descendents) to session attribute

patch to SQLTransformer for result sets returned from stored procedures

2002-02-08 Thread neil

The version of org.apache.cocoon.transformation.SQLTransformer.java in
cocoon 2.0 handles ResultSets returned from a stored procedure as OUT
parameters.

Oracle and some others do this, however MS SQL Server and some others can
return multiple results each of which is either a ResultSet or a count of
updated rows.

The following patch attempts to jack up SQLTransformer v1.24 to handle these
multiple results. It works well enough for what I need, but has only been
tested with a MS SQL Server stored procedure that returns one ResultSet.

v1.24 is the most recent version before SQLTransformer was moved somewhere
else in the source tree. It's more recent than what comes with cocoon 2.0.

If anyone wants to try it or just review the changes and offer suggestions
for improvements please feel free. I just compile this one file and jar the
resulting classes into cocoon\WEB-INF\lib\AAnewstuff.jar and cocoon picks it
up from there.

Cheers,
Neil.

Result of: LC_ALL=C TZ=UTC0 diff -Naurb SQLTransformer-1.24.java
SQLTransformer.java

--- SQLTransformer-1.24.javaThu Feb  7 01:23:52 2002
+++ SQLTransformer.java Fri Feb  8 05:25:10 2002
@@ -35,7 +35,7 @@
  * @author a href=mailto:[EMAIL PROTECTED];Giacomo Pati/a
  * (PWR Organisation  Entwicklung)
  * @author a href=mailto:[EMAIL PROTECTED];Sven Beauprez/a
- * @version CVS $Revision: 1.24 $ $Date: 2001/12/15 00:21:19 $ $Author:
vgritsenko $
+ * @version CVS $Revision: 1.2 $ $Date: 2002/02/08 05:25:10 $ $Author: neil
$
  */

 public class SQLTransformer extends AbstractTransformer implements
Composable, Recyclable, Disposable, Configurable {
@@ -263,7 +263,6 @@
 }

 getLogger().debug( SQLTransformer executing query nr  + index );
-AttributesImpl attr = new AttributesImpl();
 Query query = (Query) queries.elementAt( index );
 boolean query_failure = false;
 try {
@@ -280,19 +279,19 @@
 query_failure = true;
 }
 if ( !query_failure ) {
-
+if ( !query.isStoredProcedure() ) {
+   AttributesImpl rowsetAttr = new AttributesImpl();
 if ( showNrOfRows != null 
showNrOfRows.equalsIgnoreCase( true ) ) {
-attr.addAttribute( my_uri, query.nr_of_rows,
query.nr_of_rows, CDATA,
+   rowsetAttr.addAttribute( my_uri, query.nr_of_rows, 
+query.nr_of_rows,
CDATA,
String.valueOf( query.getNrOfRows() ) );
 }
 String name = query.getName();
 if ( name != null ) {
-attr.addAttribute( my_uri, query.name_attribute,
query.name_attribute, CDATA,
+   rowsetAttr.addAttribute( my_uri, query.name_attribute,
query.name_attribute, CDATA,
name );
 }
-this.start( query.rowset_name, attr );
-attr = new AttributesImpl();
-if ( !query.isStoredProcedure() ) {
+   this.start( query.rowset_name, rowsetAttr );
+   AttributesImpl attr = new AttributesImpl();
 while ( query.next() ) {
 this.start( query.row_name, attr );
 query.serializeRow();
@@ -301,10 +300,10 @@
 }
 this.end( query.row_name );
 }
+   this.end( query.rowset_name );
 } else {
 query.serializeStoredProcedure();
 }
-this.end( query.rowset_name );
 }
 } catch ( SQLException e ) {
 getLogger().debug( SQLTransformer.executeQuery(), e );
@@ -566,7 +565,7 @@

SQLTransformer.MAGIC_OUT_PARAMETER_NR_ATTRIBUTE );
 String type = attributes.getValue( my_uri,

SQLTransformer.MAGIC_OUT_PARAMETER_TYPE_ATTRIBUTE );
-getLogger().debug( OUT PARAMETER NAME + name + ;NR  +
nr + ; TYPE  + type );
+getLogger().debug( OUT PARAMETER NAME  + name + ; NR  +
nr + ; TYPE  + type );
 int position = Integer.parseInt( nr );
 getCurrentQuery().setOutParameter( position, type, name );
 current_state =
SQLTransformer.STATE_INSIDE_OUT_PARAMETER_ELEMENT;
@@ -759,13 +758,13 @@
 class Query {

 /** Who's your daddy? **/
-protected SQLTransformer transformer;
+protected final SQLTransformer transformer;

 /** What index are you in daddy's queries list **/
-protected int query_index;
+protected final int query_index;

 /** SQL configuration information **/
-protected Properties properties;
+protected final Properties properties;

 /** Dummy static variables for the moment **/
 protected String rowset_name = rowset;
@@ -774,29 +773,10 @@
 protected String name_attribute = name;

 /** The connection, once opened

RE: XSP in a stylesheet help

2001-12-19 Thread neil

Wouldn't it be easier to compute the row number in the stylesheet instead of
XSP?

I think xsl:value-of select=position()/ will give you the 1 based index
of the current element
e.g.
a
  b/   !-- position() is 1 --
  row/ !-- position() is 2 --
  row/ !-- position() is 3 --
/a
which might be what you need. Otherwise you could define a variable and
increment it to count the rows.

Great XSLT examples are available at:
http://wwbota.free.fr/XSLT_models/README.htm and sites it refers to (see
http://IncrementalDevelopment.com/xsltrick/ for numeric computations).


-Original Message-
From: Andrew C. Oliver [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 20 December 2001 2:18 AM
To: [EMAIL PROTECTED]
Subject: REQ: XSP in a stylesheet help


Hi all,

(please CC me your response, I get the digest)

I'm working on a stylesheet that is intent on organizing the simple-sql
example page ($COCOON/docs/samples/sql/sql-page.xml) into a gnumeric
style xml spreadsheet.  I'm very close, but I need to an incremental row
number.  I figured I'd just use XSP inside of my stylesheet, but all
I've accomplished so far is a literal printout of what is in between the
xsp:expr tags.  I thought perhaps I needed some other directives
inside the cocoon configuration but I've not

Attached is my stylesheet so far.  Can someone point me in the right
direction.  I've been reading like mad (yes I read xml.apache.org), and
I'm just short of the understanding I need to pull this off.  An example
of a stylesheet that uses an incremental value via xsp would be ideal,
or if someone could show me how to get this to work would be even
better.  One thing I know I've got to figure out is how to get the
expression value into the row attribute, but first even getting the expr
tag interpreted correctly would be a good start.

Once I get a few of these finished we'll probably have enough test cases
for our XML-XLS serialization project (sourceforge.net/projects/poi).
(it shares gnumeric's xml format) We hope to release a beta on Monday.

Thanks,

Andy

-
?xml version=1.0?

xsl:stylesheet version=1.0
xmlns:xsl=http://www.w3.org/1999/XSL/Transform;

xmlns:sql=http://apache.org/cocoon/SQL/2.0;

xmlns:xsp=http://apache.org/1999/XSP/Core;
  

  xsl:param name=view-source/
  xsp:logic
int incr = 5;
  /xsp:logic

  xsl:template match=page
   gmr:Workbook xmlns:gmr=http://www.gnome.org/gnumeric/v7;
 gmr:Sheets
 gmr:Sheet DisplayFormulas=false HideZero=false
HideGrid=false HideColHeader=false HideRowHeader=false
DisplayOutlines=true OutlineSymbolsBelow=true
OutlineSymbolsRight=true
 gmr:Namexsl:value-of select=title//gmr:Name
 gmr:MaxCol2/gmr:MaxCol
 gmr:Cols DefaultSizePts=48
gmr:ColInfo No=0 Unit=48 MarginA=2
MarginB=2 Count=2/
 /gmr:Cols
 gmr:Rows DefaultSizePts=12.8
gmr:RowInfo No=0 Unit=12.8 MarginA=0
MarginB=0 Count=9/
gmr:RowInfo No=10 Unit=12.8 MarginA=1
MarginB=0 Count=24/
 /gmr:Rows
 gmr:Cells
xsl:apply-templates/
 /gmr:Cells
/gmr:Sheet
 /gmr:Sheets
/gmr:Workbook
  /xsl:template

  xsl:template match=sql:rowset
  xsl:apply-templates select=sql:row/
  /xsl:template

  xsl:template match=sql:row
 rowidxsp:exprincr/xsp:expr/rowid
 gmr:Cell Col=0 Row={rowid} ValueType=60
   gmr:Content
xsl:value-of
select=sql:name/
/gmr:Content
 /gmr:Cell
 xsl:apply-templates select=sql:rowset/
  /xsl:template

 xsl:template match=para/xsl:template
 xsl:template match=title/xsl:template

/xsl:stylesheet

--
www.superlinksoftware.com
www.sourceforge.net/projects/poi - port of Excel format to java
http://developer.java.sun.com/developer/bugParade/bugs/4487555.html
- fix java generics!


The avalanche has already started. It is too late for the pebbles to
vote.
-Ambassador Kosh


-
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




ArrayIndexOutOfBoundsException from filter transform (FilterTransformer)

2001-12-11 Thread neil

I've got something working with (from sitemap.xmap):

  map:transform type=filter
map:parameter name=count value=2/

but if I change the 2 to a 1 I get (amongst heaps of other stack trace
lines):

pboriginal exception/bpreOriginal exception :
java.lang.ArrayIndexOutOfBoundsException
at
org.apache.xalan.serialize.SerializerToHTML.endElement(SerializerToHTML.java
:772)
at
org.apache.xalan.transformer.TransformerIdentityImpl.endElement(TransformerI
dentityImpl.java:1047)
at
org.apache.cocoon.xml.AbstractXMLPipe.endElement(AbstractXMLPipe.java:104)
at
org.apache.cocoon.serialization.AbstractTextSerializer.endElement(AbstractTe
xtSerializer.java:335)
at
org.apache.cocoon.transformation.FilterTransformer.endElement(FilterTransfor
mer.java:109)

I couldn't find this in the bug database at
http://nagoya.apache.org/bugzilla/index.html

Is it a bug and if so is it in xalan or
org.apache.cocoon.transformation.FilterTransformer?

Has anyone else come across this?

P.S. I'm finding cocoon pretty wonderful so far - so thanks to all
contributors.


-
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]