cvs commit: xml-cocoon2/src/java/org/apache/cocoon/i18n XMLResourceBundle.java

2003-03-06 Thread cziegeler
cziegeler2003/03/06 06:59:34

  Modified:src/java/org/apache/cocoon/transformation Tag:
cocoon_2_0_3_branch XIncludeTransformer.java
CIncludeTransformer.java SQLTransformer.java
   src/java/org/apache/cocoon/components/xscript Tag:
cocoon_2_0_3_branch XScriptObject.java
   src/scratchpad/src/org/apache/cocoon/generation Tag:
cocoon_2_0_3_branch XPathDirectoryGenerator.java
   src/java/org/apache/cocoon/generation Tag:
cocoon_2_0_3_branch JspGenerator.java
VelocityGenerator.java PhpGenerator.java
StreamGenerator.java ScriptGenerator.java
HTMLGenerator.java
   src/java/org/apache/cocoon/components/source Tag:
cocoon_2_0_3_branch AbstractStreamSource.java
   src/java/org/apache/cocoon/components/search Tag:
cocoon_2_0_3_branch SimpleLuceneXMLIndexerImpl.java
   lib  Tag: cocoon_2_0_3_branch jars.xml
   src/java/org/apache/cocoon/sitemap Tag: cocoon_2_0_3_branch
SitemapManager.java
   src/java/org/apache/cocoon Tag: cocoon_2_0_3_branch
Cocoon.java
   src/java/org/apache/cocoon/components/resolver Tag:
cocoon_2_0_3_branch ResolverImpl.java
   src/java/org/apache/cocoon/components/deli Tag:
cocoon_2_0_3_branch DeliImpl.java
   src/documentation/xdocs/userdocs/transformers Tag:
cocoon_2_0_3_branch cinclude-transformer.xml
   src/java/org/apache/cocoon/i18n Tag: cocoon_2_0_3_branch
XMLResourceBundle.java
  Added:   lib/core Tag: cocoon_2_0_3_branch
excalibur-xmlutil-20030306.jar
  Removed: lib/core Tag: cocoon_2_0_3_branch
