Author: heiko.braun(a)jboss.com
Date: 2007-09-05 10:15:50 -0400 (Wed, 05 Sep 2007)
New Revision: 4525
Added:
stack/native/trunk/src/main/java/org/jboss/ws/soap/SAAJFactoryLoader.java
Removed:
stack/native/trunk/src/main/java/javax/xml/soap/SAAJFactoryLoader.java
Modified:
stack/native/trunk/ant-import-tests/build-testsuite.xml
stack/native/trunk/src/main/java/javax/xml/soap/MessageFactory.java
stack/native/trunk/src/main/java/javax/xml/soap/SAAJMetaFactory.java
stack/native/trunk/src/main/java/javax/xml/soap/SOAPConnection.java
stack/native/trunk/src/main/java/javax/xml/soap/SOAPFactory.java
stack/native/trunk/src/main/java/javax/xml/soap/SOAPHeaderElement.java
stack/native/trunk/src/main/java/org/jboss/ws/core/soap/SOAPHeaderElementImpl.java
Log:
Fix JBCTS-312: javax.xml.soap.sig_1.3.javaee
Modified: stack/native/trunk/ant-import-tests/build-testsuite.xml
===================================================================
--- stack/native/trunk/ant-import-tests/build-testsuite.xml 2007-09-05 14:09:02 UTC (rev
4524)
+++ stack/native/trunk/ant-import-tests/build-testsuite.xml 2007-09-05 14:15:50 UTC (rev
4525)
@@ -177,8 +177,8 @@
<classpath
location="${tests.output.dir}/resources/jaxws/samples/wssecurityAnnotatedpolicy"/>
</taskdef>
- <wsprovide
resourcedestdir="${tests.output.dir}/wsprovide/resources/jaxws/samples/wssecurity"
genwsdl="true"
sei="org.jboss.test.ws.jaxws.samples.wssecurity.HelloJavaBean"/>
- <wsprovide
resourcedestdir="${tests.output.dir}/wsprovide/resources/jaxws/samples/wssecurityAnnotatedpolicy"
genwsdl="true"
sei="org.jboss.test.ws.jaxws.samples.wssecurityAnnotatedpolicy.HelloJavaBean"/>
+ <!--wsprovide
resourcedestdir="${tests.output.dir}/wsprovide/resources/jaxws/samples/wssecurity"
genwsdl="true"
sei="org.jboss.test.ws.jaxws.samples.wssecurity.HelloJavaBean"/>
+ <wsprovide
resourcedestdir="${tests.output.dir}/wsprovide/resources/jaxws/samples/wssecurityAnnotatedpolicy"
genwsdl="true"
sei="org.jboss.test.ws.jaxws.samples.wssecurityAnnotatedpolicy.HelloJavaBean"/-->
</target>
<target name="tests-compile-generated-resources"
depends="servicegen,wstools,wsprovide">
Modified: stack/native/trunk/src/main/java/javax/xml/soap/MessageFactory.java
===================================================================
--- stack/native/trunk/src/main/java/javax/xml/soap/MessageFactory.java 2007-09-05
14:09:02 UTC (rev 4524)
+++ stack/native/trunk/src/main/java/javax/xml/soap/MessageFactory.java 2007-09-05
14:15:50 UTC (rev 4525)
@@ -23,6 +23,7 @@
import java.io.IOException;
import java.io.InputStream;
+import java.lang.reflect.Method;
/**
A factory for creating SOAPMessage objects.
@@ -70,9 +71,12 @@
try
{
String propertyName = "javax.xml.soap.MessageFactory";
- factory = (MessageFactory)SAAJFactoryLoader.loadFactory(propertyName, null);
+
+ Class loaderClass =
Class.forName("org.jboss.ws.soap.SAAJFactoryLoader");
+ Method m = loaderClass.getMethod("loadFactory", new Class[]
{String.class, String.class});
+ factory = (MessageFactory)m.invoke(null, new Object[] {propertyName, null});
}
- catch (RuntimeException rte)
+ catch (Exception rte)
{
throw new SOAPException(rte);
}
Deleted: stack/native/trunk/src/main/java/javax/xml/soap/SAAJFactoryLoader.java
===================================================================
--- stack/native/trunk/src/main/java/javax/xml/soap/SAAJFactoryLoader.java 2007-09-05
14:09:02 UTC (rev 4524)
+++ stack/native/trunk/src/main/java/javax/xml/soap/SAAJFactoryLoader.java 2007-09-05
14:15:50 UTC (rev 4525)
@@ -1,194 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package javax.xml.soap;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.Properties;
-
-
-// $Id$
-
-/**
- * Load a factory using this ordered lookup procedure
- *
- * <ol>
- * <li>Use the system property
- * <li>Use the properties file "lib/jaxm.properties" in the JRE
directory
- * <li>Use the Services API (as detailed in the JAR specification), if available,
to determine the classname
- * <li>Use the default factory implementation class
- * </ol>
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 14-Dec-2006
- */
-public class SAAJFactoryLoader
-{
- private SAAJFactoryLoader()
- {
- }
-
- /**
- *
- * @return the factory impl, or null
- */
- public static Object loadFactory(String propertyName, String defaultFactory)
- {
- Object factory = null;
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
-
- // Use the system property
- PrivilegedAction action = new PropertyAccessAction(propertyName);
- String factoryName = (String)AccessController.doPrivileged(action);
- if (factoryName != null)
- {
- try
- {
- //if(log.isDebugEnabled()) log.debug("Load from system property: "
+ factoryName);
- Class factoryClass = loader.loadClass(factoryName);
- factory = factoryClass.newInstance();
- }
- catch (Throwable t)
- {
- throw new IllegalStateException("Failed to load " + propertyName +
": " + factoryName, t);
- }
- }
-
- // Use the properties file "lib/jaxm.properties" in the JRE directory.
- // This configuration file is in standard java.util.Properties format and contains
the fully qualified name of the implementation class with the key being the system
property defined above.
- if (factory == null)
- {
- action = new PropertyAccessAction("java.home");
- String javaHome = (String)AccessController.doPrivileged(action);
- File jaxmFile = new File(javaHome + "/lib/jaxm.properties");
- if (jaxmFile.exists())
- {
- try
- {
- action = new PropertyFileAccessAction(jaxmFile.getCanonicalPath());
- Properties jaxmProperties =
(Properties)AccessController.doPrivileged(action);
- factoryName = jaxmProperties.getProperty(propertyName);
- if (factoryName != null)
- {
- //if(log.isDebugEnabled()) log.debug("Load from " + jaxmFile
+ ": " + factoryName);
- Class factoryClass = loader.loadClass(factoryName);
- factory = factoryClass.newInstance();
- }
- }
- catch (Throwable t)
- {
- throw new IllegalStateException("Failed to load " + propertyName
+ ": " + factoryName, t);
- }
- }
- }
-
- // Use the Services API (as detailed in the JAR specification), if available, to
determine the classname.
- if (factory == null)
- {
- String filename = "META-INF/services/" + propertyName;
- InputStream inStream = loader.getResourceAsStream(filename);
- if (inStream != null)
- {
- try
- {
- BufferedReader br = new BufferedReader(new InputStreamReader(inStream,
"UTF-8"));
- factoryName = br.readLine();
- br.close();
- if (factoryName != null)
- {
- //if(log.isTraceEnabled()) log.trace("Load from Service API "
+ filename + ": " + factoryName);
- Class factoryClass = loader.loadClass(factoryName);
- factory = factoryClass.newInstance();
- }
- }
- catch (Throwable t)
- {
- throw new IllegalStateException("Failed to load " + propertyName
+ ": " + factoryName, t);
- }
- }
- }
-
- // Use the default factory implementation class.
- if (factory == null && defaultFactory != null)
- {
- try
- {
- factoryName = defaultFactory;
- //if(log.isDebugEnabled()) log.debug("Load from default: " +
factoryName);
- Class factoryClass = loader.loadClass(factoryName);
- factory = factoryClass.newInstance();
- }
- catch (Throwable t)
- {
- throw new IllegalStateException("Failed to load " + propertyName +
": " + factoryName, t);
- }
- }
-
- return factory;
- }
-
- private static class PropertyAccessAction implements PrivilegedAction
- {
- private String name;
-
- PropertyAccessAction(String name)
- {
- this.name = name;
- }
-
- public Object run()
- {
- return System.getProperty(name);
- }
- }
-
- private static class PropertyFileAccessAction implements PrivilegedAction
- {
- private String filename;
-
- PropertyFileAccessAction(String filename)
- {
- this.filename = filename;
- }
-
- public Object run()
- {
- try
- {
- InputStream inStream = new FileInputStream(filename);
- Properties props = new Properties();
- props.load(inStream);
- return props;
- }
- catch (IOException ex)
- {
- throw new SecurityException("Cannot load properties: " + filename,
ex);
- }
- }
- }
-}
Modified: stack/native/trunk/src/main/java/javax/xml/soap/SAAJMetaFactory.java
===================================================================
--- stack/native/trunk/src/main/java/javax/xml/soap/SAAJMetaFactory.java 2007-09-05
14:09:02 UTC (rev 4524)
+++ stack/native/trunk/src/main/java/javax/xml/soap/SAAJMetaFactory.java 2007-09-05
14:15:50 UTC (rev 4525)
@@ -21,6 +21,8 @@
*/
package javax.xml.soap;
+import java.lang.reflect.Method;
+
// $Id$
/**
@@ -57,8 +59,19 @@
{
String propertyName = "javax.xml.soap.MetaFactory";
String defaultImpl = "org.jboss.ws.core.soap.SAAJMetaFactoryImpl";
- SAAJMetaFactory factory =
(SAAJMetaFactory)SAAJFactoryLoader.loadFactory(propertyName, defaultImpl);
-
+
+ SAAJMetaFactory factory = null;
+ try
+ {
+ Class loaderClass =
Class.forName("org.jboss.ws.soap.SAAJFactoryLoader");
+ Method m = loaderClass.getMethod("loadFactory", new Class[]
{String.class, String.class});
+ factory = (SAAJMetaFactory)m.invoke(null, new Object[] {propertyName,
defaultImpl});
+ }
+ catch (Exception e)
+ {
+ throw new SOAPException("Failed to load
org.jboss.ws.soap.SAAJFactoryLoader", e);
+ }
+
if (factory == null)
throw new SOAPException("Failed to to determine the implementation class
for: " + propertyName);
Modified: stack/native/trunk/src/main/java/javax/xml/soap/SOAPConnection.java
===================================================================
--- stack/native/trunk/src/main/java/javax/xml/soap/SOAPConnection.java 2007-09-05
14:09:02 UTC (rev 4524)
+++ stack/native/trunk/src/main/java/javax/xml/soap/SOAPConnection.java 2007-09-05
14:15:50 UTC (rev 4525)
@@ -21,8 +21,6 @@
*/
package javax.xml.soap;
-import org.jboss.util.NotImplementedException;
-
/** A point-to-point connection that a client can use for sending messages directly to a
remote
* party (represented by a URL, for instance).
*
@@ -63,7 +61,10 @@
* @throws SOAPException if there is a SOAP error
* @since SAAJ 1.3
*/
- public abstract SOAPMessage get(Object to) throws SOAPException;
+ public SOAPMessage get(Object to) throws SOAPException
+ {
+ throw new IllegalArgumentException("Should be implemented by concrete
implementation of this class");
+ }
/** Closes this SOAPConnection object.
*
Modified: stack/native/trunk/src/main/java/javax/xml/soap/SOAPFactory.java
===================================================================
--- stack/native/trunk/src/main/java/javax/xml/soap/SOAPFactory.java 2007-09-05 14:09:02
UTC (rev 4524)
+++ stack/native/trunk/src/main/java/javax/xml/soap/SOAPFactory.java 2007-09-05 14:15:50
UTC (rev 4525)
@@ -23,10 +23,11 @@
// $Id$
+import org.w3c.dom.Element;
+
import javax.xml.namespace.QName;
+import java.lang.reflect.Method;
-import org.w3c.dom.Element;
-
/** SOAPFactory is a factory for creating various objects that exist in the SOAP XML
tree.
*
* SOAPFactory can be used to create XML fragments that will eventually end up in the
SOAP part.
@@ -61,9 +62,12 @@
try
{
String propertyName = "javax.xml.soap.SOAPFactory";
- soapFactory = (SOAPFactory)SAAJFactoryLoader.loadFactory(propertyName,
null);
+
+ Class loaderClass =
Class.forName("org.jboss.ws.soap.SAAJFactoryLoader");
+ Method m = loaderClass.getMethod("loadFactory", new Class[]
{String.class, String.class});
+ soapFactory = (SOAPFactory)m.invoke(null, new Object[] {propertyName,
null});
}
- catch (RuntimeException rte)
+ catch (Exception rte)
{
throw new SOAPException(rte);
}
@@ -121,7 +125,10 @@
* @throws SOAPException if there is an error in creating the SOAPElement object
* @since SAAJ 1.3
*/
- public abstract SOAPElement createElement(Element domElement) throws SOAPException;
+ public SOAPElement createElement(Element domElement) throws SOAPException
+ {
+ throw new IllegalArgumentException("Should be implemented by concrete
implementation of this class");
+ }
/** Create a SOAPElement object initialized with the given local name.
*
@@ -159,7 +166,10 @@
* @throws SOAPException if there is an error in creating the SOAPElement object
* @since SAAJ 1.3
*/
- public abstract SOAPElement createElement(QName qname) throws SOAPException;
+ public SOAPElement createElement(QName qname) throws SOAPException
+ {
+ throw new IllegalArgumentException("Should be implemented by concrete
implementation of this class");
+ }
/**
* Creates a new SOAPFault object initialized with the given reasonText and
faultCode
Modified: stack/native/trunk/src/main/java/javax/xml/soap/SOAPHeaderElement.java
===================================================================
--- stack/native/trunk/src/main/java/javax/xml/soap/SOAPHeaderElement.java 2007-09-05
14:09:02 UTC (rev 4524)
+++ stack/native/trunk/src/main/java/javax/xml/soap/SOAPHeaderElement.java 2007-09-05
14:15:50 UTC (rev 4525)
@@ -82,7 +82,7 @@
* @throws UnsupportedOperationException if this message does not support the SOAP 1.2
concept of Fault Role
* @since SAAJ 1.3
*/
- public void setRole(String roleURI);
+ public void setRole(String roleURI) throws SOAPException;
/** Sets the actor associated with this SOAPHeaderElement object to the specified
actor.
* The default value of an actor is: SOAPConstants.URI_SOAP_ACTOR_NEXT
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/core/soap/SOAPHeaderElementImpl.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/core/soap/SOAPHeaderElementImpl.java 2007-09-05
14:09:02 UTC (rev 4524)
+++
stack/native/trunk/src/main/java/org/jboss/ws/core/soap/SOAPHeaderElementImpl.java 2007-09-05
14:15:50 UTC (rev 4525)
@@ -77,7 +77,7 @@
return roleAttr != null ? roleAttr.getValue() : null;
}
- public void setRole(String roleURI)
+ public void setRole(String roleURI) throws SOAPException
{
final SOAPElement header = getParentElement();
final String headerURI = header.getNamespaceURI();
@@ -128,7 +128,16 @@
if (Constants.NS_SOAP11_ENV.equals(headerURI))
setAttributeNS(headerURI, header.getPrefix() + ":" +
Constants.SOAP11_ATTR_ACTOR, actorURI);
else
- setRole(actorURI);
+ {
+ try
+ {
+ setRole(actorURI);
+ }
+ catch (SOAPException e)
+ {
+ throw new IllegalArgumentException("Failed to setRole: " +
actorURI, e);
+ }
+ }
}
public boolean getMustUnderstand()
Copied: stack/native/trunk/src/main/java/org/jboss/ws/soap/SAAJFactoryLoader.java (from
rev 4509, stack/native/trunk/src/main/java/javax/xml/soap/SAAJFactoryLoader.java)
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/soap/SAAJFactoryLoader.java
(rev 0)
+++ stack/native/trunk/src/main/java/org/jboss/ws/soap/SAAJFactoryLoader.java 2007-09-05
14:15:50 UTC (rev 4525)
@@ -0,0 +1,194 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.soap;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Properties;
+
+
+// $Id$
+
+/**
+ * Load a factory using this ordered lookup procedure
+ *
+ * <ol>
+ * <li>Use the system property
+ * <li>Use the properties file "lib/jaxm.properties" in the JRE
directory
+ * <li>Use the Services API (as detailed in the JAR specification), if available,
to determine the classname
+ * <li>Use the default factory implementation class
+ * </ol>
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 14-Dec-2006
+ */
+public class SAAJFactoryLoader
+{
+ private SAAJFactoryLoader()
+ {
+ }
+
+ /**
+ *
+ * @return the factory impl, or null
+ */
+ public static Object loadFactory(String propertyName, String defaultFactory)
+ {
+ Object factory = null;
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+
+ // Use the system property
+ PrivilegedAction action = new PropertyAccessAction(propertyName);
+ String factoryName = (String)AccessController.doPrivileged(action);
+ if (factoryName != null)
+ {
+ try
+ {
+ //if(log.isDebugEnabled()) log.debug("Load from system property: "
+ factoryName);
+ Class factoryClass = loader.loadClass(factoryName);
+ factory = factoryClass.newInstance();
+ }
+ catch (Throwable t)
+ {
+ throw new IllegalStateException("Failed to load " + propertyName +
": " + factoryName, t);
+ }
+ }
+
+ // Use the properties file "lib/jaxm.properties" in the JRE directory.
+ // This configuration file is in standard java.util.Properties format and contains
the fully qualified name of the implementation class with the key being the system
property defined above.
+ if (factory == null)
+ {
+ action = new PropertyAccessAction("java.home");
+ String javaHome = (String)AccessController.doPrivileged(action);
+ File jaxmFile = new File(javaHome + "/lib/jaxm.properties");
+ if (jaxmFile.exists())
+ {
+ try
+ {
+ action = new PropertyFileAccessAction(jaxmFile.getCanonicalPath());
+ Properties jaxmProperties =
(Properties)AccessController.doPrivileged(action);
+ factoryName = jaxmProperties.getProperty(propertyName);
+ if (factoryName != null)
+ {
+ //if(log.isDebugEnabled()) log.debug("Load from " + jaxmFile
+ ": " + factoryName);
+ Class factoryClass = loader.loadClass(factoryName);
+ factory = factoryClass.newInstance();
+ }
+ }
+ catch (Throwable t)
+ {
+ throw new IllegalStateException("Failed to load " + propertyName
+ ": " + factoryName, t);
+ }
+ }
+ }
+
+ // Use the Services API (as detailed in the JAR specification), if available, to
determine the classname.
+ if (factory == null)
+ {
+ String filename = "META-INF/services/" + propertyName;
+ InputStream inStream = loader.getResourceAsStream(filename);
+ if (inStream != null)
+ {
+ try
+ {
+ BufferedReader br = new BufferedReader(new InputStreamReader(inStream,
"UTF-8"));
+ factoryName = br.readLine();
+ br.close();
+ if (factoryName != null)
+ {
+ //if(log.isTraceEnabled()) log.trace("Load from Service API "
+ filename + ": " + factoryName);
+ Class factoryClass = loader.loadClass(factoryName);
+ factory = factoryClass.newInstance();
+ }
+ }
+ catch (Throwable t)
+ {
+ throw new IllegalStateException("Failed to load " + propertyName
+ ": " + factoryName, t);
+ }
+ }
+ }
+
+ // Use the default factory implementation class.
+ if (factory == null && defaultFactory != null)
+ {
+ try
+ {
+ factoryName = defaultFactory;
+ //if(log.isDebugEnabled()) log.debug("Load from default: " +
factoryName);
+ Class factoryClass = loader.loadClass(factoryName);
+ factory = factoryClass.newInstance();
+ }
+ catch (Throwable t)
+ {
+ throw new IllegalStateException("Failed to load " + propertyName +
": " + factoryName, t);
+ }
+ }
+
+ return factory;
+ }
+
+ private static class PropertyAccessAction implements PrivilegedAction
+ {
+ private String name;
+
+ PropertyAccessAction(String name)
+ {
+ this.name = name;
+ }
+
+ public Object run()
+ {
+ return System.getProperty(name);
+ }
+ }
+
+ private static class PropertyFileAccessAction implements PrivilegedAction
+ {
+ private String filename;
+
+ PropertyFileAccessAction(String filename)
+ {
+ this.filename = filename;
+ }
+
+ public Object run()
+ {
+ try
+ {
+ InputStream inStream = new FileInputStream(filename);
+ Properties props = new Properties();
+ props.load(inStream);
+ return props;
+ }
+ catch (IOException ex)
+ {
+ throw new SecurityException("Cannot load properties: " + filename,
ex);
+ }
+ }
+ }
+}
Property changes on:
stack/native/trunk/src/main/java/org/jboss/ws/soap/SAAJFactoryLoader.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF