summaryrefslogtreecommitdiff
path: root/libjava/classpath/javax/xml
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/classpath/javax/xml')
-rw-r--r--libjava/classpath/javax/xml/XMLConstants.java9
-rw-r--r--libjava/classpath/javax/xml/datatype/DatatypeConstants.java9
-rw-r--r--libjava/classpath/javax/xml/datatype/DatatypeFactory.java45
-rw-r--r--libjava/classpath/javax/xml/datatype/Duration.java10
-rw-r--r--libjava/classpath/javax/xml/validation/SchemaFactory.java17
-rw-r--r--libjava/classpath/javax/xml/validation/SchemaFactoryLoader.java52
-rw-r--r--libjava/classpath/javax/xml/xpath/XPathConstants.java8
7 files changed, 117 insertions, 33 deletions
diff --git a/libjava/classpath/javax/xml/XMLConstants.java b/libjava/classpath/javax/xml/XMLConstants.java
index 735620755df..0d4a65ff981 100644
--- a/libjava/classpath/javax/xml/XMLConstants.java
+++ b/libjava/classpath/javax/xml/XMLConstants.java
@@ -1,5 +1,5 @@
/* XMLConstants.java --
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,10 +41,15 @@ package javax.xml;
* Repository for well-known XML constants.
*
* @author (a href='mailto:dog@gnu.org'>Chris Burdess</a)
- * @since 1.3
+ * @since 1.5
*/
public final class XMLConstants
{
+
+ private XMLConstants()
+ {
+ // to prevent instantiation
+ }
/**
* Dummy namespace URI indicating that there is no namespace.
diff --git a/libjava/classpath/javax/xml/datatype/DatatypeConstants.java b/libjava/classpath/javax/xml/datatype/DatatypeConstants.java
index 3919d03daff..6098e084b7b 100644
--- a/libjava/classpath/javax/xml/datatype/DatatypeConstants.java
+++ b/libjava/classpath/javax/xml/datatype/DatatypeConstants.java
@@ -1,5 +1,5 @@
/* DatatypeConstants.java --
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,11 +43,16 @@ import javax.xml.namespace.QName;
* Basic data type constants.
*
* @author (a href='mailto:dog@gnu.org'>Chris Burdess</a)
- * @since 1.3
+ * @since 1.5
*/
public final class DatatypeConstants
{
+ private DatatypeConstants()
+ {
+ // to prevent instantiation
+ }
+
/**
* Typesafe enumerated class representing the six fields of the
* <a href='Duration.html'>Duration</a> class.
diff --git a/libjava/classpath/javax/xml/datatype/DatatypeFactory.java b/libjava/classpath/javax/xml/datatype/DatatypeFactory.java
index 98a5690e873..14f507416ab 100644
--- a/libjava/classpath/javax/xml/datatype/DatatypeFactory.java
+++ b/libjava/classpath/javax/xml/datatype/DatatypeFactory.java
@@ -1,5 +1,5 @@
/* DatatypeFactory.java --
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,16 +37,24 @@ exception statement from your version. */
package javax.xml.datatype;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.GregorianCalendar;
+import java.util.Iterator;
+import java.util.Properties;
+import gnu.classpath.ServiceFactory;
/**
* Factory class to create new datatype objects mapping XML to and from Java
* objects.
*
- * @author (a href='mailto:dog@gnu.org'>Chris Burdess</a)
- * @since 1.3
+ * @author Chris Burdess
+ * @since 1.5
*/
public abstract class DatatypeFactory
{
@@ -59,7 +67,7 @@ public abstract class DatatypeFactory
/**
* JAXP 1.3 default implementation class name.
*/
- public static final java.lang.String DATATYPEFACTORY_IMPLEMENTATION_CLASS = "gnu.xml.datatype.JAXPDatatypeFactory";
+ public static final String DATATYPEFACTORY_IMPLEMENTATION_CLASS = "gnu.xml.datatype.JAXPDatatypeFactory";
protected DatatypeFactory()
{
@@ -73,12 +81,35 @@ public abstract class DatatypeFactory
{
try
{
+ // 1. system property
+ String className = System.getProperty(DATATYPEFACTORY_PROPERTY);
+ if (className != null)
+ return (DatatypeFactory) Class.forName(className).newInstance();
+ // 2. jaxp.properties property
+ File javaHome = new File(System.getProperty("java.home"));
+ File javaHomeLib = new File(javaHome, "lib");
+ File jaxpProperties = new File(javaHomeLib, "jaxp.properties");
+ if (jaxpProperties.exists())
+ {
+ FileInputStream in = new FileInputStream(jaxpProperties);
+ Properties p = new Properties();
+ p.load(in);
+ in.close();
+ className = p.getProperty(DATATYPEFACTORY_PROPERTY);
+ if (className != null)
+ return (DatatypeFactory) Class.forName(className).newInstance();
+ }
+ // 3. services
+ Iterator i = ServiceFactory.lookupProviders(DatatypeFactory.class);
+ if (i.hasNext())
+ return (DatatypeFactory) i.next();
+ // 4. fallback
Class t = Class.forName(DATATYPEFACTORY_IMPLEMENTATION_CLASS);
return (DatatypeFactory) t.newInstance();
}
catch (Exception e)
{
- throw new DatatypeConfigurationException (e);
+ throw new DatatypeConfigurationException(e);
}
}
@@ -172,7 +203,7 @@ public abstract class DatatypeFactory
BigInteger days,
BigInteger hours,
BigInteger minutes,
- BigDecimal seconds)
+ BigInteger seconds)
{
return newDuration(isPositive,
null,
@@ -180,7 +211,7 @@ public abstract class DatatypeFactory
days,
hours,
minutes,
- seconds);
+ new BigDecimal(seconds));
}
/**
diff --git a/libjava/classpath/javax/xml/datatype/Duration.java b/libjava/classpath/javax/xml/datatype/Duration.java
index fb1d65537cc..96390fde467 100644
--- a/libjava/classpath/javax/xml/datatype/Duration.java
+++ b/libjava/classpath/javax/xml/datatype/Duration.java
@@ -1,5 +1,5 @@
/* Duration.java --
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,7 +48,7 @@ import javax.xml.namespace.QName;
* An immutable time space as specified in XML Schema 1.0.
*
* @author (a href='mailto:dog@gnu.org'>Chris Burdess</a)
- * @since 1.3
+ * @since 1.5
*/
public abstract class Duration
{
@@ -240,11 +240,7 @@ public abstract class Duration
/**
* Returns the result of multiplying this duration by the given factor.
*/
- public Duration multiply(BigDecimal factor)
- {
- // TODO
- throw new UnsupportedOperationException();
- }
+ public abstract Duration multiply(BigDecimal factor);
/**
* Returns the unary negative of this duration.
diff --git a/libjava/classpath/javax/xml/validation/SchemaFactory.java b/libjava/classpath/javax/xml/validation/SchemaFactory.java
index f33c1c6297e..0042ea32348 100644
--- a/libjava/classpath/javax/xml/validation/SchemaFactory.java
+++ b/libjava/classpath/javax/xml/validation/SchemaFactory.java
@@ -1,5 +1,5 @@
/* SchemaFactory.java --
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -52,13 +52,10 @@ import org.xml.sax.SAXNotSupportedException;
* Factory for obtaining schemata.
*
* @author Chris Burdess (dog@gnu.org)
- * @since 1.3
+ * @since 1.5
*/
public abstract class SchemaFactory
{
-
- ErrorHandler errorHandler;
-
protected SchemaFactory()
{
}
@@ -109,15 +106,9 @@ public abstract class SchemaFactory
throw new SAXNotRecognizedException(name);
}
- public ErrorHandler getErrorHandler()
- {
- return errorHandler;
- }
+ public abstract ErrorHandler getErrorHandler();
- public void setErrorHandler(ErrorHandler errorHandler)
- {
- this.errorHandler = errorHandler;
- }
+ public abstract void setErrorHandler(ErrorHandler errorHandler);
public abstract LSResourceResolver getResourceResolver();
diff --git a/libjava/classpath/javax/xml/validation/SchemaFactoryLoader.java b/libjava/classpath/javax/xml/validation/SchemaFactoryLoader.java
new file mode 100644
index 00000000000..dc80a33ccab
--- /dev/null
+++ b/libjava/classpath/javax/xml/validation/SchemaFactoryLoader.java
@@ -0,0 +1,52 @@
+/* SchemaFactory.java --
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.xml.validation;
+
+/**
+ * API compatibility class. Do not use.
+ */
+public abstract class SchemaFactoryLoader
+{
+
+ protected SchemaFactoryLoader()
+ {
+ }
+
+ public abstract SchemaFactory newFactory(String schemaLanguage);
+
+}
diff --git a/libjava/classpath/javax/xml/xpath/XPathConstants.java b/libjava/classpath/javax/xml/xpath/XPathConstants.java
index 3b2d5d2d992..fbfb9998118 100644
--- a/libjava/classpath/javax/xml/xpath/XPathConstants.java
+++ b/libjava/classpath/javax/xml/xpath/XPathConstants.java
@@ -1,5 +1,5 @@
/* XPathConstants.java --
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,10 +43,14 @@ import javax.xml.namespace.QName;
* XPath constants.
*
* @author (a href='mailto:dog@gnu.org'>Chris Burdess</a)
- * @since 1.3
+ * @since 1.5
*/
public class XPathConstants
{
+ private XPathConstants()
+ {
+ // to prevent instantiation
+ }
/**
* The XPath 1.0 number data type.