You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsrf-dev@ws.apache.org by ip...@apache.org on 2005/05/25 18:03:10 UTC
svn commit: r178468 - in
/incubator/apollo/trunk/src/java/org/apache/ws/resource: ./ faults/
handler/ handler/axis/ i18n/ impl/ metadataexchange/v2004_09/porttype/impl/
properties/ properties/impl/ properties/query/ properties/query/impl/
properties/query/xpath/impl/ properties/v2004_06/porttype/impl/
properties/v2004_11/porttype/impl/
Author: ips
Date: Wed May 25 09:03:10 2005
New Revision: 178468
URL: http://svn.apache.org/viewcvs?rev=178468&view=rev
Log:
removed usage of JAXRPCExeption where it did not make sense; improved error messages
Modified:
incubator/apollo/trunk/src/java/org/apache/ws/resource/AbstractPortType.java
incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/AbstractBaseFaultException.java
incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/BaseFaultException.java
incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/FaultException.java
incubator/apollo/trunk/src/java/org/apache/ws/resource/handler/ResourceHandler.java
incubator/apollo/trunk/src/java/org/apache/ws/resource/handler/axis/AxisResourceContext.java
incubator/apollo/trunk/src/java/org/apache/ws/resource/i18n/Keys.java
incubator/apollo/trunk/src/java/org/apache/ws/resource/impl/AbstractResourceContext.java
incubator/apollo/trunk/src/java/org/apache/ws/resource/metadataexchange/v2004_09/porttype/impl/MetadataExchangePortTypeImpl.java
incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/XmlBeansResourcePropertyUtils.java
incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/impl/AbstractResourcePropertiesPortType.java
incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/query/QueryConstants.java
incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/query/impl/QueryEngineImpl.java
incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/query/impl/XmlBeansQueryExpression.java
incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/query/xpath/impl/XalanXPathExpressionEvaluator.java
incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v2004_06/porttype/impl/QueryResourcePropertiesPortTypeImpl.java
incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v2004_11/porttype/impl/QueryResourcePropertiesPortTypeImpl.java
Modified: incubator/apollo/trunk/src/java/org/apache/ws/resource/AbstractPortType.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/AbstractPortType.java?rev=178468&r1=178467&r2=178468&view=diff
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/AbstractPortType.java (original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/AbstractPortType.java Wed May 25 09:03:10 2005
@@ -20,112 +20,90 @@
import org.apache.ws.resource.i18n.Keys;
import org.apache.ws.resource.i18n.MessagesImpl;
import org.apache.ws.resource.impl.AbstractResourceHome;
-import org.apache.ws.resource.lifetime.faults.ResourceUnknownFaultException;
import org.apache.ws.resource.properties.NamespaceVersionHolder;
import org.apache.ws.util.i18n.Messages;
-import javax.xml.rpc.JAXRPCException;
-
/**
* LOG-DONE
+ *
* @author Ian P. Springer
*/
public abstract class AbstractPortType
{
- private static final Log LOG = LogFactory.getLog( AbstractPortType.class );
- public static final Messages MSG = MessagesImpl.getInstance();
+ private static final Log LOG = LogFactory.getLog( AbstractPortType.class );
+ public static final Messages MSG = MessagesImpl.getInstance();
- private ResourceContext m_resourceContext;
- private ResourceHome m_resourceHome;
- private ResourceKey m_resourceKey;
- private Resource m_resource;
-
- /**
- * Creates a new {@link AbstractPortType} object.
- *
- * @param resourceContext DOCUMENT_ME
- */
- public AbstractPortType( ResourceContext resourceContext )
- {
- m_resourceContext = resourceContext;
- m_resourceHome = null;
- try
- {
- m_resourceHome = (AbstractResourceHome) getResourceContext( ).getResourceHome( );
- }
- catch ( ResourceContextException rce )
- {
- throw new JAXRPCException( rce );
- }
-
- try
- {
- m_resourceKey = getResourceContext( ).getResourceKey( );
- }
- catch ( ResourceContextException rce )
- {
- throw new JAXRPCException( rce );
- }
-
- LOG.debug( MSG.getMessage(Keys.PORTTYPE_RECIEVED_REQUEST, m_resourceContext.getServiceName(), String.valueOf(m_resourceKey)) );
- try
- {
- m_resource = ( (ResourceHome) m_resourceHome ).getInstance( m_resourceContext );
- }
- catch ( ResourceUnknownException rue )
- {
- throw new org.apache.ws.resource.properties.faults.ResourceUnknownFaultException(getNamespaceSet(),rue);
- }
- catch ( ResourceException re )
- {
- throw new JAXRPCException( re );
- }
- catch ( ResourceContextException rce )
- {
- rce.printStackTrace( );
- }
- }
-
- /**
- * DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- public Resource getResource( )
- {
- return m_resource;
- }
-
- /**
- * DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- public ResourceContext getResourceContext( )
- {
- return m_resourceContext;
- }
-
- /**
- * DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- public ResourceHome getResourceHome( )
- {
- return m_resourceHome;
- }
-
- /**
- * DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- public ResourceKey getResourceKey( )
- {
- return m_resourceKey;
- }
+ private ResourceContext m_resourceContext;
+ private ResourceHome m_resourceHome;
+ private ResourceKey m_resourceKey;
+ private Resource m_resource;
+
+ /**
+ * Creates a new {@link AbstractPortType} object.
+ *
+ * @param resourceContext DOCUMENT_ME
+ */
+ public AbstractPortType( ResourceContext resourceContext )
+ {
+ m_resourceContext = resourceContext;
+ try
+ {
+ m_resourceHome = (AbstractResourceHome) getResourceContext().getResourceHome();
+ m_resourceKey = getResourceContext().getResourceKey();
+ LOG.debug( MSG.getMessage( Keys.PORTTYPE_RECEIVED_REQUEST, m_resourceContext.getServiceName(),
+ String.valueOf( m_resourceKey ) ) );
+ m_resource = ( (ResourceHome) m_resourceHome ).getInstance( m_resourceContext );
+ }
+ catch ( ResourceUnknownException rue )
+ {
+ throw new org.apache.ws.resource.properties.faults.ResourceUnknownFaultException( getNamespaceSet(), rue );
+ }
+ catch ( Exception e )
+ {
+ throw new RuntimeException( "Failed to obtain WS-Resource instance for request.", e );
+ }
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public Resource getResource()
+ {
+ return m_resource;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public ResourceContext getResourceContext()
+ {
+ return m_resourceContext;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public ResourceHome getResourceHome()
+ {
+ return m_resourceHome;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public ResourceKey getResourceKey()
+ {
+ return m_resourceKey;
+ }
protected abstract NamespaceVersionHolder getNamespaceSet();
}
Modified: incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/AbstractBaseFaultException.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/AbstractBaseFaultException.java?rev=178468&r1=178467&r2=178468&view=diff
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/AbstractBaseFaultException.java (original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/AbstractBaseFaultException.java Wed May 25 09:03:10 2005
@@ -20,15 +20,14 @@
import org.apache.ws.Soap1_1Constants;
import org.apache.ws.resource.i18n.Keys;
import org.apache.ws.resource.i18n.MessagesImpl;
-import org.apache.ws.resource.properties.NamespaceVersionHolder;
import org.apache.ws.resource.impl.UnsupportedVersionException;
+import org.apache.ws.resource.properties.NamespaceVersionHolder;
import org.apache.ws.util.XmlBeanNameUtils;
import org.apache.ws.util.XmlBeanUtils;
import org.apache.ws.util.i18n.Messages;
import org.apache.xmlbeans.XmlObject;
import javax.xml.namespace.QName;
-import javax.xml.rpc.JAXRPCException;
import javax.xml.soap.Detail;
import javax.xml.soap.DetailEntry;
import java.lang.reflect.Method;
@@ -221,7 +220,7 @@
}
catch ( Exception e )
{
- throw new JAXRPCException( "Failed to create strongly-typed XmlBean for global element with name " + getBaseFaultName() );
+ throw new RuntimeException( "Failed to create strongly-typed XmlBean for global element with name " + getBaseFaultName(), e );
}
}
Modified: incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/BaseFaultException.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/BaseFaultException.java?rev=178468&r1=178467&r2=178468&view=diff
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/BaseFaultException.java (original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/BaseFaultException.java Wed May 25 09:03:10 2005
@@ -15,9 +15,7 @@
*=============================================================================*/
package org.apache.ws.resource.faults;
-import org.apache.ws.resource.i18n.MessagesImpl;
import org.apache.ws.resource.properties.NamespaceVersionHolder;
-import org.apache.ws.util.i18n.Messages;
import javax.xml.namespace.QName;
@@ -30,7 +28,10 @@
extends AbstractBaseFaultException
{
- public static final Messages MSG = MessagesImpl.getInstance();
+ public BaseFaultException( NamespaceVersionHolder namespaceSet, String faultString, QName faultCode )
+ {
+ super( namespaceSet, faultString, faultCode );
+ }
/**
* Constructs a new NewBaseFaultException.
Modified: incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/FaultException.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/FaultException.java?rev=178468&r1=178467&r2=178468&view=diff
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/FaultException.java (original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/FaultException.java Wed May 25 09:03:10 2005
@@ -64,7 +64,7 @@
}
catch ( SOAPException soape )
{
- throw new JAXRPCException( soape );
+ throw new JAXRPCException( "Failed to create SAAJ Detail object via SOAPFactory.", soape );
}
}
@@ -78,7 +78,7 @@
{
if ( m_detail == null )
{
- throw new IllegalStateException( "Detail entry cannot be added because detail is null." );
+ throw new IllegalStateException( "Detail entry cannot be added because Detail is null." );
}
try
{
@@ -86,7 +86,7 @@
}
catch ( SOAPException soape )
{
- throw new JAXRPCException( soape );
+ throw new JAXRPCException( "Failed to add detail entry to SAAJ Detail object.", soape );
}
}
Modified: incubator/apollo/trunk/src/java/org/apache/ws/resource/handler/ResourceHandler.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/handler/ResourceHandler.java?rev=178468&r1=178467&r2=178468&view=diff
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/handler/ResourceHandler.java (original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/handler/ResourceHandler.java Wed May 25 09:03:10 2005
@@ -44,7 +44,6 @@
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
-import javax.xml.soap.SOAPPart;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -446,13 +445,12 @@
if ( serviceMethod == null )
{
- throw new JAXRPCException( MSG.getMessage( Keys.BAD_REQUEST_BODY_ELEMENT,
+ throw new RuntimeException( MSG.getMessage( Keys.BAD_REQUEST_BODY_ELEMENT,
methodNameFromAction,
service.getClass().getName() ) );
}
- LOG.debug( MSG.getMessage( Keys.FOUND_SERVICE_METHOD,
- serviceMethod.getName() ) );
+ LOG.debug( MSG.getMessage( Keys.FOUND_SERVICE_METHOD, serviceMethod.getName() ) );
return serviceMethod;
}
@@ -506,17 +504,14 @@
*/
private SOAPEnvelope getEnvelope( SOAPMessage soapMsg )
{
- SOAPEnvelope soapEnvelope;
try
{
- SOAPPart soap_part = soapMsg.getSOAPPart();
- soapEnvelope = soap_part.getEnvelope();
+ return soapMsg.getSOAPPart().getEnvelope();
}
catch ( SOAPException soape )
{
- throw new JAXRPCException( soape );
+ throw new JAXRPCException( "Failed to get SOAPEnvelope from request SOAPMessage.", soape );
}
- return ( soapEnvelope );
}
/**
@@ -624,7 +619,7 @@
}
catch ( SOAPException soape )
{
- throw new JAXRPCException( MSG.getMessage( Keys.FAILED_TO_CREATE_SOAP_MSG ) );
+ throw new JAXRPCException( MSG.getMessage( Keys.FAILED_TO_CREATE_SOAPMESSAGE ), soape );
}
}
Modified: incubator/apollo/trunk/src/java/org/apache/ws/resource/handler/axis/AxisResourceContext.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/handler/axis/AxisResourceContext.java?rev=178468&r1=178467&r2=178468&view=diff
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/handler/axis/AxisResourceContext.java (original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/handler/axis/AxisResourceContext.java Wed May 25 09:03:10 2005
@@ -25,7 +25,6 @@
import org.apache.ws.resource.impl.AbstractResourceContext;
import org.apache.ws.util.i18n.Messages;
-import javax.xml.rpc.JAXRPCException;
import javax.xml.rpc.handler.MessageContext;
import javax.xml.rpc.handler.soap.SOAPMessageContext;
import java.net.MalformedURLException;
@@ -102,7 +101,7 @@
}
catch ( MalformedURLException murle )
{
- throw new JAXRPCException( murle );
+ throw new RuntimeException( "Value of Axis " + org.apache.axis.MessageContext.TRANS_URL + " MessageContext property is not a valid URL.", murle );
}
}
Modified: incubator/apollo/trunk/src/java/org/apache/ws/resource/i18n/Keys.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/i18n/Keys.java?rev=178468&r1=178467&r2=178468&view=diff
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/i18n/Keys.java (original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/i18n/Keys.java Wed May 25 09:03:10 2005
@@ -30,7 +30,7 @@
/**
* @msg Received request to {0} resource with Id {1}
*/
- String PORTTYPE_RECIEVED_REQUEST = "PORTTYPE_RECIEVED_REQUEST";
+ String PORTTYPE_RECEIVED_REQUEST = "PORTTYPE_RECEIVED_REQUEST";
/**
* @msg Resource Id {0} not found for service {1}
@@ -205,9 +205,9 @@
String FOUND_SERVICE_METHOD = "FOUND_SERVICE_METHOD";
/**
- * @msg Failed to create SOAP message.
+ * @msg Failed to create SOAPMessage via MessageFactory.
*/
- String FAILED_TO_CREATE_SOAP_MSG = "FAILED_TO_CREATE_SOAP_MSG";
+ String FAILED_TO_CREATE_SOAPMESSAGE = "FAILED_TO_CREATE_SOAPMESSAGE";
/**
* @msg Creating an instance of service class: {0}
@@ -329,10 +329,6 @@
*/
String NULL_RESOURCEKEY_QNAME = "NULL_RESOURCEKEY_QNAME";
/**
- * @msg The MessageContext is null.
- */
- String NULL_MSGCTX = "NULL_MSGCTX";
- /**
* @msg Retrieving the ServiceURL from the Addressing Headers. Service URL is: {0}
*/
String GET_SERVICE_URL_FROM_ADDR_HDR = "GET_SERVICE_URL_FROM_ADDR_HDR";
@@ -357,10 +353,6 @@
*/
String SET_PROP_TIME = "SET_PROP_TIME";
/**
- * @msg {0} property is not defined!
- */
- String PROP_NOT_DEFINED = "PROP_NOT_DEFINED";
- /**
* @msg Read-only property: {0}
*/
String READ_ONLY_PROP = "READ_ONLY_PROP";
@@ -481,7 +473,7 @@
*/
String GET_MULTI_RP_REQ = "GET_MULTI_RP_REQ";
/**
- * @msg Attempt to call a WS-RP operation on a WS-Resource that has no properties.
+ * @msg Attempt to call a WSRP operation on a WS-Resource that has no properties.
*/
String CALL_WSRP_OP_ON_NOPROP = "CALL_WSRP_OP_ON_NOPROP";
/**
Modified: incubator/apollo/trunk/src/java/org/apache/ws/resource/impl/AbstractResourceContext.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/impl/AbstractResourceContext.java?rev=178468&r1=178467&r2=178468&view=diff
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/impl/AbstractResourceContext.java (original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/impl/AbstractResourceContext.java Wed May 25 09:03:10 2005
@@ -35,7 +35,6 @@
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.xml.namespace.QName;
-import javax.xml.rpc.JAXRPCException;
import javax.xml.rpc.handler.MessageContext;
import javax.xml.rpc.handler.soap.SOAPMessageContext;
import javax.xml.soap.Name;
@@ -476,47 +475,36 @@
/**
* DOCUMENT_ME
*
- * @param msgContext DOCUMENT_ME
+ * @param msgContext SAAJ message context; may not be null
*
* @return DOCUMENT_ME
*/
protected URL getServiceURL( MessageContext msgContext )
{
- if ( msgContext == null )
- {
- throw new IllegalArgumentException( MSG.getMessage( Keys.NULL_MSGCTX ) );
- }
-
- AddressingHeaders addrHeaders =
+ AddressingHeaders wsaHeaders =
(AddressingHeaders) msgContext.getProperty(
org.apache.axis.message.addressing.Constants.ENV_ADDRESSING_REQUEST_HEADERS );
-
try
{
- String serviceUrl = addrHeaders.getTo().toString();
+ String serviceUrl = wsaHeaders.getTo().toString();
LOG.debug( MSG.getMessage( Keys.GET_SERVICE_URL_FROM_ADDR_HDR, serviceUrl ) );
return new URL( serviceUrl );
}
catch ( MalformedURLException murle )
{
- throw new JAXRPCException( murle );
+ throw new RuntimeException( "Value of wsa:To SOAP header element is not a valid URL.", murle );
}
}
/**
* Returns the WS-Addressing Action Header
*
- * @param msgContext
+ * @param msgContext SAAJ message context; may not be null
*
* @return
*/
protected String getAddressingAction( MessageContext msgContext )
{
- if ( msgContext == null )
- {
- throw new IllegalArgumentException( MSG.getMessage( Keys.NULL_MSGCTX ) );
- }
-
AddressingHeaders addrHeaders =
(AddressingHeaders) msgContext.getProperty(
org.apache.axis.message.addressing.Constants.ENV_ADDRESSING_REQUEST_HEADERS );
@@ -525,7 +513,7 @@
LOG.debug( MSG.getMessage( Keys.NO_ADDR_HDR ) );
return null;
}
-
+ // TODO: we should probably be throwing a fault if there's no wsa:Action header
Action headerAction = addrHeaders.getAction();
if ( headerAction == null )
{
Modified: incubator/apollo/trunk/src/java/org/apache/ws/resource/metadataexchange/v2004_09/porttype/impl/MetadataExchangePortTypeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/metadataexchange/v2004_09/porttype/impl/MetadataExchangePortTypeImpl.java?rev=178468&r1=178467&r2=178468&view=diff
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/metadataexchange/v2004_09/porttype/impl/MetadataExchangePortTypeImpl.java (original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/metadataexchange/v2004_09/porttype/impl/MetadataExchangePortTypeImpl.java Wed May 25 09:03:10 2005
@@ -27,8 +27,8 @@
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlObject;
import org.xmlsoap.schemas.soap.envelope.Envelope;
-import org.xmlsoap.schemas.soap.envelope.Header;
import org.xmlsoap.schemas.soap.envelope.EnvelopeDocument;
+import org.xmlsoap.schemas.soap.envelope.Header;
import org.xmlsoap.schemas.ws.x2004.x08.addressing.AttributedURI;
import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;
import org.xmlsoap.schemas.ws.x2004.x09.mex.AnyXmlType;
@@ -40,7 +40,6 @@
import javax.naming.InitialContext;
import javax.naming.NamingException;
-import javax.xml.rpc.JAXRPCException;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
@@ -76,16 +75,8 @@
* @return MetadataDocument response document
*/
public MetadataDocument getMetadata(GetMetadataDocument request)
- { //todo deal with setting Action for responses...
- MetadataConfig metadataConfig = null;
- try
- {
- metadataConfig = getMetadataConfig();
- }
- catch (NamingException e)
- {
- throw new JAXRPCException( "Unable to retrieve Metadata Config.",e);
- }
+ { //todo deal with setting Action for responses...
+ MetadataConfig metadataConfig = getMetadataConfigFromJNDI();
//prep the response
MetadataDocument responseDoc = createMetadataResponseDoc();
@@ -140,18 +131,17 @@
return responseDoc;
}
- /**
- * Attempts to lookup the MetadataConfigImpl from JNDI
- *
- * @return MetadataConfigImpl
- * @throws NamingException
- */
- private MetadataConfig getMetadataConfig()
- throws NamingException
+ private MetadataConfig getMetadataConfigFromJNDI()
{
String metadataJndiContextName = getMetadataJndiContextName();
- InitialContext ctx = new InitialContext();
- return (MetadataConfig) ctx.lookup(metadataJndiContextName);
+ try
+ {
+ return (MetadataConfig) new InitialContext().lookup(metadataJndiContextName);
+ }
+ catch ( NamingException ne )
+ {
+ throw new RuntimeException( "Unable to retrieve WS-MetadataExchange configuration.", ne);
+ }
}
/**
@@ -182,17 +172,8 @@
*/
public AnyXmlType get()
{
- MetadataConfig metadataConfig = null;
AnyXmlType anyXmlType = AnyXmlType.Factory.newInstance();
- try
- {
- metadataConfig = getMetadataConfig();
- }
- catch (NamingException e)
- {
- throw new JAXRPCException( "Unable to retrieve Metadata Config.",e);
- }
-
+ MetadataConfig metadataConfig = getMetadataConfigFromJNDI();
//get all the registered metadata
Map allMetadata = metadataConfig.getAllMetadata();
@@ -202,37 +183,35 @@
List metadataList = (List) iterator.next();
for (int i = 0; i < metadataList.size(); i++)
{
- Object data = metadataList.get(i);
+ Object metadata = metadataList.get(i);
/** Determine type of metadata to add **/
- if(data instanceof MetadataReferenceDocument)
+ if(metadata instanceof MetadataReferenceDocument)
{
//must load actual metadata using MetadataReference
try
{
- data = loadFromMetadataReference((MetadataReferenceDocument) data);
+ metadata = loadMetadataFromEPR(((MetadataReferenceDocument) metadata).getMetadataReference());
}
catch (Exception e)
{
- throw new JAXRPCException( "Unable to retrieve metadata from the EndpointReference: " + data + ".",e);
+ throw new RuntimeException( "Unable to retrieve metadata from the configured EPR: " + metadata, e);
}
}
- else if (data instanceof LocationDocument)
+ else if (metadata instanceof LocationDocument)
{
- //must load actual metadata using URL
try
{
- data = loadFromURL(((LocationDocument) data).getLocation());
+ metadata = loadMetadataFromURL(((LocationDocument) metadata).getLocation());
}
catch (Exception e)
{
//not sure if we should ignore a problem and send the rest...
- throw new JAXRPCException( "Unable to retrieve metadata from the URL: " + ((LocationDocument) data).getLocation() + ".",e);
+ throw new RuntimeException( "Unable to retrieve metadata from the configured URL: " + ((LocationDocument) metadata).getLocation(), e);
}
}
- XmlBeanUtils.addChildElement(anyXmlType, (XmlObject) data);
+ XmlBeanUtils.addChildElement(anyXmlType, (XmlObject) metadata);
}
-
}
return anyXmlType;
}
@@ -245,7 +224,7 @@
* @throws IOException
* @throws XmlException
*/
- private Object loadFromURL(String s) throws IOException, XmlException
+ private Object loadMetadataFromURL(String s) throws IOException, XmlException
{
return XmlObject.Factory.parse(new URL(s));
}
@@ -253,18 +232,17 @@
/**
* Loads metadata off of an EPR.
*
- * @param endpointReferenceType
+ * @param epr
* @return
* @throws IOException
* @throws URISyntaxException
* @throws XmlException
*/
- private Object loadFromMetadataReference(MetadataReferenceDocument endpointReferenceType) throws IOException, URISyntaxException, XmlException
+ private Object loadMetadataFromEPR(EndpointReferenceType epr) throws IOException, URISyntaxException, XmlException
{
- EndpointReferenceType metadataReference = endpointReferenceType.getMetadataReference();
- String address = metadataReference.getAddress().getStringValue();
- //perform get request
- EnvelopeDocument envelope = buildSoapEnvelopeForGet(address, metadataReference);
+ String address = epr.getAddress().getStringValue();
+ //send WS-MEX Get request
+ EnvelopeDocument envelope = buildSoapEnvelopeForGet(address, epr);
String response = SoapClient.sendRequest(new URL(address),envelope.newInputStream(),new URI(MetadataExchangeConstants.ACTION_GET));
return XmlObject.Factory.parse(response);
}
Modified: incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/XmlBeansResourcePropertyUtils.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/XmlBeansResourcePropertyUtils.java?rev=178468&r1=178467&r2=178468&view=diff
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/XmlBeansResourcePropertyUtils.java (original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/XmlBeansResourcePropertyUtils.java Wed May 25 09:03:10 2005
@@ -24,7 +24,6 @@
import org.apache.xmlbeans.XmlDateTime;
import org.apache.xmlbeans.impl.values.XmlDateTimeImpl;
-import javax.xml.rpc.JAXRPCException;
import java.util.Calendar;
/**
@@ -53,6 +52,11 @@
}
+ /**
+ *
+ * @param prop an XMLBeans-based resource property; must not be null
+ * @return
+ */
public static Calendar getDateTimePropertyValue( XmlBeansResourceProperty prop )
{
XmlDateTime propElem = getDateTimePropertyElement( prop );
@@ -61,10 +65,6 @@
private static XmlDateTime getDateTimePropertyElement( XmlBeansResourceProperty prop )
{
- if ( prop == null )
- {
- throw new JAXRPCException( MSG.getMessage( Keys.PROP_NOT_DEFINED, prop.getMetaData().getName() ) );
- }
XmlDateTime propElem;
if ( ! prop.isEmpty() )
{
Modified: incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/impl/AbstractResourcePropertiesPortType.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/impl/AbstractResourcePropertiesPortType.java?rev=178468&r1=178467&r2=178468&view=diff
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/impl/AbstractResourcePropertiesPortType.java (original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/impl/AbstractResourcePropertiesPortType.java Wed May 25 09:03:10 2005
@@ -15,6 +15,9 @@
*=============================================================================*/
package org.apache.ws.resource.properties.impl;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.Soap1_1Constants;
import org.apache.ws.resource.AbstractPortType;
import org.apache.ws.resource.PropertiesResource;
import org.apache.ws.resource.ResourceContext;
@@ -25,11 +28,7 @@
import org.apache.ws.resource.properties.ResourcePropertySet;
import org.apache.ws.resource.properties.faults.ResourcePropertyRetrievalFailedFaultException;
import org.apache.ws.util.i18n.Messages;
-import org.apache.ws.Soap1_1Constants;
-import org.apache.commons.logging.LogFactory;
-import org.apache.commons.logging.Log;
-import javax.xml.rpc.JAXRPCException;
import java.util.Iterator;
/**
@@ -62,7 +61,7 @@
{
if ( !( getResource( ) instanceof PropertiesResource ) )
{
- throw new JAXRPCException( MSG.getMessage( Keys.CALL_WSRP_OP_ON_NOPROP) );
+ throw new IllegalStateException( MSG.getMessage( Keys.CALL_WSRP_OP_ON_NOPROP) );
}
return ( (PropertiesResource) getResource( ) ).getResourcePropertySet( );
}
Modified: incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/query/QueryConstants.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/query/QueryConstants.java?rev=178468&r1=178467&r2=178468&view=diff
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/query/QueryConstants.java (original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/query/QueryConstants.java Wed May 25 09:03:10 2005
@@ -15,7 +15,6 @@
*=============================================================================*/
package org.apache.ws.resource.properties.query;
-import javax.xml.rpc.JAXRPCException;
import java.net.URI;
import java.net.URISyntaxException;
@@ -42,35 +41,20 @@
*/
static class Initializer
{
- /**
- * DOCUMENT_ME
- */
- public static URI XPATH1_0;
-
- /**
- * DOCUMENT_ME
- */
- public static URI XPATH2_0;
+ static URI XPATH1_0;
+ static URI XPATH2_0;
static
{
- try
- {
- XPATH1_0 = new URI( "http://www.w3.org/TR/1999/REC-xpath-19991116" );
- }
- catch ( URISyntaxException urise )
- {
- throw new JAXRPCException( urise );
- }
-
- try
- {
- XPATH2_0 = new URI( "http://www.w3.org/TR/2003/WD-xpath20-20031112" );
- }
- catch ( URISyntaxException urise )
- {
- throw new JAXRPCException( urise );
- }
+ try
+ {
+ XPATH1_0 = new URI( "http://www.w3.org/TR/1999/REC-xpath-19991116" );
+ XPATH2_0 = new URI( "http://www.w3.org/TR/2003/WD-xpath20-20031112" );
+ }
+ catch ( URISyntaxException urise ) // this will never happen
+ {
+ throw new RuntimeException( urise );
+ }
}
}
}
Modified: incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/query/impl/QueryEngineImpl.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/query/impl/QueryEngineImpl.java?rev=178468&r1=178467&r2=178468&view=diff
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/query/impl/QueryEngineImpl.java (original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/query/impl/QueryEngineImpl.java Wed May 25 09:03:10 2005
@@ -38,7 +38,6 @@
import javax.naming.NameClassPair;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
-import javax.xml.rpc.JAXRPCException;
import java.net.URI;
import java.util.Collections;
import java.util.HashMap;
@@ -78,7 +77,7 @@
}
catch ( UnknownQueryExpressionDialectException uqede )
{
- throw new JAXRPCException( uqede );
+ throw new RuntimeException( "Error while registering expression evaluators with query engine.", uqede );
}
}
Modified: incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/query/impl/XmlBeansQueryExpression.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/query/impl/XmlBeansQueryExpression.java?rev=178468&r1=178467&r2=178468&view=diff
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/query/impl/XmlBeansQueryExpression.java (original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/query/impl/XmlBeansQueryExpression.java Wed May 25 09:03:10 2005
@@ -24,13 +24,13 @@
import org.apache.ws.resource.properties.query.QueryExpression;
import org.apache.ws.util.XmlBeanUtils;
import org.apache.ws.util.i18n.Messages;
-import org.apache.ws.util.xml.impl.DomNamespaceContext;
import org.apache.ws.util.xml.NamespaceContext;
+import org.apache.ws.util.xml.impl.DomNamespaceContext;
import org.apache.xmlbeans.XmlObject;
import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.QueryExpressionType;
-import javax.xml.rpc.JAXRPCException;
import java.net.URI;
+import java.net.URISyntaxException;
/**
* LOG-DONE
@@ -53,8 +53,6 @@
* Creates a new {@link XmlBeansQueryExpression} object.
*
* @param queryExprXBean DOCUMENT_ME
- *
- * @throws JAXRPCException DOCUMENT_ME
*/
public XmlBeansQueryExpression( QueryExpressionType queryExprXBean )
{
@@ -65,8 +63,6 @@
* Creates a new {@link XmlBeansQueryExpression} object.
*
* @param queryExprXBean DOCUMENT_ME
- *
- * @throws JAXRPCException DOCUMENT_ME
*/
public XmlBeansQueryExpression(org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceProperties12Draft05.QueryExpressionType queryExprXBean)
{
@@ -80,7 +76,7 @@
XmlObject[] childElems = XmlBeanUtils.getChildElements( m_queryExprXBean );
if ( childElems.length > 1 )
{
- throw new JAXRPCException( MSG.getMessage( Keys.QUERY_ONLY_ONE_NODE ) );
+ throw new IllegalArgumentException( MSG.getMessage( Keys.QUERY_ONLY_ONE_NODE ) );
}
if ( childElems.length == 1 )
{
@@ -104,9 +100,9 @@
{
return new URI( queryExprElem.getDialect() );
}
- catch ( Exception e )
+ catch ( URISyntaxException urise )
{
- throw new JAXRPCException( MSG.getMessage( Keys.FAILED_INIT_DIALECT, e ) );
+ throw new RuntimeException( MSG.getMessage( Keys.FAILED_INIT_DIALECT, urise ) );
}
}
@@ -117,9 +113,9 @@
{
return new URI( queryExprElem.getDialect() );
}
- catch ( Exception e )
+ catch ( URISyntaxException urise )
{
- throw new JAXRPCException( MSG.getMessage( Keys.FAILED_INIT_DIALECT, e ) );
+ throw new RuntimeException( MSG.getMessage( Keys.FAILED_INIT_DIALECT, urise ) );
}
}
Modified: incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/query/xpath/impl/XalanXPathExpressionEvaluator.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/query/xpath/impl/XalanXPathExpressionEvaluator.java?rev=178468&r1=178467&r2=178468&view=diff
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/query/xpath/impl/XalanXPathExpressionEvaluator.java (original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/query/xpath/impl/XalanXPathExpressionEvaluator.java Wed May 25 09:03:10 2005
@@ -38,7 +38,6 @@
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import javax.xml.rpc.JAXRPCException;
import javax.xml.transform.TransformerException;
import java.net.URI;
@@ -174,7 +173,7 @@
}
catch ( TransformerException te )
{
- throw new JAXRPCException( te );
+ throw new RuntimeException( te );
}
Node[] nodes = new Node[nodeList.getLength()];
Modified: incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v2004_06/porttype/impl/QueryResourcePropertiesPortTypeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v2004_06/porttype/impl/QueryResourcePropertiesPortTypeImpl.java?rev=178468&r1=178467&r2=178468&view=diff
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v2004_06/porttype/impl/QueryResourcePropertiesPortTypeImpl.java (original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v2004_06/porttype/impl/QueryResourcePropertiesPortTypeImpl.java Wed May 25 09:03:10 2005
@@ -40,7 +40,6 @@
import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.QueryResourcePropertiesDocument;
import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.QueryResourcePropertiesResponseDocument;
-import javax.xml.rpc.JAXRPCException;
import java.lang.reflect.Array;
/**
@@ -136,9 +135,8 @@
}
catch ( Exception e )
{
- throw new JAXRPCException( e );
+ throw new RuntimeException( "Unable to convert query result object to XmlObject.", e );
}
-
XmlBeanUtils.addChildElement( responseElem, resultXBean );
}
}
@@ -147,7 +145,6 @@
XmlBeanUtils.setValue( responseElem,
result.toString() );
}
-
return responseDoc;
}
Modified: incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v2004_11/porttype/impl/QueryResourcePropertiesPortTypeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v2004_11/porttype/impl/QueryResourcePropertiesPortTypeImpl.java?rev=178468&r1=178467&r2=178468&view=diff
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v2004_11/porttype/impl/QueryResourcePropertiesPortTypeImpl.java (original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v2004_11/porttype/impl/QueryResourcePropertiesPortTypeImpl.java Wed May 25 09:03:10 2005
@@ -40,7 +40,6 @@
import org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceProperties12Draft05.QueryResourcePropertiesDocument;
import org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceProperties12Draft05.QueryResourcePropertiesResponseDocument;
-import javax.xml.rpc.JAXRPCException;
import java.lang.reflect.Array;
/**
@@ -136,18 +135,15 @@
}
catch ( Exception e )
{
- throw new JAXRPCException( e );
+ throw new RuntimeException( "Unable to convert query result object to XmlObject.", e );
}
-
XmlBeanUtils.addChildElement( responseElem, resultXBean );
}
}
else
{
- XmlBeanUtils.setValue( responseElem,
- result.toString() );
+ XmlBeanUtils.setValue( responseElem, result.toString() );
}
-
return responseDoc;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: apollo-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: apollo-dev-help@ws.apache.org