bloritsch 00/11/30 13:42:46
Modified: . Tag: xml-cocoon2 changes.xml
lib Tag: xml-cocoon2 avalonapi.jar
src/org/apache/cocoon Tag: xml-cocoon2 Cocoon.java
CocoonComponentSelector.java
DefaultComponentManager.java Main.java
src/org/apache/cocoon/components/language/markup Tag:
xml-cocoon2 AbstractMarkupLanguage.java
Logicsheet.java LogicsheetCodeGenerator.java
src/org/apache/cocoon/components/language/markup/sitemap/java
Tag: xml-cocoon2 sitemap.xsl
src/org/apache/cocoon/components/language/markup/xsp/java
Tag: xml-cocoon2 esql.xsl log.xsl
src/org/apache/cocoon/components/parser Tag: xml-cocoon2
Parser.java XercesParser.java
src/org/apache/cocoon/generation Tag: xml-cocoon2
ServerPagesGenerator.java
src/org/apache/cocoon/matching Tag: xml-cocoon2
RegexpTargetHostMatcherFactory.java
RegexpURIMatcherFactory.java
WildcardURIMatcherFactory.java
src/org/apache/cocoon/serialization Tag: xml-cocoon2
AbstractTextSerializer.java SVGSerializer.java
src/org/apache/cocoon/servlet Tag: xml-cocoon2
CocoonServlet.java ServletLogTarget.java
src/org/apache/cocoon/sitemap Tag: xml-cocoon2 Handler.java
Manager.java
src/org/apache/cocoon/transformation Tag: xml-cocoon2
SQLTransformer.java XTTransformer.java
XalanTransformer.java
webapp Tag: xml-cocoon2 sitemap.xmap
Log:
Many updates regarding logging and exception handling. Avalon was updated
again.
We now have support for Heirarchical loggin.
Revision Changes Path
No revision
No revision
1.9.2.15 +5 -1 xml-cocoon/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/xml-cocoon/changes.xml,v
retrieving revision 1.9.2.14
retrieving revision 1.9.2.15
diff -u -r1.9.2.14 -r1.9.2.15
--- changes.xml 2000/10/26 21:08:06 1.9.2.14
+++ changes.xml 2000/11/30 21:40:15 1.9.2.15
@@ -4,7 +4,7 @@
<!--
History of Cocoon changes
- $Id: changes.xml,v 1.9.2.14 2000/10/26 21:08:06 balld Exp $
+ $Id: changes.xml,v 1.9.2.15 2000/11/30 21:40:15 bloritsch Exp $
-->
<changes title="History of Changes">
@@ -21,6 +21,10 @@
</devs>
<release version="@version@" date="@date@">
+ <action dev="BL" type="update">
+ Updated avalonapi to implement hierarchical logging, and added many more
+ log entries to get a handle on where the problems lay.
+ </action>
<action dev="DB" type="add">
added esql logicsheet to c2
</action>
No revision
No revision
1.1.2.7 +381 -299 xml-cocoon/lib/Attic/avalonapi.jar
<<Binary file>>
No revision
No revision
1.4.2.37 +13 -13 xml-cocoon/src/org/apache/cocoon/Cocoon.java
Index: Cocoon.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Cocoon.java,v
retrieving revision 1.4.2.36
retrieving revision 1.4.2.37
diff -u -r1.4.2.36 -r1.4.2.37
--- Cocoon.java 2000/11/10 22:38:52 1.4.2.36
+++ Cocoon.java 2000/11/30 21:40:28 1.4.2.37
@@ -26,7 +26,7 @@
import org.apache.avalon.Modifiable;
import org.apache.avalon.Configurable;
import org.apache.avalon.Configuration;
-import org.apache.avalon.ConfigurationBuilder;
+import org.apache.avalon.SAXConfigurationHandler;
import org.apache.avalon.ConfigurationException;
import org.apache.cocoon.components.parser.Parser;
@@ -46,7 +46,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Pierpaolo Fumagalli</a>
* (Apache Software Foundation, Exoffice Technologies)
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.4.2.36 $ $Date: 2000/11/10 22:38:52 $
+ * @version CVS $Revision: 1.4.2.37 $ $Date: 2000/11/30 21:40:28 $
*/
public class Cocoon
implements Component, Configurable, ComponentManager, Modifiable,
Processor, Constants {
@@ -100,7 +100,7 @@
this.componentManager.addComponent(Roles.PARSER,
ClassUtils.loadClass(parser),null);
} catch ( Exception e ) {
log.error("Could not load parser, Cocoon object not created.",
e);
- throw new ConfigurationException("Could not load parser " +
parser + ": " + e.getMessage());
+ throw new ConfigurationException("Could not load parser " +
parser, e);
}
this.componentManager.addComponentInstance(Roles.COCOON, this);
}
@@ -127,12 +127,15 @@
}
Parser p = (Parser) this.lookup(Roles.PARSER);
- ConfigurationBuilder b = new ConfigurationBuilder();
+ SAXConfigurationHandler b = new SAXConfigurationHandler();
String path = this.configurationFile.getPath();
InputSource is = new InputSource(new FileReader(path));
- is.setSystemId(path);
- b.setXMLReader(p.getXMLReader());
- this.configure(b.build(is));
+
+ p.setContentHandler(b);
+ is.setSystemId(path);
+ p.parse(is);
+
+ this.configure(b.getConfiguration());
this.root = this.configurationFile.getParentFile().toURL();
}
@@ -177,7 +180,7 @@
log.debug("Configuration version: " + conf.getAttribute("version"));
if (!CONF_VERSION.equals(conf.getAttribute("version"))) {
throw new ConfigurationException("Invalid configuration schema
version. Must be '"
- + CONF_VERSION + "'."/*, conf*/);
+ + CONF_VERSION + "'.");
}
log.debug("Setting up components...");
@@ -193,16 +196,13 @@
} catch ( Exception ex ) {
log.error("Could not load class " + className, ex);
throw new ConfigurationException("Could not get class " +
className
- + " for role " + role + ": " + ex.getMessage());
+ + " for role " + role, ex);
}
}
// Create the sitemap
Configuration sconf = conf.getChild("sitemap");
- if (sconf == null) {
- log.error("Sitemap location is not specified");
- throw new ConfigurationException("No sitemap configuration");
- }
+
this.sitemapManager = new Manager(null);
this.sitemapManager.compose(this);
this.sitemapManager.configure(conf);
1.1.2.8 +6 -3
xml-cocoon/src/org/apache/cocoon/Attic/CocoonComponentSelector.java
Index: CocoonComponentSelector.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/CocoonComponentSelector.java,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -u -r1.1.2.7 -r1.1.2.8
--- CocoonComponentSelector.java 2000/11/26 21:48:01 1.1.2.7
+++ CocoonComponentSelector.java 2000/11/30 21:40:30 1.1.2.8
@@ -34,7 +34,7 @@
/** Default component manager for Cocoon's non sitemap components.
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Paul Russell</a>
- * @version CVS $Revision: 1.1.2.7 $ $Date: 2000/11/26 21:48:01 $
+ * @version CVS $Revision: 1.1.2.8 $ $Date: 2000/11/30 21:40:30 $
*/
public class CocoonComponentSelector implements ComponentSelector, Composer,
ThreadSafe {
protected Logger log = LogKit.getLoggerFor("cocoon");
@@ -166,7 +166,8 @@
* @return and instance of the component.
*/
private Component getThreadsafeComponent(Class componentClass)
- throws ComponentNotAccessibleException {
+ throws ComponentNotAccessibleException,
+ ComponentNotFoundException {
Component component =
(Component)threadSafeInstances.get(componentClass);
if ( component == null ) {
@@ -231,7 +232,9 @@
/** Configure a new component.
* @param c the component to configure.
*/
- private void setupComponent(Component c) throws
ComponentNotAccessibleException {
+ private void setupComponent(Component c)
+ throws ComponentNotAccessibleException,
+ ComponentNotFoundException {
if ( c instanceof Configurable ) {
try {
((Configurable)c).configure(
1.1.2.6 +7 -4
xml-cocoon/src/org/apache/cocoon/Attic/DefaultComponentManager.java
Index: DefaultComponentManager.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/DefaultComponentManager.java,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -r1.1.2.5 -r1.1.2.6
--- DefaultComponentManager.java 2000/11/17 19:59:13 1.1.2.5
+++ DefaultComponentManager.java 2000/11/30 21:40:32 1.1.2.6
@@ -35,7 +35,7 @@
/** Default component manager for Cocoon's non sitemap components.
* @author <a href="mailto:[EMAIL PROTECTED]">Paul Russell</a>
- * @version CVS $Revision: 1.1.2.5 $ $Date: 2000/11/17 19:59:13 $
+ * @version CVS $Revision: 1.1.2.6 $ $Date: 2000/11/30 21:40:32 $
*/
public class DefaultComponentManager implements ComponentManager {
@@ -158,7 +158,8 @@
* @return and instance of the component.
*/
private Component getThreadsafeComponent(Class componentClass)
- throws ComponentNotAccessibleException {
+ throws ComponentNotAccessibleException,
+ ComponentNotFoundException {
Component component =
(Component)threadSafeInstances.get(componentClass);
if ( component == null ) {
@@ -223,7 +224,9 @@
/** Configure a new component.
* @param c the component to configure.
*/
- private void setupComponent(Component c) throws
ComponentNotAccessibleException {
+ private void setupComponent(Component c)
+ throws ComponentNotAccessibleException,
+ ComponentNotFoundException {
if ( c instanceof Configurable ) {
try {
((Configurable)c).configure(
@@ -264,7 +267,7 @@
selector.addComponent(hint,
ClassUtils.loadClass(className), current);
} catch (Exception e) {
log.error("The component instance for \"" + hint + "\"
has an invalid class name.", e);
- throw new ConfigurationException("The component instance
for '" + hint + "' has an invalid class name.");
+ throw new ConfigurationException("The component instance
for '" + hint + "' has an invalid class name.", e);
}
}
1.1.4.15 +23 -20 xml-cocoon/src/org/apache/cocoon/Attic/Main.java
Index: Main.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/Main.java,v
retrieving revision 1.1.4.14
retrieving revision 1.1.4.15
diff -u -r1.1.4.14 -r1.1.4.15
--- Main.java 2000/11/14 15:08:26 1.1.4.14
+++ Main.java 2000/11/30 21:40:34 1.1.4.15
@@ -37,15 +37,18 @@
import org.apache.cocoon.environment.commandline.LinkSamplingEnvironment;
import org.apache.cocoon.environment.commandline.FileSavingEnvironment;
-import org.apache.log.LogKit;
import org.apache.log.Logger;
+import org.apache.log.LogKit;
import org.apache.log.Priority;
+import org.apache.log.Category;
+import org.apache.log.output.FileOutputLogTarget;
+import org.apache.log.LogTarget;
/**
* Command line entry point.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.1.4.14 $ $Date: 2000/11/14 15:08:26 $
+ * @version CVS $Revision: 1.1.4.15 $ $Date: 2000/11/30 21:40:34 $
*/
public class Main {
@@ -62,31 +65,31 @@
protected static final CLOptionDescriptor [] options = new
CLOptionDescriptor [] {
new CLOptionDescriptor("help",
- CLOptionDescriptor.ARGUEMENT_OPTIONAL,
+ CLOptionDescriptor.ARGUMENT_OPTIONAL,
HELP_OPT,
"print this message and exit"),
new CLOptionDescriptor("version",
- CLOptionDescriptor.ARGUEMENT_OPTIONAL,
+ CLOptionDescriptor.ARGUMENT_OPTIONAL,
VERSION_OPT,
"print the version information and exit"),
new CLOptionDescriptor("logUrl",
- CLOptionDescriptor.ARGUEMENT_OPTIONAL,
+ CLOptionDescriptor.ARGUMENT_OPTIONAL,
LOG_URL_OPT,
- "use given file/URL for log"),
+ "use given file for log"),
new CLOptionDescriptor("logLevel",
- CLOptionDescriptor.ARGUEMENT_OPTIONAL,
+ CLOptionDescriptor.ARGUMENT_OPTIONAL,
LOG_LEVEL_OPT,
"choose the minimum log level for logging
(DEBUG, INFO, WARN, ERROR, FATAL_ERROR)"),
new CLOptionDescriptor("contextDir",
- CLOptionDescriptor.ARGUEMENT_OPTIONAL,
+ CLOptionDescriptor.ARGUMENT_OPTIONAL,
CONTEXT_DIR_OPT,
"use given dir as context"),
new CLOptionDescriptor("destDir",
- CLOptionDescriptor.ARGUEMENT_OPTIONAL,
+ CLOptionDescriptor.ARGUMENT_OPTIONAL,
DEST_DIR_OPT,
"use given dir as destination"),
new CLOptionDescriptor("workDir",
- CLOptionDescriptor.ARGUEMENT_OPTIONAL,
+ CLOptionDescriptor.ARGUMENT_OPTIONAL,
WORK_DIR_OPT,
"use given dir as working directory")
};
@@ -99,10 +102,10 @@
String workDir = Cocoon.DEFAULT_WORK_DIR;
List targets = new ArrayList();
CLArgsParser parser = new CLArgsParser(args, options);
- String logUrl = "file://./logs/cocoon.log";
+ String logUrl = "logs/cocoon.log";
String logLevel = "DEBUG";
- List clOptions = parser.getArguements();
+ List clOptions = parser.getArguments();
int size = clOptions.size();
for (int i = 0; i < size; i++) {
@@ -110,7 +113,7 @@
switch (option.getId()) {
case 0:
- targets.add(option.getArguement());
+ targets.add(option.getArgument());
break;
case Main.HELP_OPT:
@@ -122,36 +125,36 @@
break;
case Main.DEST_DIR_OPT:
- destDir = option.getArguement();
+ destDir = option.getArgument();
break;
case Main.WORK_DIR_OPT:
- workDir = option.getArguement();
+ workDir = option.getArgument();
break;
case Main.CONTEXT_DIR_OPT:
- contextDir = option.getArguement();
+ contextDir = option.getArgument();
break;
case Main.LOG_URL_OPT:
- logUrl = option.getArguement();
+ logUrl = option.getArgument();
break;
case Main.LOG_LEVEL_OPT:
- logLevel = option.getArguement();
+ logLevel = option.getArgument();
break;
}
}
try {
LogKit.setGlobalPriority(LogKit.getPriorityForName(logLevel));
+ Category cocoonCategory = LogKit.createCategory("cocoon",
LogKit.getPriorityForName(logLevel));
- log = LogKit.createLogger("cocoon", logUrl, logLevel);
+ log = LogKit.createLogger(cocoonCategory,new LogTarget[] {new
FileOutputLogTarget(logUrl)});
} catch (MalformedURLException mue) {
String error = "Cannot write on the specified log file. Please,
make sure the path exists and you have write permissions.";
LogKit.log(error, mue);
System.out.println(error);
- mue.printStackTrace(System.err);
System.exit(1);
}
No revision
No revision
1.1.2.12 +12 -6
xml-cocoon/src/org/apache/cocoon/components/language/markup/Attic/AbstractMarkupLanguage.java
Index: AbstractMarkupLanguage.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/Attic/AbstractMarkupLanguage.java,v
retrieving revision 1.1.2.11
retrieving revision 1.1.2.12
diff -u -r1.1.2.11 -r1.1.2.12
--- AbstractMarkupLanguage.java 2000/11/08 20:35:02 1.1.2.11
+++ AbstractMarkupLanguage.java 2000/11/30 21:40:54 1.1.2.12
@@ -41,18 +41,25 @@
import org.apache.cocoon.components.store.MemoryStore;
import org.apache.cocoon.components.language.programming.ProgrammingLanguage;
+import org.apache.log.LogKit;
+import org.apache.log.Logger;
+
/**
* Base implementation of <code>MarkupLanguage</code>. This class uses
* logicsheets as the only means of code generation. Code generation should
* be decoupled from this context!!!
*
* @author <a href="mailto:[EMAIL PROTECTED]">Ricardo Rocha</a>
- * @version CVS $Revision: 1.1.2.11 $ $Date: 2000/11/08 20:35:02 $
+ * @version CVS $Revision: 1.1.2.12 $ $Date: 2000/11/30 21:40:54 $
*/
public abstract class AbstractMarkupLanguage
implements MarkupLanguage, Composer, Configurable
{
/**
+ * The logger for AbstractMarkupLanguage
+ */
+ protected Logger log = LogKit.getLoggerFor("cocoon");
+ /**
* The supported language table
*/
protected Hashtable languages;
@@ -127,7 +134,7 @@
Parameters lcp = Parameters.fromConfiguration(lc);
String logicsheetLocation =
- lcp.getParameter("core-logicsheet",null);
+ lcp.getParameter("core-logicsheet",null);
URL logicsheetURL = NetUtils.getURL(logicsheetLocation);
String logicsheetName = logicsheetURL.toExternalForm();
@@ -167,9 +174,8 @@
this.languages.put(language.getName(), language);
}
} catch (Exception e) {
- // FIXME (SSA) Better error handling
- e.printStackTrace();
- throw new ConfigurationException(e.getMessage());
+ log.error("Configuration Error: " + e.getMessage(), e);
+ throw new ConfigurationException("AbstractMarkupLanguage: " +
e.getMessage(), e);
}
}
@@ -601,7 +607,7 @@
*/
public void startElement (
String namespaceURI, String localName,
- String qName, Attributes atts
+ String qName, Attributes atts
) throws SAXException {
if(isRootElem) {
isRootElem=false;
1.1.2.9 +12 -5
xml-cocoon/src/org/apache/cocoon/components/language/markup/Attic/Logicsheet.java
Index: Logicsheet.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/Attic/Logicsheet.java,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -u -r1.1.2.8 -r1.1.2.9
--- Logicsheet.java 2000/11/10 12:32:01 1.1.2.8
+++ Logicsheet.java 2000/11/30 21:40:56 1.1.2.9
@@ -38,6 +38,9 @@
import javax.xml.transform.sax.TransformerHandler;
import javax.xml.transform.sax.SAXTransformerFactory;
+import org.apache.log.Logger;
+import org.apache.log.LogKit;
+
/**
* A code-generation logicsheet. This class is actually a wrapper for
* a "standard" XSLT stylesheet stored as <code>trax.Templates</code> object.
@@ -48,10 +51,15 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Ricardo Rocha</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Davanum Srinivas</a>
- * @version CVS $Revision: 1.1.2.8 $ $Date: 2000/11/10 12:32:01 $
+ * @version CVS $Revision: 1.1.2.9 $ $Date: 2000/11/30 21:40:56 $
*/
public class Logicsheet {
/**
+ * The logger.
+ */
+ protected Logger log = LogKit.getLoggerFor("cocoon");
+
+ /**
* The trax TransformerFactory
*/
protected SAXTransformerFactory tfactory;
@@ -74,8 +82,8 @@
tfactory = (SAXTransformerFactory)
TransformerFactory.newInstance();
templates = tfactory.newTemplates(new SAXSource(inputSource));
} catch (TransformerConfigurationException e){
- // FIXME (DIMS) - Need to handle exceptions gracefully.
- e.printStackTrace();
+ log.error("Logicsheet.setInputSource", e);
+
}
}
@@ -89,8 +97,7 @@
try {
return tfactory.newTransformerHandler(templates);
} catch (TransformerConfigurationException e){
- // FIXME (DIMS) - Need to handle exceptions gracefully.
- e.printStackTrace();
+ log.error("Logicsheet.getTransformerHandler", e);
}
return null;
}
1.1.2.10 +8 -5
xml-cocoon/src/org/apache/cocoon/components/language/markup/Attic/LogicsheetCodeGenerator.java
Index: LogicsheetCodeGenerator.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/Attic/LogicsheetCodeGenerator.java,v
retrieving revision 1.1.2.9
retrieving revision 1.1.2.10
diff -u -r1.1.2.9 -r1.1.2.10
--- LogicsheetCodeGenerator.java 2000/11/15 17:17:39 1.1.2.9
+++ LogicsheetCodeGenerator.java 2000/11/30 21:40:58 1.1.2.10
@@ -27,15 +27,20 @@
import javax.xml.transform.sax.SAXResult;
import javax.xml.transform.TransformerException;
+import org.apache.log.Logger;
+import org.apache.log.LogKit;
+
/**
* A logicsheet-based implementation of <code>MarkupCodeGenerator</code>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Ricardo Rocha</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Davanum Srinivas</a>
- * @version CVS $Revision: 1.1.2.9 $ $Date: 2000/11/15 17:17:39 $
+ * @version CVS $Revision: 1.1.2.10 $ $Date: 2000/11/30 21:40:58 $
*/
public class LogicsheetCodeGenerator implements MarkupCodeGenerator {
+ protected Logger log = LogKit.getLoggerFor("cocoon");
+
private Logicsheet corelogicsheet;
private Serializer serializer;
@@ -68,9 +73,7 @@
try {
this.serializerContentHandler =
this.serializer.asContentHandler();
} catch (IOException ioe) {
- // This should never happen, because we're not dealing with IO
file,
- // but rather with StringWriter
- ioe.printStackTrace();
+ log.error("This should never happen, because we're not dealing
with IO file, but rather with StringWriter", ioe);
}
}
@@ -101,7 +104,7 @@
this.currentParent = newParent;
this.currentParent.setResult(new
SAXResult(this.serializerContentHandler));
}
- }
+ }
/**
* Generate source code from the input document. Filename information is
No revision
No revision
1.1.2.63 +11 -10
xml-cocoon/src/org/apache/cocoon/components/language/markup/sitemap/java/Attic/sitemap.xsl
Index: sitemap.xsl
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/sitemap/java/Attic/sitemap.xsl,v
retrieving revision 1.1.2.62
retrieving revision 1.1.2.63
diff -u -r1.1.2.62 -r1.1.2.63
--- sitemap.xsl 2000/11/15 19:29:34 1.1.2.62
+++ sitemap.xsl 2000/11/30 21:41:07 1.1.2.63
@@ -77,9 +77,11 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo
Pati</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Berin
Loiritsch</a>
- * @version CVS $Revision: 1.1.2.62 $ $Date: 2000/11/15 19:29:34 $
+ * @version CVS $Revision: 1.1.2.63 $ $Date: 2000/11/30 21:41:07 $
*/
public class <xsl:value-of select="@file-name"/> extends AbstractSitemap
{
+ static final String LOCATION = "<xsl:value-of
select="translate(@file-path, '/', '.')"/>.<xsl:value-of select="@file-name"/>";
+
static {
dateCreated = <xsl:value-of select="@creation-date"/>L;
}
@@ -198,8 +200,8 @@
this.sitemapManager.configure(conf);
try {
<!-- configure all components -->
- load_component ("!generator:error-notifier!",
"org.apache.cocoon.sitemap.ErrorNotifier", new DefaultConfiguration(""), null);
- load_component ("!transformer:link-translator!",
"org.apache.cocoon.sitemap.LinkTranslator", new DefaultConfiguration(""), null);
+ load_component ("!generator:error-notifier!",
"org.apache.cocoon.sitemap.ErrorNotifier", new DefaultConfiguration("",
LOCATION), null);
+ load_component ("!transformer:link-translator!",
"org.apache.cocoon.sitemap.LinkTranslator", new DefaultConfiguration("",
LOCATION), null);
<!-- Configure generators -->
<xsl:call-template name="config-components">
@@ -252,7 +254,8 @@
/* catch any exception thrown by a component during configuration */
} catch (Exception e) {
- throw new ConfigurationException (e.toString()/*, cconf*/);
+ log.error(e.getMessage(), e);
+ throw new ConfigurationException ("Sitemap: " + e.getMessage(), e);
}
}
@@ -327,13 +330,11 @@
try {
return error_process_<xsl:value-of
select="$pipeline-position"/> (environment, objectModel, e);
} catch (Exception ex) {
- System.out.println (ex.toString());
- ex.printStackTrace(System.out);
+ log.error("Sitemap", ex);
}
</xsl:when>
<xsl:otherwise>
- System.out.println (e.toString());
- e.printStackTrace(System.out);
+ log.error("Sitemap", ex);
</xsl:otherwise>
</xsl:choose>
}
@@ -720,7 +721,7 @@
select="(@factory and ($name = 'matcher' or $name = 'selector')) or
(@src and ($name = 'matcher' or $name = 'selector') and
java:isFactory($factory-loader, string(@src)))"/>
<xsl:if test="$is-factory-component=false()">
{
- DefaultConfiguration cconf1 = new
DefaultConfiguration("<xsl:value-of select="translate(@name, '- ', '__')"/>");
+ DefaultConfiguration cconf1 = new
DefaultConfiguration("<xsl:value-of select="translate(@name, '- ', '__')"/>",
LOCATION);
<xsl:for-each select="attribute::*[name(.)!=$qname]">
cconf1.addAttribute ("<xsl:value-of select="name(.)"/>",
"<xsl:value-of select="."/>");
@@ -766,7 +767,7 @@
<!-- process content -->
<xsl:for-each select="$components">
{
- DefaultConfiguration cconf<xsl:value-of select="$level"/> = new
DefaultConfiguration("<xsl:value-of select="name(.)"/>");
+ DefaultConfiguration cconf<xsl:value-of select="$level"/> = new
DefaultConfiguration("<xsl:value-of select="name(.)"/>", LOCATION);
<xsl:for-each select="attribute::*[name(.)!=$qname]">
cconf<xsl:value-of select="$level"/>.addAttribute ("<xsl:value-of
select="name(.)"/>", "<xsl:value-of select="."/>");
</xsl:for-each>
No revision
No revision
1.1.2.7 +236 -235
xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/java/Attic/esql.xsl
Index: esql.xsl
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/java/Attic/esql.xsl,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -u -r1.1.2.6 -r1.1.2.7
--- esql.xsl 2000/10/31 02:43:20 1.1.2.6
+++ esql.xsl 2000/11/30 21:41:16 1.1.2.7
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- $Id: esql.xsl,v 1.1.2.6 2000/10/31 02:43:20 balld Exp $-->
+<!-- $Id: esql.xsl,v 1.1.2.7 2000/11/30 21:41:16 bloritsch Exp $-->
<!--
============================================================================
@@ -52,87 +52,87 @@
-->
<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:xsp="http://apache.org/xsp"
- xmlns:esql="http://apache.org/cocoon/SQL/v2"
- xmlns:xspdoc="http://apache.org/cocoon/XSPDoc/v1"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xsp="http://apache.org/xsp"
+ xmlns:esql="http://apache.org/cocoon/SQL/v2"
+ xmlns:xspdoc="http://apache.org/cocoon/XSPDoc/v1"
>
<xspdoc:title>the esql logicsheet</xspdoc:title>
<xsl:template name="get-nested-content">
<xsl:param name="content"/>
- <xsl:choose>
- <xsl:when test="$content/*">
- <xsl:apply-templates select="$content/*"/>
- </xsl:when>
- <xsl:otherwise>"<xsl:value-of
select="$content"/>"</xsl:otherwise>
- </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="$content/*">
+ <xsl:apply-templates select="$content/*"/>
+ </xsl:when>
+ <xsl:otherwise>"<xsl:value-of select="$content"/>"</xsl:otherwise>
+ </xsl:choose>
</xsl:template>
<xsl:template name="get-nested-string">
- <xsl:param name="content"/>
- <xsl:choose>
- <xsl:when test="$content/*">
- ""
- <xsl:for-each select="$content/node()">
- <xsl:choose>
- <xsl:when test="name(.)">
- <xsl:choose>
- <xsl:when
test="namespace-uri(.)='http://apache.org/xsp' and local-name(.)='text'">
- +
"<xsl:value-of select="."/>"
- </xsl:when>
- <xsl:otherwise>
- +
<xsl:apply-templates select="."/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- + "<xsl:value-of
select="translate(.,'	 ',' ')"/>"
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </xsl:when>
- <xsl:otherwise>"<xsl:value-of
select="normalize-space($content)"/>"</xsl:otherwise>
- </xsl:choose>
+ <xsl:param name="content"/>
+ <xsl:choose>
+ <xsl:when test="$content/*">
+ ""
+ <xsl:for-each select="$content/node()">
+ <xsl:choose>
+ <xsl:when test="name(.)">
+ <xsl:choose>
+ <xsl:when
test="namespace-uri(.)='http://apache.org/xsp' and local-name(.)='text'">
+ + "<xsl:value-of select="."/>"
+ </xsl:when>
+ <xsl:otherwise>
+ + <xsl:apply-templates select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ + "<xsl:value-of
select="translate(.,'	 ',' ')"/>"
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>"<xsl:value-of
select="normalize-space($content)"/>"</xsl:otherwise>
+ </xsl:choose>
</xsl:template>
<xsl:template match="xsp:page">
- <xsp:page>
- <xsl:apply-templates select="@*"/>
- <xsp:structure>
- <xsp:include>java.sql.DriverManager</xsp:include>
- <xsp:include>java.sql.Connection</xsp:include>
- <xsp:include>java.sql.Statement</xsp:include>
- <xsp:include>java.sql.PreparedStatement</xsp:include>
- <xsp:include>java.sql.ResultSet</xsp:include>
- <xsp:include>java.sql.ResultSetMetaData</xsp:include>
- <xsp:include>java.sql.SQLException</xsp:include>
- <xsp:include>java.text.SimpleDateFormat</xsp:include>
- <xsp:include>java.text.DecimalFormat</xsp:include>
- </xsp:structure>
- <xsp:logic>
+ <xsp:page>
+ <xsl:apply-templates select="@*"/>
+ <xsp:structure>
+ <xsp:include>java.sql.DriverManager</xsp:include>
+ <xsp:include>java.sql.Connection</xsp:include>
+ <xsp:include>java.sql.Statement</xsp:include>
+ <xsp:include>java.sql.PreparedStatement</xsp:include>
+ <xsp:include>java.sql.ResultSet</xsp:include>
+ <xsp:include>java.sql.ResultSetMetaData</xsp:include>
+ <xsp:include>java.sql.SQLException</xsp:include>
+ <xsp:include>java.text.SimpleDateFormat</xsp:include>
+ <xsp:include>java.text.DecimalFormat</xsp:include>
+ </xsp:structure>
+ <xsp:logic>
class EsqlSession {
Connection connection=null;
boolean close_connection = true;
- String query;
+ String query;
Statement statement;
- PreparedStatement prepared_statement;
+ PreparedStatement prepared_statement;
ResultSet resultset;
ResultSetMetaData resultset_metadata;
int count;
int max_rows;
int skip_rows;
boolean has_resultset;
- int update_count;
+ int update_count;
}
- </xsp:logic>
- <xsl:for-each
select=".//esql:execute-query[not(@inner-method='no')]">
- <xsl:call-template name="generate-code">
- <xsl:with-param name="inner-method">yes</xsl:with-param>
- </xsl:call-template>
- </xsl:for-each>
- <xsl:apply-templates/>
- </xsp:page>
+ </xsp:logic>
+ <xsl:for-each
select=".//esql:execute-query[not(@inner-method='no')]">
+ <xsl:call-template name="generate-code">
+ <xsl:with-param name="inner-method">yes</xsl:with-param>
+ </xsl:call-template>
+ </xsl:for-each>
+ <xsl:apply-templates/>
+ </xsp:page>
</xsl:template>
<xsl:template
match="xsp:page/*[not(namespace-uri(.)='http://www.apache.org/1999/XSP/Core')]">
@@ -171,193 +171,194 @@
</xsl:template>
<xsl:template name="generate-code">
- <xsl:param name="inner-method"/>
- <xsl:variable name="use-connection">
- <xsl:call-template name="get-nested-string">
- <xsl:with-param name="content"
select="esql:use-connection"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="driver">
- <xsl:call-template name="get-nested-string">
- <xsl:with-param name="content" select="esql:driver"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="dburl">
- <xsl:call-template name="get-nested-string">
- <xsl:with-param name="content" select="esql:dburl"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="username">
- <xsl:call-template name="get-nested-string">
- <xsl:with-param name="content" select="esql:username"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="password">
- <xsl:call-template name="get-nested-string">
- <xsl:with-param name="content" select="esql:password"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="max-rows">
- <xsl:call-template name="get-nested-string">
- <xsl:with-param name="content" select="esql:max-rows"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="skip-rows">
- <xsl:call-template name="get-nested-string">
- <xsl:with-param name="content" select="esql:skip-rows"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="query">
- <xsl:call-template name="get-nested-string">
- <xsl:with-param name="content" select="esql:query"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="statement">
- <xsl:call-template name="get-nested-string">
- <xsl:with-param name="content" select="esql:statement"/>
- </xsl:call-template>
- </xsl:variable>
- <xsp:logic>
- <xsl:choose>
- <xsl:when test="$inner-method='yes'">
- void _esql_execute_query_<xsl:value-of select="generate-id(.)"/>(
- HttpServletRequest request,
- HttpServletResponse response,
- Document document,
- Node xspParentNode,
- Node xspCurrentNode,
- Stack xspNodeStack,
- HttpSession session,
- Stack _esql_sessions,
- EsqlSession _esql_session) throws Exception {
- </xsl:when>
- <xsl:when test="$inner-method='no'">
- {
+ <xsl:param name="inner-method"/>
+ <xsl:variable name="use-connection">
+ <xsl:call-template name="get-nested-string">
+ <xsl:with-param name="content" select="esql:use-connection"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="driver">
+ <xsl:call-template name="get-nested-string">
+ <xsl:with-param name="content" select="esql:driver"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="dburl">
+ <xsl:call-template name="get-nested-string">
+ <xsl:with-param name="content" select="esql:dburl"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="username">
+ <xsl:call-template name="get-nested-string">
+ <xsl:with-param name="content" select="esql:username"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="password">
+ <xsl:call-template name="get-nested-string">
+ <xsl:with-param name="content" select="esql:password"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="max-rows">
+ <xsl:call-template name="get-nested-string">
+ <xsl:with-param name="content" select="esql:max-rows"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="skip-rows">
+ <xsl:call-template name="get-nested-string">
+ <xsl:with-param name="content" select="esql:skip-rows"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="query">
+ <xsl:call-template name="get-nested-string">
+ <xsl:with-param name="content" select="esql:query"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="statement">
+ <xsl:call-template name="get-nested-string">
+ <xsl:with-param name="content" select="esql:statement"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsp:logic>
+ <xsl:choose>
+ <xsl:when test="$inner-method='yes'">
+ void _esql_execute_query_<xsl:value-of select="generate-id(.)"/>(
+ HttpServletRequest request,
+ HttpServletResponse response,
+ Document document,
+ Node xspParentNode,
+ Node xspCurrentNode,
+ Stack xspNodeStack,
+ HttpSession session,
+ Stack _esql_sessions,
+ EsqlSession _esql_session) throws Exception {
+ </xsl:when>
+ <xsl:when test="$inner-method='no'">
+ {
</xsl:when>
- </xsl:choose>
- if (_esql_session != null) {
- _esql_sessions.push(_esql_session);
- }
- _esql_session = new EsqlSession();
- try {
- _esql_session.max_rows =
Integer.parseInt(String.valueOf(<xsl:copy-of select="$max-rows"/>));
- } catch (Exception _esql_e) {
- _esql_session.max_rows = -1;
- }
- try {
- _esql_session.skip_rows =
Integer.parseInt(String.valueOf(<xsl:copy-of select="$skip-rows"/>));
- } catch (Exception _esql_e) {
- _esql_session.skip_rows = 0;
- }
- try {
- <xsl:choose>
- <xsl:when test="not(esql:use-connection or esql:dburl)">
+ </xsl:choose>
+ if (_esql_session != null) {
+ _esql_sessions.push(_esql_session);
+ }
+ _esql_session = new EsqlSession();
+ try {
+ _esql_session.max_rows =
Integer.parseInt(String.valueOf(<xsl:copy-of select="$max-rows"/>));
+ } catch (Exception _esql_e) {
+ _esql_session.max_rows = -1;
+ }
+ try {
+ _esql_session.skip_rows =
Integer.parseInt(String.valueOf(<xsl:copy-of select="$skip-rows"/>));
+ } catch (Exception _esql_e) {
+ _esql_session.skip_rows = 0;
+ }
+ try {
+ <xsl:choose>
+ <xsl:when test="not(esql:use-connection or esql:dburl)">
_esql_session.connection =
((EsqlSession)_esql_sessions.peek()).connection;
- _esql_session.close_connection = false;
- </xsl:when>
- <xsl:when test="esql:use-connection">
- <!-- FIXME - need to do avalon pooling here maybe? -->
- </xsl:when>
- <xsl:otherwise>
- Class.forName(String.valueOf(<xsl:copy-of
select="$driver"/>)).newInstance();
- <xsl:choose>
- <xsl:when test="esql:username">
- _esql_session.connection = DriverManager.getConnection(
- String.valueOf(<xsl:copy-of select="$dburl"/>),
- String.valueOf(<xsl:copy-of select="$username"/>),
- String.valueOf(<xsl:copy-of select="$password"/>)
- );
- </xsl:when>
- <xsl:otherwise>
- _esql_session.connection = DriverManager.getConnection(
- String.valueOf(<xsl:copy-of select="$dburl"/>)
- );
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="esql:query">
- _esql_session.query = String.valueOf(<xsl:copy-of
select="$query"/>);
- _esql_session.statement =
_esql_session.connection.createStatement();
+ _esql_session.close_connection = false;
+ </xsl:when>
+ <xsl:when test="esql:use-connection">
+ <!-- FIXME - need to do avalon pooling here maybe? -->
+ </xsl:when>
+ <xsl:otherwise>
+ Class.forName(String.valueOf(<xsl:copy-of
select="$driver"/>)).newInstance();
+ <xsl:choose>
+ <xsl:when test="esql:username">
+ _esql_session.connection = DriverManager.getConnection(
+ String.valueOf(<xsl:copy-of select="$dburl"/>),
+ String.valueOf(<xsl:copy-of select="$username"/>),
+ String.valueOf(<xsl:copy-of select="$password"/>)
+ );
+ </xsl:when>
+ <xsl:otherwise>
+ _esql_session.connection = DriverManager.getConnection(
+ String.valueOf(<xsl:copy-of select="$dburl"/>)
+ );
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="esql:query">
+ _esql_session.query = String.valueOf(<xsl:copy-of
select="$query"/>);
+ _esql_session.statement =
_esql_session.connection.createStatement();
_esql_session.has_resultset =
_esql_session.statement.execute(_esql_session.query);
- </xsl:when>
- <xsl:when test="esql:statement">
- _esql_session.prepared_statement =
_esql_session.connection.prepareStatement(String.valueOf(<xsl:copy-of
select="$statement"/>));
- _esql_session.statement = _esql_session.prepared_statement;
- <xsl:for-each select=".//esql:parameter">
- <xsl:text>_esql_session.prepared_statement.</xsl:text>
- <xsl:choose>
- <xsl:when test="@type">
- <xsl:variable name="type"><xsl:value-of
select="concat(translate(substring(@type,0,1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ'),substring(@type,1))"/></xsl:variable>
+ </xsl:when>
+ <xsl:when test="esql:statement">
+ _esql_session.prepared_statement =
_esql_session.connection.prepareStatement(String.valueOf(<xsl:copy-of
select="$statement"/>));
+ _esql_session.statement = _esql_session.prepared_statement;
+ <xsl:for-each select=".//esql:parameter">
+ <xsl:text>_esql_session.prepared_statement.</xsl:text>
+ <xsl:choose>
+ <xsl:when test="@type">
+ <xsl:variable name="type"><xsl:value-of
select="concat(translate(substring(@type,0,1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ'),substring(@type,1))"/></xsl:variable>
<xsl:text>set</xsl:text><xsl:value-of
select="$type"/>(<xsl:value-of select="position()"/>,<xsl:call-template
name="get-nested-content"><xsl:with-param name="content"
select="."/></xsl:call-template>);<xsl:text>
- </xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>setString(</xsl:text><xsl:value-of
select="position()"/>,String.valueOf(<xsl:call-template
name="get-nested-string"><xsl:with-param name="content"
select="."/></xsl:call-template>));<xsl:text>
- </xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- _esql_session.has_resultset =
_esql_session.prepared_statement.execute();
- </xsl:when>
- </xsl:choose>
+ </xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>setString(</xsl:text><xsl:value-of
select="position()"/>,String.valueOf(<xsl:call-template
name="get-nested-string"><xsl:with-param name="content"
select="."/></xsl:call-template>));<xsl:text>
+ </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ _esql_session.has_resultset =
_esql_session.prepared_statement.execute();
+ </xsl:when>
+ </xsl:choose>
if (_esql_session.has_resultset) {
_esql_session.resultset =
_esql_session.statement.getResultSet();
- _esql_session.resultset_metadata =
_esql_session.resultset.getMetaData();
+ _esql_session.resultset_metadata =
_esql_session.resultset.getMetaData();
_esql_session.update_count = -1;
- _esql_session.count = 0;
- if (_esql_session.skip_rows > 0) {
- while (_esql_session.resultset.next()) {
- _esql_session.count++;
- if (_esql_session.count == _esql_session.skip_rows) {
- break;
- }
- }
- }
- boolean _esql_results_<xsl:value-of select="generate-id(.)"/> =
false;
- while (_esql_session.resultset.next()) {
- _esql_results_<xsl:value-of select="generate-id(.)"/> = true;
- <xsl:apply-templates select="esql:results/*"/>
- if (_esql_session.max_rows != -1 &&
_esql_session.count - _esql_session.skip_rows == _esql_session.max_rows-1) {
- break;
- }
- _esql_session.count++;
- }
- _esql_session.resultset.close();
- if (!_esql_results_<xsl:value-of select="generate-id(.)"/>) {
+ _esql_session.count = 0;
+ if (_esql_session.skip_rows > 0) {
+ while (_esql_session.resultset.next()) {
+ _esql_session.count++;
+ if (_esql_session.count == _esql_session.skip_rows) {
+ break;
+ }
+ }
+ }
+ boolean _esql_results_<xsl:value-of select="generate-id(.)"/> =
false;
+ while (_esql_session.resultset.next()) {
+ _esql_results_<xsl:value-of select="generate-id(.)"/> = true;
+ <xsl:apply-templates select="esql:results/*"/>
+ if (_esql_session.max_rows != -1 && _esql_session.count -
_esql_session.skip_rows == _esql_session.max_rows-1) {
+ break;
+ }
+ _esql_session.count++;
+ }
+ _esql_session.resultset.close();
+ if (!_esql_results_<xsl:value-of select="generate-id(.)"/>) {
<xsl:apply-templates select="esql:no-results/*"/>
- }
+ }
} else {
_esql_session.update_count =
_esql_session.statement.getUpdateCount();
<xsl:apply-templates select="esql:count-results/*"/>
}
- _esql_session.statement.close();
- } catch (Exception _esql_exception) {
- <xsl:if test="esql:error-results//esql:get-stacktrace">
- StringWriter _esql_exception_writer = new StringWriter();
- _esql_exception.printStackTrace(new
PrintWriter(_esql_exception_writer));
- </xsl:if>
- <xsl:apply-templates select="esql:error-results/*"/>
- } finally {
- if (_esql_session.close_connection) {
- if (_esql_session.connection != null) {
- try {
- _esql_session.connection.close();
- } catch (SQLException _esql_exception) {}
- }
- <xsl:if test="esql:use-connection">
- <!-- FIXME - need to release avalon pooling here maybe -->
- </xsl:if>
- }
- if (_esql_sessions.empty()) {
- _esql_session = null;
- } else {
- _esql_session = (EsqlSession)_esql_sessions.pop();
- }
- }
- }
- </xsp:logic>
+ _esql_session.statement.close();
+ } catch (Exception _esql_exception) {
+ <xsl:if test="esql:error-results//esql:get-stacktrace">
+ StringWriter _esql_exception_writer = new StringWriter();
+ log.error("esql XSP exception", _esql_exception)
+ _esql_exception.printStackTrace(new
PrintWriter(_esql_exception_writer));
+ </xsl:if>
+ <xsl:apply-templates select="esql:error-results/*"/>
+ } finally {
+ if (_esql_session.close_connection) {
+ if (_esql_session.connection != null) {
+ try {
+ _esql_session.connection.close();
+ } catch (SQLException _esql_exception) {}
+ }
+ <xsl:if test="esql:use-connection">
+ <!-- FIXME - need to release avalon pooling here maybe -->
+ </xsl:if>
+ }
+ if (_esql_sessions.empty()) {
+ _esql_session = null;
+ } else {
+ _esql_session = (EsqlSession)_esql_sessions.pop();
+ }
+ }
+ }
+ </xsp:logic>
</xsl:template>
<xsl:template match="esql:statement//esql:parameter">"?"</xsl:template>
1.1.2.3 +6 -5
xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/java/Attic/log.xsl
Index: log.xsl
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/java/Attic/log.xsl,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- log.xsl 2000/11/29 12:17:20 1.1.2.2
+++ log.xsl 2000/11/30 21:41:19 1.1.2.3
@@ -11,7 +11,7 @@
<!--
* @author <a href="mailto:[EMAIL PROTECTED]>Berin Loritsch</a>
- * @version CVS $Revision: 1.1.2.2 $ $Date: 2000/11/29 12:17:20 $
+ * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/11/30 21:41:19 $
-->
<!-- XSP Response logicsheet for the Java language -->
@@ -32,7 +32,7 @@
<xsl:with-param name="content" select="log:name"/>
</xsl:call-template>
</xsl:when>
- <xsl:otherwise>""</xsl:otherwise>
+ <xsl:otherwise>""</xsl:otherwise>
</xsl:choose>
</xsl:variable>
@@ -63,9 +63,10 @@
<xsp:logic>
if (log == null) {
try {
- log = LogKit.createLogger(<xsl:value-of select="$name"/>,
- <xsl:value-of select="$url"/>,
- <xsl:value-of select="$level"/>);
+ Category logCategory = LogKit.createCategory(<xsl:value-of
select="$name"/>,
+
LogKit.getPriorityForName(<xsl:value-of select="$level"/>));
+
+ log = new Logger(logCategory, log);
} catch (Exception e) {
cocoonLogger.error("Could not create logger for \"" +
<xsl:value-of select="$name"/> + "\".", e);
No revision
No revision
1.1.2.10 +2 -7
xml-cocoon/src/org/apache/cocoon/components/parser/Attic/Parser.java
Index: Parser.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/components/parser/Attic/Parser.java,v
retrieving revision 1.1.2.9
retrieving revision 1.1.2.10
diff -u -r1.1.2.9 -r1.1.2.10
--- Parser.java 2000/11/01 15:52:36 1.1.2.9
+++ Parser.java 2000/11/30 21:41:29 1.1.2.10
@@ -13,19 +13,14 @@
import org.apache.cocoon.xml.dom.DOMFactory;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Pierpaolo Fumagalli</a>
* (Apache Software Foundation, Exoffice Technologies)
- * @version CVS $Revision: 1.1.2.9 $ $Date: 2000/11/01 15:52:36 $
+ * @version CVS $Revision: 1.1.2.10 $ $Date: 2000/11/30 21:41:29 $
*/
public interface Parser extends Component, XMLProducer, DOMFactory {
-
- public void parse(InputSource in) throws SAXException, IOException;
- /** This is required to use this with configurations. */
- public XMLReader getXMLReader();
-
+ public void parse(InputSource in) throws SAXException, IOException;
}
1.1.2.11 +1 -5
xml-cocoon/src/org/apache/cocoon/components/parser/Attic/XercesParser.java
Index: XercesParser.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/components/parser/Attic/XercesParser.java,v
retrieving revision 1.1.2.10
retrieving revision 1.1.2.11
diff -u -r1.1.2.10 -r1.1.2.11
--- XercesParser.java 2000/11/29 15:43:09 1.1.2.10
+++ XercesParser.java 2000/11/30 21:41:31 1.1.2.11
@@ -25,7 +25,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Pierpaolo Fumagalli</a>
* (Apache Software Foundation, Exoffice Technologies)
- * @version CVS $Revision: 1.1.2.10 $ $Date: 2000/11/29 15:43:09 $
+ * @version CVS $Revision: 1.1.2.11 $ $Date: 2000/11/30 21:41:31 $
*/
public class XercesParser extends AbstractXMLProducer
implements Parser, ErrorHandler, DOMFactory, Poolable {
@@ -47,10 +47,6 @@
this.parser.setErrorHandler(this);
this.parser.setContentHandler(super.contentHandler);
this.parser.parse(in);
- }
-
- public XMLReader getXMLReader() {
- return this.parser;
}
/**
No revision
No revision
1.1.2.9 +38 -33
xml-cocoon/src/org/apache/cocoon/generation/Attic/ServerPagesGenerator.java
Index: ServerPagesGenerator.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/generation/Attic/ServerPagesGenerator.java,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -u -r1.1.2.8 -r1.1.2.9
--- ServerPagesGenerator.java 2000/11/29 12:18:01 1.1.2.8
+++ ServerPagesGenerator.java 2000/11/30 21:41:39 1.1.2.9
@@ -36,7 +36,7 @@
* delegating actual SAX event generation.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Ricardo Rocha</a>
- * @version CVS $Revision: 1.1.2.8 $ $Date: 2000/11/29 12:18:01 $
+ * @version CVS $Revision: 1.1.2.9 $ $Date: 2000/11/30 21:41:39 $
*/
public class ServerPagesGenerator
extends ServletGenerator
@@ -107,7 +107,7 @@
URL url = new URL(systemId);
if (!url.getProtocol().equals("file")) {
throw new IOException("Not a file: " + url.toString());
- }
+ }
File file = new File(url.getFile());
@@ -133,7 +133,12 @@
// Delegate XML production to loaded generator
if (generator instanceof Composer) {
- ((Composer) generator).compose(this.manager);
+ try {
+ ((Composer) generator).compose(this.manager);
+ } catch (Exception e) {
+ log.error("Could not compose generator", e);
+ throw new ProcessingException("Could not compose generator");
+ }
}
generator.setContentHandler(this);
@@ -148,30 +153,30 @@
switch (eventData.eventType) {
case DOCUMENT:
- this.contentHandler.endDocument();
- break;
- case ELEMENT:
- this.contentHandler.endElement(
- eventData.getNamespaceURI(),
- eventData.getLocalName(),
- eventData.getRawName()
- );
- break;
- case PREFIX_MAPPING:
- this.contentHandler.endPrefixMapping(eventData.getPrefix());
- break;
- case CDATA:
- this.lexicalHandler.endCDATA();
- break;
- case DTD:
- this.lexicalHandler.endDTD();
- break;
- case ENTITY:
- this.lexicalHandler.endEntity(eventData.getName());
- break;
+ this.contentHandler.endDocument();
+ break;
+ case ELEMENT:
+ this.contentHandler.endElement(
+ eventData.getNamespaceURI(),
+ eventData.getLocalName(),
+ eventData.getRawName()
+ );
+ break;
+ case PREFIX_MAPPING:
+ this.contentHandler.endPrefixMapping(eventData.getPrefix());
+ break;
+ case CDATA:
+ this.lexicalHandler.endCDATA();
+ break;
+ case DTD:
+ this.lexicalHandler.endDTD();
+ break;
+ case ENTITY:
+ this.lexicalHandler.endEntity(eventData.getName());
+ break;
}
}
- }
+ }
/* Handlers */
@@ -300,7 +305,7 @@
this.lexicalHandler.startCDATA();
this.eventStack.push(new EventData(CDATA));
}
-
+
public void startDTD(String name, String publicId, String systemId)
throws SAXException
{
@@ -344,12 +349,12 @@
this.namespaceURI = data1;
this.localName = data2;
this.rawName = data3;
- break;
+ break;
case DTD:
this.name = data1;
this.publicId = data2;
this.systemId = data3;
- break;
+ break;
}
}
@@ -357,11 +362,11 @@
this.eventType = eventType;
switch (this.eventType) {
case PREFIX_MAPPING:
- this.prefix = data;
- break;
- case ENTITY:
- this.name = data;
- break;
+ this.prefix = data;
+ break;
+ case ENTITY:
+ this.name = data;
+ break;
}
}
No revision
No revision
1.1.2.2 +2 -2
xml-cocoon/src/org/apache/cocoon/matching/Attic/RegexpTargetHostMatcherFactory.java
Index: RegexpTargetHostMatcherFactory.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/matching/Attic/RegexpTargetHostMatcherFactory.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- RegexpTargetHostMatcherFactory.java 2000/11/16 18:02:26 1.1.2.1
+++ RegexpTargetHostMatcherFactory.java 2000/11/30 21:41:46 1.1.2.2
@@ -22,7 +22,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Paul Russell</a>
- * @version CVS $Revision: 1.1.2.1 $ $Date: 2000/11/16 18:02:26 $
+ * @version CVS $Revision: 1.1.2.2 $ $Date: 2000/11/30 21:41:46 $
*/
public class RegexpTargetHostMatcherFactory implements MatcherFactory {
@@ -65,7 +65,7 @@
.append("));");
return sb.toString();
} catch (RESyntaxException rse) {
- throw new ConfigurationException (rse.getMessage());
+ throw new ConfigurationException (rse.getMessage(), rse);
}
}
1.1.2.16 +2 -2
xml-cocoon/src/org/apache/cocoon/matching/Attic/RegexpURIMatcherFactory.java
Index: RegexpURIMatcherFactory.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/matching/Attic/RegexpURIMatcherFactory.java,v
retrieving revision 1.1.2.15
retrieving revision 1.1.2.16
diff -u -r1.1.2.15 -r1.1.2.16
--- RegexpURIMatcherFactory.java 2000/11/16 18:02:26 1.1.2.15
+++ RegexpURIMatcherFactory.java 2000/11/30 21:41:48 1.1.2.16
@@ -21,7 +21,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
- * @version CVS $Revision: 1.1.2.15 $ $Date: 2000/11/16 18:02:26 $
+ * @version CVS $Revision: 1.1.2.16 $ $Date: 2000/11/30 21:41:48 $
*/
public class RegexpURIMatcherFactory implements MatcherFactory {
@@ -80,7 +80,7 @@
sb.append("}");
return sb.toString();
} catch (RESyntaxException rse) {
- throw new ConfigurationException (rse.getMessage());
+ throw new ConfigurationException (rse.getMessage(), rse);
}
}
1.1.2.21 +2 -2
xml-cocoon/src/org/apache/cocoon/matching/Attic/WildcardURIMatcherFactory.java
Index: WildcardURIMatcherFactory.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/matching/Attic/WildcardURIMatcherFactory.java,v
retrieving revision 1.1.2.20
retrieving revision 1.1.2.21
diff -u -r1.1.2.20 -r1.1.2.21
--- WildcardURIMatcherFactory.java 2000/11/15 16:49:39 1.1.2.20
+++ WildcardURIMatcherFactory.java 2000/11/30 21:41:49 1.1.2.21
@@ -19,7 +19,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
- * @version CVS $Revision: 1.1.2.20 $ $Date: 2000/11/15 16:49:39 $
+ * @version CVS $Revision: 1.1.2.21 $ $Date: 2000/11/30 21:41:49 $
*/
public class WildcardURIMatcherFactory implements MatcherFactory {
@@ -82,7 +82,7 @@
return result.append (sourcePattern[j])
.append ("};\n").toString();
} catch (NullPointerException pe) {
- throw new ConfigurationException (pe.getMessage());
+ throw new ConfigurationException (pe.getMessage(), pe);
}
}
No revision
No revision
1.1.2.3 +43 -23
xml-cocoon/src/org/apache/cocoon/serialization/Attic/AbstractTextSerializer.java
Index: AbstractTextSerializer.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/serialization/Attic/AbstractTextSerializer.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- AbstractTextSerializer.java 2000/10/19 14:44:13 1.1.2.2
+++ AbstractTextSerializer.java 2000/11/30 21:42:00 1.1.2.3
@@ -5,7 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in
*
* the LICENSE file.
*
*****************************************************************************/
-
+
package org.apache.cocoon.serialization;
import org.apache.xml.serialize.SerializerFactory;
@@ -20,54 +20,74 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Pierpaolo Fumagalli</a>
* (Apache Software Foundation, Exoffice Technologies)
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.1.2.2 $ $Date: 2000/10/19 14:44:13 $
+ * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/11/30 21:42:00 $
*/
public abstract class AbstractTextSerializer extends AbstractSerializer
implements Configurable {
/**
* The <code>OutputFormat</code> used by this serializer.
- */
+ */
protected OutputFormat format;
-
- /**
- * Set the configurations for this serializer.
+
+ /**
+ * Set the configurations for this serializer.
*/
- public void configure(Configuration conf)
+ public void configure(Configuration conf)
throws ConfigurationException {
format = new OutputFormat();
format.setPreserveSpace(true);
- Configuration encoding = conf.getChild("encoding");
- if (encoding != null) {
+ try {
+ Configuration encoding = conf.getChild("encoding");
format.setEncoding(encoding.getValue());
+ } catch (ConfigurationException ce) {
+ // TODO: how to handle non-existant encoding?
}
+
+ String doctypePublic = null;
- Configuration doctypePublic = conf.getChild("doctype-public");
- Configuration doctypeSystem = conf.getChild("doctype-system");
- if (doctypeSystem != null) {
- format.setDoctype((doctypePublic != null) ?
doctypePublic.getValue() : null, doctypeSystem.getValue());
+ try {
+ Configuration dtPublic = conf.getChild("doctype-public");
+ doctypePublic = dtPublic.getValue();
+ } catch (ConfigurationException ce) {
+ doctypePublic = null;
}
- Configuration indent = conf.getChild("indent");
- if (indent != null) {
+ try {
+ Configuration doctypeSystem = conf.getChild("doctype-system");
+ format.setDoctype(doctypePublic, doctypeSystem.getValue());
+ } catch (ConfigurationException ce) {
+ // TODO: how to handle non-existant doctype-system?
+ }
+
+ try {
+ Configuration indent = conf.getChild("indent");
format.setIndenting(true);
format.setIndent(indent.getValueAsInt());
+ } catch (ConfigurationException ce) {
+ // TODO: how to handle non-existant indent?
}
- Configuration preserveSpace = conf.getChild("preserve-space");
- if (preserveSpace != null) {
+ try {
+ Configuration preserveSpace = conf.getChild("preserve-space");
format.setPreserveSpace(preserveSpace.getValueAsBoolean());
+ } catch (ConfigurationException ce) {
+ // TODO: how to handle non-existant preserve-space?
}
- Configuration declaration = conf.getChild("xml-declaration");
- if (declaration != null) {
+ try {
+ Configuration declaration = conf.getChild("xml-declaration");
format.setOmitXMLDeclaration(!declaration.getValueAsBoolean());
+ } catch (ConfigurationException ce) {
+ // TODO: how to handle non-existant xml-declaration?
}
-
- Configuration lineWidth = conf.getChild("line-width");
- if (lineWidth != null) {
+
+ try {
+ Configuration lineWidth = conf.getChild("line-width");
format.setLineWidth(lineWidth.getValueAsInt());
- }
+ } catch (ConfigurationException ce) {
+ // TODO: how to handle non-existant line-width?
+ }
}
}
1.1.2.15 +3 -6
xml-cocoon/src/org/apache/cocoon/serialization/Attic/SVGSerializer.java
Index: SVGSerializer.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/serialization/Attic/SVGSerializer.java,v
retrieving revision 1.1.2.14
retrieving revision 1.1.2.15
diff -u -r1.1.2.14 -r1.1.2.15
--- SVGSerializer.java 2000/11/15 19:29:41 1.1.2.14
+++ SVGSerializer.java 2000/11/30 21:42:02 1.1.2.15
@@ -71,18 +71,15 @@
// What image encoder do I use?
String enc = this.config.getChild("encoder").getValue();
- if (enc == null) {
- throw new ConfigurationException("No Image Encoder specified.");
- }
try {
log.debug("Selecting " + Roles.IMAGE_ENCODER + ": " + enc);
ComponentSelector selector = (ComponentSelector)
this.manager.lookup(Roles.IMAGE_ENCODER);
this.encoder = (ImageEncoder) selector.select(enc);
} catch (Exception e) {
- log.error("Could not select " + Roles.IMAGE_ENCODER, e);
+ log.error("Could not select " + Roles.IMAGE_ENCODER, e);
throw new ConfigurationException("The ImageEncoder '"
- + enc + "' cannot be found. Check your component
configuration in the sitemap"/*, conf*/);
+ + enc + "' cannot be found. Check your component
configuration in the sitemap", e);
}
// Configure the encoder
@@ -100,7 +97,7 @@
try {
this.backgroundColour = new Color(Integer.parseInt(bg, 16));
} catch (NumberFormatException e) {
- throw new ConfigurationException(bg + " is not a valid
color."/*, conf*/);
+ throw new ConfigurationException(bg + " is not a valid
color.", e);
}
}
}
No revision
No revision
1.1.4.33 +8 -7
xml-cocoon/src/org/apache/cocoon/servlet/Attic/CocoonServlet.java
Index: CocoonServlet.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/servlet/Attic/CocoonServlet.java,v
retrieving revision 1.1.4.32
retrieving revision 1.1.4.33
diff -u -r1.1.4.32 -r1.1.4.33
--- CocoonServlet.java 2000/11/29 16:55:19 1.1.4.32
+++ CocoonServlet.java 2000/11/30 21:42:08 1.1.4.33
@@ -43,10 +43,7 @@
import org.apache.log.Category;
import org.apache.log.output.FileOutputLogTarget;
import org.apache.log.LogTarget;
-import org.apache.log.filter.AbstractFilterTarget;
-import org.apache.log.LogEntry;
-
/**
* This is the entry point for Cocoon execution as an HTTP Servlet.
*
@@ -54,7 +51,7 @@
* (Apache Software Foundation, Exoffice Technologies)
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> Aisa
- * @version CVS $Revision: 1.1.4.32 $ $Date: 2000/11/29 16:55:19 $
+ * @version CVS $Revision: 1.1.4.33 $ $Date: 2000/11/30 21:42:08 $
*/
public class CocoonServlet extends HttpServlet {
@@ -83,10 +80,14 @@
this.context = conf.getServletContext();
try {
- String path = "file://" +
- this.context.getRealPath("/") +
+ String path = this.context.getRealPath("/") +
"/WEB-INF/logs/cocoon.log";
- log = LogKit.createLogger("cocoon", path, "DEBUG");
+
+ Category cocoonCategory = LogKit.createCategory("cocoon",
Priority.DEBUG);
+ log = LogKit.createLogger(cocoonCategory, new LogTarget[] {
+ new FileOutputLogTarget(path),
+ new ServletLogTarget(this.context, Priority.ERROR)
+ });
} catch (Exception e) {
LogKit.log("Could not set up Cocoon Logger, will use screen
instead", e);
}
1.1.2.2 +22 -1
xml-cocoon/src/org/apache/cocoon/servlet/Attic/ServletLogTarget.java
Index: ServletLogTarget.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/servlet/Attic/ServletLogTarget.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- ServletLogTarget.java 2000/11/17 20:01:04 1.1.2.1
+++ ServletLogTarget.java 2000/11/30 21:42:12 1.1.2.2
@@ -10,17 +10,38 @@
import javax.servlet.ServletContext;
import org.apache.log.output.DefaultOutputLogTarget;
+import org.apache.log.LogKit;
+import org.apache.log.Priority;
+import org.apache.log.LogEntry;
/**
* A Servlet Log Target. It will forward any LogEntry to the context.
*/
public class ServletLogTarget extends DefaultOutputLogTarget {
private ServletContext context = null;
+ private Priority.Enum priority;
- public ServletLogTarget(ServletContext context) {
+ public ServletLogTarget(ServletContext context, Priority.Enum minimum) {
+ super();
this.context = context;
+ this.priority = minimum;
}
+ public ServletLogTarget(ServletContext context) {
+ this(context, Priority.ERROR);
+ }
+
+ /**
+ * Process a log entry, via formatting and outputting it.
+ *
+ * @param entry the log entry
+ */
+ public void processEntry( final LogEntry entry )
+ {
+ if (this.priority.isLowerOrEqual(entry.getPriority())) {
+ super.processEntry(entry);
+ }
+ }
/**
* Concrete implementation of output that writes out to underlying
writer.
*
No revision
No revision
1.1.2.5 +20 -14
xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Handler.java
Index: Handler.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Handler.java,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- Handler.java 2000/10/19 14:44:19 1.1.2.4
+++ Handler.java 2000/11/30 21:42:20 1.1.2.5
@@ -5,7 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in
*
* the LICENSE file.
*
*****************************************************************************/
-
+
package org.apache.cocoon.sitemap;
import java.io.File;
@@ -27,14 +27,18 @@
import org.apache.avalon.Composer;
import org.apache.avalon.ComponentManager;
+import org.apache.log.Logger;
+import org.apache.log.LogKit;
+
/**
* Handles the manageing and stating of one <code>Sitemap</code>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/10/19 14:44:19 $
+ * @version CVS $Revision: 1.1.2.5 $ $Date: 2000/11/30 21:42:20 $
*/
public class Handler implements Runnable, Configurable, Composer, Processor {
+ protected Logger log = LogKit.getLoggerFor("cocoon");
/** the configuration */
private Configuration conf;
@@ -54,13 +58,13 @@
/** the managed sitemap */
private Sitemap sitemap;
private boolean check_reload = true;
-
- /** the regenerating thread */
+
+ /** the regenerating thread */
private Thread regeneration;
private boolean isRegenerationRunning = false;
private Environment environment;
-
- /** the sitemaps base path */
+
+ /** the sitemaps base path */
private String basePath;
public void compose (ComponentManager manager) {
@@ -96,7 +100,7 @@
}
protected boolean hasChanged () {
- if (sitemap != null) {
+ if (available()) {
if (check_reload) {
return sitemap.modifiedSince(this.sourceFile.lastModified());
}
@@ -106,11 +110,11 @@
}
protected boolean isRegenerating () {
- return isRegenerationRunning;
+ return isRegenerationRunning;
}
protected synchronized void regenerateAsynchronously (Environment
environment)
- throws Exception {
+ throws Exception {
if (!this.isRegenerationRunning) {
isRegenerationRunning = true;
regeneration = new Thread (this);
@@ -119,16 +123,18 @@
}
}
- protected synchronized void regenerate (Environment environment)
- throws Exception {
+ protected synchronized void regenerate (Environment environment)
+ throws Exception {
regenerateAsynchronously(environment);
if (regeneration != null)
regeneration.join();
}
- public boolean process (Environment environment)
+ public boolean process (Environment environment)
throws Exception {
throwEventualException();
+ if (sitemap == null)
+ log.fatalError("Sitemap is not set for the Handler!!!!");
return sitemap.process(environment);
}
@@ -162,8 +168,8 @@
this.isRegenerationRunning = false;
}
}
-
+
public void throwEventualException() throws Exception {
if (this.exception != null) throw this.exception;
}
-}
+}
1.1.2.4 +13 -11
xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Manager.java
Index: Manager.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Manager.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- Manager.java 2000/10/19 14:44:21 1.1.2.3
+++ Manager.java 2000/11/30 21:42:24 1.1.2.4
@@ -5,13 +5,13 @@
* version 1.1, a copy of which has been included with this distribution in
*
* the LICENSE file.
*
*****************************************************************************/
-
+
package org.apache.cocoon.sitemap;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
-import java.net.MalformedURLException;
+import java.net.MalformedURLException;
import java.util.Iterator;
import java.util.HashMap;
@@ -28,11 +28,11 @@
/**
* This class manages all sub <code>Sitemap</code>s of a <code>Sitemap</code>
- * Invokation of sub sitemaps will be done by this instance as well
+ * Invokation of sub sitemaps will be done by this instance as well
* checking regeneration of the sub <code>Sitemap</code>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/10/19 14:44:21 $
+ * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/11/30 21:42:24 $
*/
public class Manager implements Configurable, Composer {
@@ -60,14 +60,14 @@
this.manager = manager;
}
- public boolean invoke (Environment environment, String uri_prefix,
- String source, boolean check_reload)
+ public boolean invoke (Environment environment, String uri_prefix,
+ String source, boolean check_reload)
throws Exception {
Handler sitemapHandler = (Handler) sitemaps.get(source);
-
+
if (sitemapHandler != null) {
if (sitemapHandler.available()) {
- if (check_reload
+ if (check_reload
&& sitemapHandler.hasChanged()
&& !sitemapHandler.isRegenerating()) {
sitemapHandler.regenerateAsynchronously(environment);
@@ -78,12 +78,14 @@
} else {
sitemapHandler = new Handler(parentSitemapComponentManager,
source, check_reload);
if (sitemapHandler instanceof Composer)
sitemapHandler.compose(this.manager);
- if (sitemapHandler instanceof Configurable)
sitemapHandler.configure(this.conf);
+ if (sitemapHandler instanceof Configurable)
sitemapHandler.configure(this.conf);
sitemaps.put(source, sitemapHandler);
- sitemapHandler.regenerate(environment);
+ sitemapHandler.regenerate(environment);
}
-
+
environment.changeContext(uri_prefix, source);
+ if (! sitemapHandler.available())
+ throw new ProcessingException("The sitemap handler's sitemap is
not available.");
return sitemapHandler.process(environment);
}
No revision
No revision
1.1.2.13 +2 -2
xml-cocoon/src/org/apache/cocoon/transformation/Attic/SQLTransformer.java
Index: SQLTransformer.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/transformation/Attic/SQLTransformer.java,v
retrieving revision 1.1.2.12
retrieving revision 1.1.2.13
diff -u -r1.1.2.12 -r1.1.2.13
--- SQLTransformer.java 2000/11/10 22:38:55 1.1.2.12
+++ SQLTransformer.java 2000/11/30 21:42:32 1.1.2.13
@@ -41,7 +41,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Donald Ball</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
* (PWR Organisation & Entwicklung)
- * @version CVS $Revision: 1.1.2.12 $ $Date: 2000/11/10 22:38:55 $ $Author:
bloritsch $
+ * @version CVS $Revision: 1.1.2.13 $ $Date: 2000/11/30 21:42:32 $ $Author:
bloritsch $
*/
public class SQLTransformer extends AbstractTransformer {
@@ -507,7 +507,7 @@
md = rs.getMetaData();
}
} catch (SQLException e) {
- e.printStackTrace();
+ log.error("Caught a SQLException", e);
conn.close();
throw e;
}
1.1.2.6 +56 -55
xml-cocoon/src/org/apache/cocoon/transformation/Attic/XTTransformer.java
Index: XTTransformer.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/transformation/Attic/XTTransformer.java,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -r1.1.2.5 -r1.1.2.6
--- XTTransformer.java 2000/11/10 22:38:55 1.1.2.5
+++ XTTransformer.java 2000/11/30 21:42:33 1.1.2.6
@@ -5,7 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in
*
* the LICENSE file.
*
*****************************************************************************/
-
+
package org.apache.cocoon.transformation;
import java.io.File;
@@ -65,19 +65,19 @@
/**
* This Transformer use the XT processor.
- *
+ *
* @author <a href="mailto:[EMAIL PROTECTED]">Sahuc Sebastien</a>
- * @version CVS $Revision: 1.1.2.5 $ $Date: 2000/11/10 22:38:55 $
+ * @version CVS $Revision: 1.1.2.6 $ $Date: 2000/11/30 21:42:33 $
*/
public class XTTransformer extends DocumentHandlerWrapper
implements Transformer, Composer {
/** The store service instance */
private Store store = null;
-
+
/** The XT Processor */
private XTProcessor processor = null;
-
+
/**The DocumentHandler */
private DocumentHandler docHandler = null;
@@ -87,15 +87,15 @@
*/
public void compose(ComponentManager manager) {
try {
- log.debug("Looking up " + Roles.STORE);
+ log.debug("Looking up " + Roles.STORE);
this.store = (Store) manager.lookup(Roles.STORE);
- } catch (Exception e) {
- log.error("Could not find component", e);
- }
+ } catch (Exception e) {
+ log.error("Could not find component", e);
+ }
}
-
+
/**
- * Set the <code>EntityResolver</code>, the <code>Dictionary</code> with
+ * Set the <code>EntityResolver</code>, the <code>Dictionary</code> with
* the object model, the source and sitemap
* <code>Parameters</code> used to process the request.
*/
@@ -109,26 +109,27 @@
}
// Check the stylesheet uri
- String xsluri = src;
+ String xsluri = src;
if (xsluri == null) {
throw new ProcessingException("Stylesheet URI can't be null");
}
- // Get the stylesheet from the Store if available,
+ // Get the stylesheet from the Store if available,
// otherwise load it and put it into the store for further request
XTProcessor loaderprocessor = null;
-
+
if (store != null) {
loaderprocessor = (XTProcessor) store.get(xsluri);
}
-
- // If not in the store or if style sheet has changed, loads and
stores it
+
+ // If not in the store or if style sheet has changed, loads and
stores it
if (loaderprocessor == null || loaderprocessor.hasChanged()) {
loaderprocessor= new XTProcessor();
SAXParser saxParser = null;
try {
saxParser = SAXParserFactory.newInstance().newSAXParser();
} catch (ParserConfigurationException e) {
+ log.error("XTTransformer.setup", e);
new ProcessingException(e.getMessage());
}
loaderprocessor.setParser(saxParser.getParser());
@@ -136,11 +137,11 @@
loaderprocessor.loadStylesheet(xslsrc);
if (store != null) store.store(xsluri, loaderprocessor);
}
-
- // Always clone the processor before using it,
+
+ // Always clone the processor before using it,
// Indeed 1 instance per thread is allowed
this.processor = (XTProcessor) loaderprocessor.clone();
-
+
// Create the processor and set it as this documenthandler
// FIXME (SS): set the correct SystemId to the XML inputSource
this.docHandler = new
DocHandler(processor.createBuilder("XTSystemID"));
@@ -179,75 +180,75 @@
*/
public void setLexicalHandler(LexicalHandler lexical) {
}
-
+
/**
- * inner class DocumentHandler that delegates all SAX Events to the XT's
builder.
+ * inner class DocumentHandler that delegates all SAX Events to the XT's
builder.
*/
class DocHandler implements DocumentHandler, DTDHandler {
-
+
/**
* The XT's DocumentHandler instance to which SAX events are forwarded
*/
private XMLProcessorImpl.Builder builder = null;
-
+
/**
* The Document Handler delivered.
*/
public DocHandler(XMLProcessorImpl.Builder builder) {
- this.builder = builder;
+ this.builder = builder;
}
-
+
public void setDocumentLocator (Locator locator) {
builder.setDocumentLocator(locator);
}
-
+
public void ignorableWhitespace (char[] ch, int start, int length)
throws SAXException {
builder.ignorableWhitespace (ch, start, length);
}
-
+
public void processingInstruction (String target, String data)
throws SAXException {
builder.processingInstruction (target, data);
}
-
+
public void startDocument () throws SAXException {
- builder.startDocument();
+ builder.startDocument();
}
-
+
public void endDocument () throws SAXException {
builder.endDocument();
-
+
try {
- // We've finished with the source document.
+ // We've finished with the source document.
// Start processing it by passing the builder
- processor.process(builder.getRootNode());
+ processor.process(builder.getRootNode());
} catch (IOException ioe) {
throw new SAXException(ioe);
}
-
+
}
-
+
public void startElement (String name, AttributeList atts) throws
SAXException {
builder.startElement (name, atts);
}
-
+
public void endElement (String name) throws SAXException {
builder.endElement (name);
}
-
+
public void characters (char[] str, int index, int len) throws
SAXException {
builder.characters ( str, index, len);
}
-
+
public void notationDecl (String name, String publicId, String
systemId) throws SAXException {
builder.notationDecl (name, publicId, systemId);
}
-
+
public void unparsedEntityDecl (String name, String publicId, String
systemId, String notationName) throws SAXException {
builder.unparsedEntityDecl (name, publicId, systemId,
notationName);
- }
+ }
}
}
-
+
/**
* The XT processor.
*/
@@ -271,11 +272,11 @@
*/
public void setParser(Parser sheetParser) {
this.sheetParser = sheetParser;
- sheetLoader = new XMLProcessorImpl(sheetParser);
+ sheetLoader = new XMLProcessorImpl(sheetParser);
}
-
+
/**
- * set the DocumentHandler (Consumer) to which the XT Porcessor will
+ * set the DocumentHandler (Consumer) to which the XT Porcessor will
* fire the result SAX events.
*/
public void setDocumentHandler(DocumentHandler handler) {
@@ -283,7 +284,7 @@
}
/**
- * set the ErrorHandler
+ * set the ErrorHandler
*/
public void setErrorHandler(ErrorHandler handler) {
if (sheetParser != null)
@@ -302,7 +303,7 @@
URL url = new URL (sheetSource.getSystemId());
this.xslFile = new File(url.getFile());
lastModified = xslFile.lastModified();
-
+
// XT internal
engine = new EngineImpl(sheetLoader, new ExtensionHandlerImpl());
try {
@@ -327,9 +328,9 @@
/**
* Applies the Style sheet to the source root node.
- * the rootNode are taken from the builder retrieved with createBuilder()
method,
- * and by calling on the builder object the method getRootNode() after
the SAX events
- * have fed the builder.
+ * the rootNode are taken from the builder retrieved with createBuilder()
method,
+ * and by calling on the builder object the method getRootNode() after
the SAX events
+ * have fed the builder.
*/
public void process(Node root) throws SAXException, IOException {
try {
@@ -337,7 +338,7 @@
sheet.process(root, sheetLoader, this, result);
} catch (XSLException e) {
handleXSLException(e);
- }
+ }
}
void handleXSLException(XSLException e) throws SAXException, IOException
{
@@ -377,7 +378,7 @@
throw new Error("unexpected CloneNotSupportedException");
}
}
-
+
public Object getParameter(Name name) {
String nameString = name.getNamespace();
if (nameString == null)
@@ -395,17 +396,17 @@
public void setParameter(String name, Object obj) {
params.put(name, obj);
}
-
+
/**
* implements interface <code>Modifiable</code>
*/
public boolean modifiedSince(long date) {
return(date < this.xslFile.lastModified());
}
-
+
/**
- * Checks if the style sheet file have changed since the construction
- * of <code>this</code> instance.
+ * Checks if the style sheet file have changed since the construction
+ * of <code>this</code> instance.
*/
public boolean hasChanged() {
if (this.xslFile == null) {
1.1.2.25 +15 -12
xml-cocoon/src/org/apache/cocoon/transformation/Attic/XalanTransformer.java
Index: XalanTransformer.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/transformation/Attic/XalanTransformer.java,v
retrieving revision 1.1.2.24
retrieving revision 1.1.2.25
diff -u -r1.1.2.24 -r1.1.2.25
--- XalanTransformer.java 2000/11/29 22:35:41 1.1.2.24
+++ XalanTransformer.java 2000/11/30 21:42:34 1.1.2.25
@@ -54,7 +54,7 @@
* (Apache Software Foundation, Exoffice Technologies)
* @author <a href="mailto:[EMAIL PROTECTED]">Davanum Srinivas</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.1.2.24 $ $Date: 2000/11/29 22:35:41 $
+ * @version CVS $Revision: 1.1.2.25 $ $Date: 2000/11/30 21:42:34 $
*/
public class XalanTransformer extends ContentHandlerWrapper
implements Transformer, Composer, Poolable, Configurable {
@@ -66,7 +66,7 @@
private SAXTransformerFactory tfactory = null;
/** The trax TransformerHandler */
- private TransformerHandler transformerHandler = null;
+ private TransformerHandler transformerHandler = null;
/** Hash table for Templates */
private static Hashtable templatesCache = new Hashtable();
@@ -80,7 +80,7 @@
// Initialize a shared Transformer factory instance.
if(tfactory == null)
tfactory = (SAXTransformerFactory)
TransformerFactory.newInstance();
-
+
// Only local files are checked for midification for compatibility
reasons!
// Using the entity resolver we get the filename of the current file:
// The systemID if such a resource starts with file:/.
@@ -133,9 +133,11 @@
public void configure(Configuration conf)
throws ConfigurationException {
if (conf != null) {
- Configuration child = conf.getChild("use-cache");
- if (child != null) {
+ try {
+ Configuration child = conf.getChild("use-cache");
this.useCache = child.getValueAsBoolean(true);
+ } catch (ConfigurationException ce) {
+ this.useCache = false;
}
}
}
@@ -146,11 +148,11 @@
*/
public void compose(ComponentManager manager) {
try {
- log.debug("Looking up " + Roles.STORE);
+ log.debug("Looking up " + Roles.STORE);
this.store = (Store) manager.lookup(Roles.STORE);
- } catch (Exception e) {
- log.error("Could not find component", e);
- }
+ } catch (Exception e) {
+ log.error("Could not find component", e);
+ }
}
/**
@@ -162,7 +164,7 @@
throws SAXException, ProcessingException, IOException {
/** The Request object */
- HttpServletRequest request = (HttpServletRequest)
objectModel.get(Cocoon.REQUEST_OBJECT);
+ HttpServletRequest request = (HttpServletRequest)
objectModel.get(Cocoon.REQUEST_OBJECT);
// Check the stylesheet uri
String xsluri = src;
@@ -172,9 +174,10 @@
/** Get a Transformer Handler */
try {
- transformerHandler = getTransformerHandler(resolver,xsluri);
+ transformerHandler = getTransformerHandler(resolver,xsluri);
} catch (TransformerConfigurationException e){
- throw new ProcessingException("Problem in getTransformer:" +
e.toString());
+ log.error("Problem in getTransformer:", e);
+ throw new ProcessingException("Problem in getTransformer:");
}
if (request != null) {
No revision
No revision
1.1.2.23 +1 -0 xml-cocoon/webapp/Attic/sitemap.xmap
Index: sitemap.xmap
===================================================================
RCS file: /home/cvs/xml-cocoon/webapp/Attic/sitemap.xmap,v
retrieving revision 1.1.2.22
retrieving revision 1.1.2.23
diff -u -r1.1.2.22 -r1.1.2.23
--- sitemap.xmap 2000/10/25 16:02:20 1.1.2.22
+++ sitemap.xmap 2000/11/30 21:42:41 1.1.2.23
@@ -17,6 +17,7 @@
<map:transformers default="xslt">
<map:transformer name="xslt"
src="org.apache.cocoon.transformation.XalanTransformer">
<compile-stylesheets map:value="true"/>
+ <use-cache map:value="false"/>
</map:transformer>
<map:transformer name="log"
src="org.apache.cocoon.transformation.LogTransformer"/>
<map:transformer name="sql"
src="org.apache.cocoon.transformation.SQLTransformer"/>