excalibur-xmlutil-20020820.jar
  Log:
  Updating to latest excalibur xmlutil version
  PR:
  Obtained from:
  Submitted by: 
  Reviewed by:  
  CVS: --
  CVS: PR:
  CVS:   If this change addresses a PR in the problem report tracking
  CVS:   database, then enter the PR number(s) here.
  CVS: Obtained from:
  CVS:   If this change has been taken from another system, such as NCSA,
  CVS:   then name the system in this line, otherwise delete it.
  CVS: Submitted by:
  CVS:   If this code has been contributed to Apache by someone else; i.e.,
  CVS:   they sent us a patch or a new module, then include their name/email
  CVS:   address here. If this is your work then delete this line.
  CVS: Reviewed by:
  CVS:   If we are doing pre-commit code reviews and someone else has
  CVS:   reviewed your changes, include their name(s) here.
  CVS:   If you have not had it reviewed then delete this line.
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.11.2.3  +12 -8 
xml-cocoon2/src/java/org/apache/cocoon/transformation/XIncludeTransformer.java
  
  Index: XIncludeTransformer.java
  ===
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/transformation/XIncludeTransformer.java,v
  retrieving revision 1.11.2.2
  retrieving revision 1.11.2.3
  diff -u -r1.11.2.2 -r1.11.2.3
  --- XIncludeTransformer.java  7 Feb 2003 06:59:23 -   1.11.2.2
  +++ XIncludeTransformer.java  6 Mar 2003 14:59:29 -   1.11.2.3
  @@ -50,7 +50,6 @@
   */
   package org.apache.cocoon.transformation;
   
  -import org.apache.avalon.excalibur.xml.Parser;
   import org.apache.avalon.framework.activity.Disposable;
   import org.apache.avalon.framework.component.Component;
   import org.apache.avalon.framework.component.ComponentException;
  @@ -58,11 +57,13 @@
   import org.apache.avalon.framework.component.Composable;
   import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.cocoon.ProcessingException;
  -import org.apache.avalon.excalibur.xml.xpath.XPathProcessor;
   import org.apache.cocoon.environment.Source;
   import org.apache.cocoon.environment.SourceResolver;
   import org.apache.cocoon.xml.IncludeXMLConsumer;
   import org.apache.cocoon.xml.dom.DOMStreamer;
  +import org.apache.excalibur.xml.dom.DOMParser;
  +import org.apache.excalibur.xml.sax.SAXParser;
  +import org.apache.excalibur.xml.xpath.XPathProcessor;
   import org.w3c.dom.Document;
   import org.w3c.dom.NodeList;
   import org.xml.sax.Attributes;
  @@ -289,16 +290,17 @@
   }
   } else if (parse.equals("xml")) {
   getLogger().debug("Parse type is XML");
  -Parser parser = null;
  +Object parser = null;
   try {
  -parser = (Parser)manage

cvs commit: xml-cocoon2/src/java/org/apache/cocoon/i18n XMLResourceBundle.java

2003-01-10 Thread giacomo
giacomo 2003/01/10 12:53:20

  Modified:src/java/org/apache/cocoon/i18n XMLResourceBundle.java
  Log:
  messed up license text
  
  Revision  ChangesPath
  1.15  +11 -1 
xml-cocoon2/src/java/org/apache/cocoon/i18n/XMLResourceBundle.java
  
  Index: XMLResourceBundle.java
  ===
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/i18n/XMLResourceBundle.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -d -b -u -r1.14 -r1.15
  --- XMLResourceBundle.java10 Jan 2003 20:47:40 -  1.14
  +++ XMLResourceBundle.java10 Jan 2003 20:53:20 -  1.15
  @@ -1,27 +1,35 @@
   /*
  +
  
The Apache Software License, Version 1.1
  
  Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  +
  Redistribution and use in source and binary forms, with or without modifica-
  tion, are permitted provided that the following conditions are met:
  +
  1. Redistributions of  source code must  retain the above copyright  notice,
 this list of conditions and the following disclaimer.
  +
  2. Redistributions in binary form must reproduce the above copyright notice,
 this list of conditions and the following disclaimer in the documentation
 and/or other materials provided with the distribution.
  +
  3. The end-user documentation included with the redistribution, if any, must
 include  the following  acknowledgment:  "This product includes  software
 developed  by the  Apache Software Foundation  (http://www.apache.org/)."
 Alternately, this  acknowledgment may  appear in the software itself,  if
 and wherever such third-party acknowledgments normally appear.
  +
  4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
 used to  endorse or promote  products derived from  this software without
 prior written permission. For written permission, please contact
 [EMAIL PROTECTED]
  +
  5. Products  derived from this software may not  be called "Apache", nor may
 "Apache" appear  in their name,  without prior written permission  of the
 Apache Software Foundation.
  +
  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
  @@ -32,11 +40,13 @@
  ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
  (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  +
  This software  consists of voluntary contributions made  by many individuals
  on  behalf of the Apache Software  Foundation and was  originally created by
  Stefano Mazzocchi  <[EMAIL PROTECTED]>. For more  information on the Apache
  Software Foundation, please see .
  - */
  +
  +*/
   package org.apache.cocoon.i18n;
   
   import java.io.IOException;
  
  
  

--
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail:  [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




cvs commit: xml-cocoon2/src/java/org/apache/cocoon/i18n XMLResourceBundle.java

2003-01-10 Thread giacomo
giacomo 2003/01/10 12:47:40

  Modified:src/java/org/apache/cocoon/i18n XMLResourceBundle.java
  Log:
  some code formatting
  
  Revision  ChangesPath
  1.14  +167 -141  
xml-cocoon2/src/java/org/apache/cocoon/i18n/XMLResourceBundle.java
  
  Index: XMLResourceBundle.java
  ===
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/i18n/XMLResourceBundle.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -d -b -u -r1.13 -r1.14
  --- XMLResourceBundle.java7 Jan 2003 23:56:12 -   1.13
  +++ XMLResourceBundle.java10 Jan 2003 20:47:40 -  1.14
  @@ -1,36 +1,27 @@
   /*
  -

  The Apache Software License, Version 1.1

  -
Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  -
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
  -
1. Redistributions of  source code must  retain the above copyright  notice,
   this list of conditions and the following disclaimer.
  -
2. Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.
  -
3. The end-user documentation included with the redistribution, if any, must
   include  the following  acknowledgment:  "This product includes  software
   developed  by the  Apache Software Foundation  (http://www.apache.org/)."
   Alternately, this  acknowledgment may  appear in the software itself,  if
   and wherever such third-party acknowledgments normally appear.
  -
4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
   used to  endorse or promote  products derived from  this software without
   prior written permission. For written permission, please contact
   [EMAIL PROTECTED]
  -
5. Products  derived from this software may not  be called "Apache", nor may
   "Apache" appear  in their name,  without prior written permission  of the
   Apache Software Foundation.
  -
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
  @@ -41,13 +32,11 @@
ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
(INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  -
This software  consists of voluntary contributions made  by many individuals
on  behalf of the Apache Software  Foundation and was  originally created by
Stefano Mazzocchi  <[EMAIL PROTECTED]>. For more  information on the Apache
Software Foundation, please see .
  -
  -*/
  + */
   package org.apache.cocoon.i18n;
   
   import java.io.IOException;
  @@ -63,11 +52,12 @@
   import javax.xml.parsers.DocumentBuilderFactory;
   import javax.xml.parsers.ParserConfigurationException;
   
  -import org.apache.avalon.excalibur.xml.xpath.XPathProcessor;
   import org.apache.avalon.framework.component.ComponentException;
   import org.apache.avalon.framework.component.ComponentManager;
   import org.apache.avalon.framework.logger.Logger;
   
  +import org.apache.avalon.excalibur.xml.xpath.XPathProcessor;
  +
   import org.apache.excalibur.source.Source;
   import org.apache.excalibur.source.SourceResolver;
   
  @@ -75,25 +65,26 @@
   import org.w3c.dom.NamedNodeMap;
   import org.w3c.dom.Node;
   import org.w3c.dom.NodeList;
  +
   import org.xml.sax.InputSource;
   import org.xml.sax.SAXException;
   
  +
   /**
  - * Implementation of Bundle interface for XML resources.
  - * Represents a single XML message bundle.
  + * Implementation of Bundle interface for XML resources. Represents a 
single XML message bundle.
*
* @author mailto:[EMAIL PROTECTED]";>Mike Engelhart
* @author mailto:[EMAIL PROTECTED]";>Neeme Praks
* @author mailto:[EMAIL PROTECTED]";>Oleg Podolsky
* @author mailto:[EMAIL PROTECTED]";>Matthieu Sozeau
  - * @author mailto:[EMAIL PROTECTED]";>Konstantin Piroumian
  - * $Id$
  + * @author mailto:[EMAIL PROTECTED]";>Konstantin Piroumian $Id: 
XMLResourceBundle.java,v 1.13
  + * 2003/01/07 23:56:12 giacomo Exp $
*/
  -public class XMLResourceBundle extends ResourceBundle implements Bundle {
  -
  +public class XMLResourceBundle
  +extends ResourceBundle
  +implements Bundle {
   /** DOM factory */
  -protected static DocumentBuilderFactory docfactory =
  - 

cvs commit: xml-cocoon2/src/java/org/apache/cocoon/i18n XMLResourceBundle.java

2002-12-17 Thread kpiroumian
kpiroumian2002/12/17 04:03:07

  Modified:.changes.xml
   src/java/org/apache/cocoon/i18n XMLResourceBundle.java
  Log:
  
Perform correct source resolution in XMLResourceBundle.
Now i18n transformer can obtain dictionaries using any supported source (e.g. 
'cocoon:/').
  
  
  Revision  ChangesPath
  1.309 +5 -1  xml-cocoon2/changes.xml
  
  Index: changes.xml
  ===
  RCS file: /home/cvs/xml-cocoon2/changes.xml,v
  retrieving revision 1.308
  retrieving revision 1.309
  diff -u -r1.308 -r1.309
  --- changes.xml   17 Dec 2002 11:13:21 -  1.308
  +++ changes.xml   17 Dec 2002 12:03:06 -  1.309
  @@ -40,6 +40,10 @@

   

  +  
  +Perform correct source resolution in XMLResourceBundle.
  +Now i18n transformer can obtain dictionaries using any supported source (e.g. 
'cocoon:/').
  +  
 
   Added Greek translation, thanks to Stavros Kounis ([EMAIL PROTECTED]).
   Corrected Armenian translation to be real Unicode and be 
  
  
  
  1.12  +34 -16
xml-cocoon2/src/java/org/apache/cocoon/i18n/XMLResourceBundle.java
  
  Index: XMLResourceBundle.java
  ===
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/i18n/XMLResourceBundle.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- XMLResourceBundle.java13 Nov 2002 22:09:35 -  1.11
  +++ XMLResourceBundle.java17 Dec 2002 12:03:07 -  1.12
  @@ -68,12 +68,16 @@
   import org.w3c.dom.Node;
   import org.w3c.dom.NodeList;
   import org.xml.sax.SAXException;
  +import org.xml.sax.InputSource;
   
   import org.apache.avalon.excalibur.xml.xpath.XPathProcessor;
   import org.apache.avalon.framework.component.ComponentException;
   import org.apache.avalon.framework.component.ComponentManager;
   import org.apache.avalon.framework.logger.Logger;
   
  +import org.apache.excalibur.source.Source;
  +import org.apache.excalibur.source.SourceResolver;
  +
   /**
* Implementation of Bundle interface for XML resources.
* Represents a single XML message bundle.
  @@ -182,14 +186,28 @@
* @exception ParserConfigurationException if no parser is configured
* @exception SAXException  if an error occurs while parsing the file
*/
  -protected static Document loadResourceBundle(String fileName)
  +protected synchronized Document loadResourceBundle(String fileName)
   throws IOException, ParserConfigurationException, SAXException {
   
   DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
   DocumentBuilder builder = factory.newDocumentBuilder();
  +Source source = null;
  +SourceResolver resolver = null;
  +try {
  +resolver = (SourceResolver)manager.lookup(SourceResolver.ROLE);
  +source = resolver.resolveURI(fileName);
  +return builder.parse(new InputSource(source.getInputStream()));
  +}
  +catch (Exception e) {
  +logger.warn("XMLResourceBundle: Non excalibur-source " + fileName, e);
  +}
  +finally {
  +resolver.release(source);
  +manager.release(resolver);
  +}
  +// Fallback try
   return builder.parse(fileName);
   }
  -
   /**
* Gets the name of the bundle.
*
  @@ -273,15 +291,15 @@
* @return  the value
*/
   private Node getFromCache(String key) {
  - Object value;
  - if (logger.isDebugEnabled())
  +Object value;
  +if (logger.isDebugEnabled())
   logger.debug(name + ": returning from cache: " + key);
   
  - value = cache.get(key);
  - if(value == null)
  - logger.debug("Could not find!");
  +value = cache.get(key);
  +if(value == null)
  +logger.debug("Could not find!");
   
  - return (Node) value;
  +return (Node) value;
   }
   
   /**
  @@ -292,7 +310,7 @@
* @param   pathToParentXPath to the parent node
*/
   private void cacheAll(Node parent, String pathToParent) {
  - if (logger.isDebugEnabled())
  +if (logger.isDebugEnabled())
   logger.debug("Caching all messages");
   
   NodeList children = parent.getChildNodes();
  @@ -302,7 +320,7 @@
   Node child = children.item(i);
   
   if(child.getNodeType() == Node.ELEMENT_NODE) {
  - StringBuffer pathToChild = new StringBuffer(pathToParent)
  +StringBuffer pathToChild = new StringBuffer(pathToParent)
   .append('/').append(child.getNodeName());
   
   NamedNodeMap attrs = child.getAttributes();
  @@ -315,15 +333,15 @@
   temp = attrs.item(j);
   if (!temp.getNodeName().equal

cvs commit: xml-cocoon2/src/java/org/apache/cocoon/i18n XMLResourceBundle.java XMLResourceBundleFactory.java

2002-05-30 Thread kpiroumian

kpiroumian02/05/30 04:56:46

  Modified:src/webapp Tag: cocoon_2_0_3_branch sitemap.xmap
   src/java/org/apache/cocoon/i18n Tag: cocoon_2_0_3_branch
XMLResourceBundle.java
XMLResourceBundleFactory.java
  Log:
  Fixed a bug that prevented normal 'cache-at-startup' functioning.
  Changed log message for not found dictionaries to 'info'.
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.46.2.1  +1 -0  xml-cocoon2/src/webapp/sitemap.xmap
  
  Index: sitemap.xmap
  ===
  RCS file: /home/cvs/xml-cocoon2/src/webapp/sitemap.xmap,v
  retrieving revision 1.46
  retrieving revision 1.46.2.1
  diff -u -r1.46 -r1.46.2.1
  --- sitemap.xmap  6 Apr 2002 06:30:35 -   1.46
  +++ sitemap.xmap  30 May 2002 11:56:46 -  1.46.2.1
  @@ -124,6 +124,7 @@
   src="org.apache.cocoon.transformation.I18nTransformer">
   messages
   translations
  +true
  
   
  mailto:[EMAIL PROTECTED]";>Mike Engelhart
* @author mailto:[EMAIL PROTECTED]";>Neeme Praks
* @author mailto:[EMAIL PROTECTED]";>Oleg Podolsky
  - * @version $Id: XMLResourceBundle.java,v 1.7 2002/03/13 16:28:02 cziegeler Exp $
  + * @version $Id: XMLResourceBundle.java,v 1.7.2.1 2002/05/30 11:56:46 kpiroumian 
Exp $
*/
   public class XMLResourceBundle
   extends ResourceBundle
  @@ -146,8 +146,10 @@
   this.doc = loadResourceBundle(fileName);
   this.locale = locale;
   this.parent = parent;
  -if (cacheAtStartup)
  -cacheAll(doc.getDocumentElement(), "");
  +if (cacheAtStartup) {
  +Node root = doc.getDocumentElement();
  +cacheAll(root, "/" + root.getNodeName());
  +}
   }
   
   /**
  
  
  
  1.5.2.1   +12 -5 
xml-cocoon2/src/java/org/apache/cocoon/i18n/XMLResourceBundleFactory.java
  
  Index: XMLResourceBundleFactory.java
  ===
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/i18n/XMLResourceBundleFactory.java,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -r1.5 -r1.5.2.1
  --- XMLResourceBundleFactory.java 22 Feb 2002 07:03:52 -  1.5
  +++ XMLResourceBundleFactory.java 30 May 2002 11:56:46 -  1.5.2.1
  @@ -70,6 +70,9 @@
   import java.util.Locale;
   import java.util.Map;
   
  +import java.io.FileNotFoundException;
  +import java.io.IOException;
  +
   /**
* This is the XMLResourceBundleFactory, the method for getting and
* creating XMLResourceBundles.
  @@ -77,7 +80,7 @@
* @author mailto:[EMAIL PROTECTED]";>Mike Engelhart
* @author mailto:[EMAIL PROTECTED]";>Neeme Praks
* @author mailto:[EMAIL PROTECTED]";>Oleg Podolsky
  - * @version $Id: XMLResourceBundleFactory.java,v 1.5 2002/02/22 07:03:52 cziegeler 
Exp $
  + * @version $Id: XMLResourceBundleFactory.java,v 1.5.2.1 2002/05/30 11:56:46 
kpiroumian Exp $
*/
   
   public class XMLResourceBundleFactory
  @@ -347,13 +350,17 @@
   bundle.init(name, fileName, loc, parentBundle, cacheAtStartup);
   return bundle;
   }
  -catch (SAXParseException e)
  +catch (FileNotFoundException fe)
   {
  -if (logger.isInfoEnabled()) logger.info("Resource loading failed: " + 
e.getMessage());
  +logger.info("Resource not found: " + name + ", locale " + loc
  ++ ", bundleName " + fileName + ". Exception: " + fe.getMessage());
   }
  -catch (Exception e)
  +catch (SAXParseException se)
   {
  -logger.error("Error while loading resource: " + name + ", locale " + 
loc + ", bundleName " + fileName, e);
  +logger.error("Incorrect resource format", se);
  +}
  +catch (Exception e) {
  +logger.error("Resource loading failed", e);
   }
   return null;
   }
  
  
  

--
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail:  [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]