You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-commits@ws.apache.org by da...@apache.org on 2006/08/23 21:54:58 UTC
svn commit: r434142 - in /webservices/muse/trunk/modules:
muse-platform-axis2/src/org/apache/muse/core/platform/axis2/
muse-platform-jaxws/src/org/apache/muse/core/platform/jaxws/
muse-tools/src/org/apache/muse/tools/inspector/ muse-util-qname/src/java...
Author: danj
Date: Wed Aug 23 12:54:57 2006
New Revision: 434142
URL: http://svn.apache.org/viewvc?rev=434142&view=rev
Log:
More JavaDoc completion and cleanup - for utils, WS-A, Axis2, and JAX-WS.
Modified:
webservices/muse/trunk/modules/muse-platform-axis2/src/org/apache/muse/core/platform/axis2/AxisEnvironment.java
webservices/muse/trunk/modules/muse-platform-axis2/src/org/apache/muse/core/platform/axis2/AxisIsolationLayer.java
webservices/muse/trunk/modules/muse-platform-jaxws/src/org/apache/muse/core/platform/jaxws/JaxWsEnvironment.java
webservices/muse/trunk/modules/muse-platform-jaxws/src/org/apache/muse/core/platform/jaxws/JaxWsIsolationLayer.java
webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/JavaMethod.java
webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/JavaProperty.java
webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/ResourceInspector.java
webservices/muse/trunk/modules/muse-util-qname/src/javax/xml/namespace/QName.java
webservices/muse/trunk/modules/muse-util-xml/src/org/apache/muse/util/xml/XPathUtils.java
webservices/muse/trunk/modules/muse-util-xml/src/org/apache/muse/util/xml/XmlUtils.java
webservices/muse/trunk/modules/muse-util-xml/src/org/apache/muse/util/xml/XsdUtils.java
webservices/muse/trunk/modules/muse-util-xstream/src/org/apache/muse/core/serializer/xstream/XStreamSerializer.java
webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/CommandLine.java
webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/FileUtils.java
webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/ReflectUtilHelper.java
webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/ReflectUtils.java
webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/messages/MessagesFactory.java
webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/EndpointReference.java
webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/MessageHeaders.java
webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/WsaConstants.java
Modified: webservices/muse/trunk/modules/muse-platform-axis2/src/org/apache/muse/core/platform/axis2/AxisEnvironment.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-platform-axis2/src/org/apache/muse/core/platform/axis2/AxisEnvironment.java?rev=434142&r1=434141&r2=434142&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-platform-axis2/src/org/apache/muse/core/platform/axis2/AxisEnvironment.java (original)
+++ webservices/muse/trunk/modules/muse-platform-axis2/src/org/apache/muse/core/platform/axis2/AxisEnvironment.java Wed Aug 23 12:54:57 2006
@@ -50,8 +50,8 @@
/**
*
- * AxisEnvironment is an extension of {@linkplain AbstractEnvironment AbstractEnvironment}
- * for the Apache Axis 1.x SOAP engine. It provides all of the lower-level
+ * AxisEnvironment is a concrete{@linkplain org.apache.muse.core.Environment Environment}
+ * for the Apache Axis2 SOAP engine. It provides all of the lower-level
* functionality that is abstracted through the Environment interface using
* the local file system and Axis2 context APIs.
*
@@ -61,38 +61,20 @@
public class AxisEnvironment extends AbstractEnvironment
{
+
//
- // The service installation directory (NOT the WAR file directory)
+ // The service installation directory (NOT the WAR file directory). This
+ // is found at $WAR_INSTALL_DIR/WEB-INF/services/muse
//
private File _realDirectory = null;
-
+
/**
*
- * This constructor determines the value of the "real directory" - where
- * the application is installed on the file system so that it can read
- * local files when it needs to.
- *
- * @param opContext
+ * Converts Axis2's OperationContext into the Muse addressing context,
+ * MessageHeaders. Hopefully this becomes irrelevant through the
+ * adoption of something like JSR-261 or some WS-A project in Apache Commons.
*
*/
- public AxisEnvironment(OperationContext opContext)
- {
- MessageHeaders wsa = convertContext(opContext);
- addAddressingContext(wsa);
-
- MessageContext message = getInputMessageContext(opContext);
-
- //
- // where are we? this is the path of the service installation,
- // not of the Axis2 WAR
- //
- String realDirPath = message.getAxisService().getFileName().getFile();
- _realDirectory = new File(realDirPath);
-
- String address = message.getTo().getAddress();
- setDefaultURI(getDeploymentURI(address));
- }
-
public static MessageHeaders convertContext(OperationContext opContext)
{
SOAPHeader axiom = getInputMessageContext(opContext).getEnvelope().getHeader();
@@ -108,7 +90,7 @@
throw new RuntimeException(error.getMessage(), error);
}
}
-
+
/**
*
* Converts Axis2's EPR type into our general one so that code isn't specific
@@ -137,6 +119,12 @@
return epr;
}
+ /**
+ *
+ * Convert DOM to Axiom. Muse uses the DOM API in the JDK, Axis2 uses
+ * the Axiom API, which is similar but... different.
+ *
+ */
public static OMElement convertToAxiom(Element xml)
{
String xmlString = XmlUtils.toString(xml, false);
@@ -156,6 +144,12 @@
return builder.getDocumentElement();
}
+ /**
+ *
+ * Convert Axiom to DOM. Muse uses the DOM API in the JDK, Axis2 uses
+ * the Axiom API, which is similar but... different.
+ *
+ */
public static Element convertToDOM(OMElement axiom)
{
try
@@ -176,6 +170,73 @@
}
}
+ /**
+ *
+ * @param opContext
+ *
+ * @return The Axis2 MessageContext for the request.
+ *
+ */
+ public static MessageContext getInputMessageContext(OperationContext opContext)
+ {
+ try
+ {
+ return opContext.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+ }
+
+ catch (AxisFault error)
+ {
+ throw new RuntimeException(error.getMessage(), error);
+ }
+ }
+
+ /**
+ *
+ * @param opContext
+ *
+ * @return The Axis2 MessageContext for the response.
+ *
+ */
+ public static MessageContext getOutputMessageContext(OperationContext opContext)
+ {
+ try
+ {
+ return opContext.getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
+ }
+
+ catch (AxisFault error)
+ {
+ throw new RuntimeException(error.getMessage(), error);
+ }
+ }
+
+ /**
+ *
+ * This constructor determines the value of the "real directory" - where
+ * the application is installed on the file system so that it can read
+ * local files when it needs to.
+ *
+ * @param opContext
+ *
+ */
+ public AxisEnvironment(OperationContext opContext)
+ {
+ MessageHeaders wsa = convertContext(opContext);
+ addAddressingContext(wsa);
+
+ MessageContext message = getInputMessageContext(opContext);
+
+ //
+ // where are we? this is the path of the service installation,
+ // not of the Axis2 WAR
+ //
+ String realDirPath = message.getAxisService().getFileName().getFile();
+ _realDirectory = new File(realDirPath);
+
+ String address = message.getTo().getAddress();
+ setDefaultURI(getDeploymentURI(address));
+ }
+
public URL getDataResource(String path)
{
File file = new File(_realDirectory, path);
@@ -209,32 +270,6 @@
public EndpointReference getDeploymentEPR()
{
return getDefaultEPR();
- }
-
- public static MessageContext getInputMessageContext(OperationContext opContext)
- {
- try
- {
- return opContext.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
- }
-
- catch (AxisFault error)
- {
- throw new RuntimeException(error.getMessage(), error);
- }
- }
-
- public static MessageContext getOutputMessageContext(OperationContext opContext)
- {
- try
- {
- return opContext.getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
- }
-
- catch (AxisFault error)
- {
- throw new RuntimeException(error.getMessage(), error);
- }
}
public File getRealDirectory()
Modified: webservices/muse/trunk/modules/muse-platform-axis2/src/org/apache/muse/core/platform/axis2/AxisIsolationLayer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-platform-axis2/src/org/apache/muse/core/platform/axis2/AxisIsolationLayer.java?rev=434142&r1=434141&r2=434142&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-platform-axis2/src/org/apache/muse/core/platform/axis2/AxisIsolationLayer.java (original)
+++ webservices/muse/trunk/modules/muse-platform-axis2/src/org/apache/muse/core/platform/axis2/AxisIsolationLayer.java Wed Aug 23 12:54:57 2006
@@ -26,7 +26,13 @@
import org.apache.muse.ws.addressing.MessageHeaders;
/**
- *
+ *
+ * AxisIsolationLayer is an Axis2 web service class; that is, it can be
+ * deployed as an Axis2 service using the services.xml file. This class will
+ * be the web service for <b>all</b> Muse applications that run on Axis2.
+ * The deployment descriptor, muse.xml, is used to configure the resource
+ * types that are created and managed by this service.
+ *
* @author Dan Jemiolo (danj)
*
*/
@@ -43,57 +49,14 @@
//
private static OperationContext _initialOpContext = null;
- protected OperationContext getInitialContext()
- {
- return _initialOpContext;
- }
-
- protected void setInitialContext(OperationContext opContext)
+ protected Environment createEnvironment()
{
- _initialOpContext = opContext;
+ return new AxisEnvironment(getInitialContext());
}
- /**
- *
- * Because Axis2 doesn't use JAX-RPC ServiceLifecycle methods (or
- * something similar), we use this as our initialization routine.
- * This method is called via reflection for any Axis2 service that
- * implements it. When this method is called, we first check to see
- * if Muse has bee initialized - if not, we kick off initialization.
- * We then proceed with normal request handling.
- *
- * @param opContext
- *
- */
- public void setOperationContext(OperationContext opContext)
- {
- //
- // is this the first time this is being called? initialize!
- //
- if (!hasBeenInitialized())
- {
- setInitialContext(opContext);
-
- initialize();
-
- setInitialContext(null);
- }
-
- //
- // for all requests, we need to save the OpContext so that
- // we can access the SOAP envelope in handleRequest()
- //
- if (!hasFailedToInitialize())
- {
- AxisEnvironment env = (AxisEnvironment)getRouter().getEnvironment();
- MessageHeaders wsa = env.convertContext(opContext);
- env.addAddressingContext(wsa);
- }
- }
-
- protected Environment createEnvironment()
+ protected OperationContext getInitialContext()
{
- return new AxisEnvironment(getInitialContext());
+ return _initialOpContext;
}
/**
@@ -144,5 +107,48 @@
env.removeAddressingContext();
return env.convertToAxiom(soapResponse);
+ }
+
+ protected void setInitialContext(OperationContext opContext)
+ {
+ _initialOpContext = opContext;
+ }
+
+ /**
+ *
+ * Because Axis2 doesn't use JAX-RPC ServiceLifecycle methods (or
+ * something similar), we use this as our initialization routine.
+ * This method is called via reflection for any Axis2 service that
+ * implements it. When this method is called, we first check to see
+ * if Muse has bee initialized - if not, we kick off initialization.
+ * We then proceed with normal request handling.
+ *
+ * @param opContext
+ *
+ */
+ public void setOperationContext(OperationContext opContext)
+ {
+ //
+ // is this the first time this is being called? initialize!
+ //
+ if (!hasBeenInitialized())
+ {
+ setInitialContext(opContext);
+
+ initialize();
+
+ setInitialContext(null);
+ }
+
+ //
+ // for all requests, we need to save the OpContext so that
+ // we can access the SOAP envelope in handleRequest()
+ //
+ if (!hasFailedToInitialize())
+ {
+ AxisEnvironment env = (AxisEnvironment)getRouter().getEnvironment();
+ MessageHeaders wsa = env.convertContext(opContext);
+ env.addAddressingContext(wsa);
+ }
}
}
Modified: webservices/muse/trunk/modules/muse-platform-jaxws/src/org/apache/muse/core/platform/jaxws/JaxWsEnvironment.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-platform-jaxws/src/org/apache/muse/core/platform/jaxws/JaxWsEnvironment.java?rev=434142&r1=434141&r2=434142&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-platform-jaxws/src/org/apache/muse/core/platform/jaxws/JaxWsEnvironment.java (original)
+++ webservices/muse/trunk/modules/muse-platform-jaxws/src/org/apache/muse/core/platform/jaxws/JaxWsEnvironment.java Wed Aug 23 12:54:57 2006
@@ -22,7 +22,7 @@
/**
*
- * JaxWsEnvironment is an extension of {@linkplain AbstractEnvironment AbstractEnvironment}
+ * JaxWsEnvironment is a concrete {@linkplain org.apache.muse.core.Environment Environment}
* for SOAP engines that support the JAX-WS specification. It provides all of the
* lower-level functionality that is abstracted through the Environment interface
* using the local file system, javax.servlet.*, and JAX-WS APIs.
@@ -45,13 +45,13 @@
//
private static final String _MUSE_INSTALL_PATH = "/WEB-INF/services/muse";
+ private MessageContext _messageContext = null;
+
//
// The WAR installation directory
//
private File _realDirectory = null;
- private MessageContext _messageContext = null;
-
/**
*
* This constructor allows the user to initialize the environment at
@@ -81,6 +81,43 @@
setDefaultURI(uri.toString());
}
+ public URL getDataResource(String path)
+ {
+ if (path == null)
+ throw new NullPointerException(_MESSAGES.get("NullResourcePath"));
+
+ File file = new File(getRealDirectory(), path);
+
+ try
+ {
+ return file.toURL();
+ }
+
+ catch (MalformedURLException error)
+ {
+ throw new RuntimeException(error.getMessage(), error);
+ }
+ }
+
+ public InputStream getDataResourceStream(String path)
+ {
+ if (path == null)
+ throw new NullPointerException(_MESSAGES.get("NullResourcePath"));
+
+ File file = new File(getRealDirectory(), path);
+
+ try
+ {
+ return new FileInputStream(file);
+ }
+
+ catch (FileNotFoundException error)
+ {
+ Object[] filler = { path, getRealDirectory() };
+ throw new RuntimeException(_MESSAGES.get("InvalidFile", filler));
+ }
+ }
+
public EndpointReference getDeploymentEPR()
{
//
@@ -164,43 +201,6 @@
public File getRealDirectory()
{
return _realDirectory;
- }
-
- public URL getDataResource(String path)
- {
- if (path == null)
- throw new NullPointerException(_MESSAGES.get("NullResourcePath"));
-
- File file = new File(getRealDirectory(), path);
-
- try
- {
- return file.toURL();
- }
-
- catch (MalformedURLException error)
- {
- throw new RuntimeException(error.getMessage(), error);
- }
- }
-
- public InputStream getDataResourceStream(String path)
- {
- if (path == null)
- throw new NullPointerException(_MESSAGES.get("NullResourcePath"));
-
- File file = new File(getRealDirectory(), path);
-
- try
- {
- return new FileInputStream(file);
- }
-
- catch (FileNotFoundException error)
- {
- Object[] filler = { path, getRealDirectory() };
- throw new RuntimeException(_MESSAGES.get("InvalidFile", filler));
- }
}
}
Modified: webservices/muse/trunk/modules/muse-platform-jaxws/src/org/apache/muse/core/platform/jaxws/JaxWsIsolationLayer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-platform-jaxws/src/org/apache/muse/core/platform/jaxws/JaxWsIsolationLayer.java?rev=434142&r1=434141&r2=434142&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-platform-jaxws/src/org/apache/muse/core/platform/jaxws/JaxWsIsolationLayer.java (original)
+++ webservices/muse/trunk/modules/muse-platform-jaxws/src/org/apache/muse/core/platform/jaxws/JaxWsIsolationLayer.java Wed Aug 23 12:54:57 2006
@@ -34,7 +34,8 @@
*
* JaxWsIsolationLayer is a JAX-WS-compliant service that forwards requests for
* WS-resources to the Muse resource router for further processing. It also
- * handles the conversion of DOM elements to SAAJ (SOAPElement) and back.
+ * handles the conversion of DOM elements to SAAJ elements (SOAPElement) and back.
+ * Like all JAX-WS services, this class requires JDK 1.5.
*
* @author Balan Subramanian
* @author Dan Jemiolo (danj)
@@ -45,11 +46,13 @@
@WebServiceProvider()
@BindingType(value="http://www.w3.org/2003/05/soap/bindings/HTTP/")
public class JaxWsIsolationLayer extends AbstractIsolationLayer implements Provider<SOAPMessage>
-{
+{
private static MessageFactory _MESSAGE_FACTORY = null;
private static SOAPFactory _SOAP_FACTORY = null;
+ @Resource WebServiceContext wsContext;
+
static
{
try
@@ -71,14 +74,13 @@
return new JaxWsEnvironment(mc);
}
- @PostConstruct
+ @PostConstruct
public void init()
{
if (!hasBeenInitialized())
initialize();
}
- @Resource WebServiceContext wsContext;
public SOAPMessage invoke(SOAPMessage request)
{
try
@@ -97,7 +99,36 @@
}
}
- protected SOAPMessage invokeOperation(SOAPMessage request)
+ protected Element invokeOperation(MessageHeaders addressing, Element soapBody)
+ {
+ Environment env = getRouter().getEnvironment();
+ env.addAddressingContext(addressing);
+
+ Element soapResponse = null;
+
+ //
+ // if the initialization failed, there will be a fault
+ // waiting to be serialized/sent back
+ //
+ if (hasFailedToInitialize())
+ soapResponse = getCauseOfFailure().toXML();
+
+ //
+ // otherwise, proceed as normal with routing
+ //
+ else
+ soapResponse = getRouter().invoke(soapBody);
+
+ //
+ // all done - don't forget to clean up the context or
+ // we'll have a memory leak
+ //
+ env.removeAddressingContext();
+
+ return soapResponse;
+ }
+
+ protected SOAPMessage invokeOperation(SOAPMessage request)
throws SOAPException, SoapFault
{
SOAPEnvelope env = request.getSOAPPart().getEnvelope();
@@ -164,34 +195,5 @@
LoggingUtils.logMessage(getRouter().getLog(), responseEnv, false);
return response;
- }
-
- protected Element invokeOperation(MessageHeaders addressing, Element soapBody)
- {
- Environment env = getRouter().getEnvironment();
- env.addAddressingContext(addressing);
-
- Element soapResponse = null;
-
- //
- // if the initialization failed, there will be a fault
- // waiting to be serialized/sent back
- //
- if (hasFailedToInitialize())
- soapResponse = getCauseOfFailure().toXML();
-
- //
- // otherwise, proceed as normal with routing
- //
- else
- soapResponse = getRouter().invoke(soapBody);
-
- //
- // all done - don't forget to clean up the context or
- // we'll have a memory leak
- //
- env.removeAddressingContext();
-
- return soapResponse;
}
}
Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/JavaMethod.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/JavaMethod.java?rev=434142&r1=434141&r2=434142&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/JavaMethod.java (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/JavaMethod.java Wed Aug 23 12:54:57 2006
@@ -26,26 +26,30 @@
public class JavaMethod
{
+ private String _actionURI = null;
+
private QName _name = null;
- private QName[] _parameterTypeNames = null;
private QName[] _parameterSchemaTypes = null;
+
+ private QName[] _parameterTypeNames = null;
+
private Class[] _parameterTypes = null;
private QName _returnName = null;
+
private QName _returnSchemaType = null;
- private Class _returnType = null;
- private String _actionURI;
+ private Class _returnType = null;
- public QName getName()
+ public String getActionURI()
{
- return _name;
+ return _actionURI;
}
- public void setName(QName name)
+ public QName getName()
{
- _name = name;
+ return _name;
}
public QName[] getParameterSchemaTypes()
@@ -53,66 +57,67 @@
return _parameterSchemaTypes;
}
- public void setParameterSchemaTypes(QName[] parameterSchemaTypes)
- {
- _parameterSchemaTypes = parameterSchemaTypes;
- }
-
public QName[] getParameterTypeNames()
{
return _parameterTypeNames;
}
- public void setParameterTypeNames(QName[] parameterTypeNames)
+ public Class[] getParameterTypes()
{
- _parameterTypeNames = parameterTypeNames;
+ return _parameterTypes;
}
- public Class[] getParameterTypes()
+ public QName getReturnName()
{
- return _parameterTypes;
+ return _returnName;
}
- public void setParameterTypes(Class[] parameterTypes)
+ public QName getReturnSchemaType()
{
- _parameterTypes = parameterTypes;
+ return _returnSchemaType;
}
- public QName getReturnName()
+ public Class getReturnType()
{
- return _returnName;
+ return _returnType;
}
- public void setReturnName(QName returnName)
+ public void setActionURI(String actionURI) {
+ _actionURI = actionURI;
+ }
+
+ public void setName(QName name)
{
- _returnName = returnName;
+ _name = name;
}
- public QName getReturnSchemaType()
+ public void setParameterSchemaTypes(QName[] parameterSchemaTypes)
{
- return _returnSchemaType;
+ _parameterSchemaTypes = parameterSchemaTypes;
}
- public void setReturnSchemaType(QName returnSchemaType)
+ public void setParameterTypeNames(QName[] parameterTypeNames)
{
- _returnSchemaType = returnSchemaType;
+ _parameterTypeNames = parameterTypeNames;
}
- public Class getReturnType()
+ public void setParameterTypes(Class[] parameterTypes)
{
- return _returnType;
+ _parameterTypes = parameterTypes;
}
- public void setReturnType(Class returnType)
+ public void setReturnName(QName returnName)
{
- _returnType = returnType;
+ _returnName = returnName;
}
- public String getActionURI() {
- return _actionURI;
+ public void setReturnSchemaType(QName returnSchemaType)
+ {
+ _returnSchemaType = returnSchemaType;
}
- public void setActionURI(String actionURI) {
- _actionURI = actionURI;
- }
+ public void setReturnType(Class returnType)
+ {
+ _returnType = returnType;
+ }
}
Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/JavaProperty.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/JavaProperty.java?rev=434142&r1=434141&r2=434142&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/JavaProperty.java (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/JavaProperty.java Wed Aug 23 12:54:57 2006
@@ -1,18 +1,20 @@
-/*=============================================================================*
- * Copyright 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *=============================================================================*/
+/*******************************************************************************
+ * =============================================================================
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ * =============================================================================
+ */
package org.apache.muse.tools.inspector;
@@ -23,24 +25,30 @@
* @author Andrew Eberbach
*
*/
-public class JavaProperty {
-
- private QName _name;
- private Class _type;
- public void setQName(QName property) {
- _name = property;
- }
-
- public QName getName() {
- return _name;
- }
-
- public void setJavaType(Class propertyType) {
- _type = propertyType;
- }
-
- public Class getJavaType() {
- return _type;
- }
+public class JavaProperty
+{
+ private QName _name = null;
+
+ private Class _type = null;
+
+ public Class getJavaType()
+ {
+ return _type;
+ }
+
+ public QName getName()
+ {
+ return _name;
+ }
+
+ public void setJavaType(Class propertyType)
+ {
+ _type = propertyType;
+ }
+
+ public void setQName(QName property)
+ {
+ _name = property;
+ }
}
Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/ResourceInspector.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/ResourceInspector.java?rev=434142&r1=434141&r2=434142&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/ResourceInspector.java (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/ResourceInspector.java Wed Aug 23 12:54:57 2006
@@ -73,7 +73,7 @@
* structures necessary to invoke operations with the proper SOAP messages and
* to reason about properties and their metadata. Its chief use is as the data
* model to the client generator that converts WSDL to a Java interface/class.
- *
+ * <br><br>
* The inspector can also be used in browser/explorer-like clients that do not
* know anything about the resource interfaces they will communicate with ahead
* of time. By providing a WSDL, a client can show (via UI) a user all of the
@@ -89,13 +89,104 @@
public class ResourceInspector
{
- private static final Set _BASIC_RESOURCE_METHODS = new HashSet();
-
//
// Used to lookup all exception messages
//
private static Messages _MESSAGES = MessagesFactory.get(ResourceInspector.class);
+ //
+ // The collection of operation names from WS-*
+ //
+ private static final Set _BASIC_RESOURCE_METHODS = new HashSet();
+
+ //
+ // A Map between XSD built-in types and JDK types
+ //
+ private static final Map _JAVA_TYPES = new HashMap();
+
+ //
+ // The XMLSchema namespace URI
+ //
+ public static final String NAMESPACE_URI =
+ "http://www.w3.org/2001/XMLSchema";
+
+ public static final String PREFIX = "xsd";
+
+ public static final QName ANY_TYPE_QNAME =
+ new QName(NAMESPACE_URI, "anyType", PREFIX);
+
+ public static final QName ANY_URI_QNAME =
+ new QName(NAMESPACE_URI, "anyURI", PREFIX);
+
+ public static final QName ATTRIBUTE_GROUP_QNAME =
+ new QName(NAMESPACE_URI, "attributeGroup", PREFIX);
+
+ public static final QName ATTRIBUTE_QNAME =
+ new QName(NAMESPACE_URI, "attribute", PREFIX);
+
+ public static final QName BOOLEAN_QNAME =
+ new QName(NAMESPACE_URI, "boolean", PREFIX);
+
+ public static final QName COMPLEX_TYPE_QNAME =
+ new QName(NAMESPACE_URI, "complexType", PREFIX);
+
+ public static final QName DATE_QNAME =
+ new QName(NAMESPACE_URI, "date", PREFIX);
+
+ public static final QName DATE_TIME_QNAME =
+ new QName(NAMESPACE_URI, "dateTime", PREFIX);
+
+ public static final QName DOUBLE_QNAME =
+ new QName(NAMESPACE_URI, "double", PREFIX);
+
+ public static final QName DURATION_QNAME =
+ new QName(NAMESPACE_URI, "duration", PREFIX);
+
+ public static final QName ELEMENT_QNAME =
+ new QName(NAMESPACE_URI, "element", PREFIX);
+
+ public static final QName FLOAT_QNAME =
+ new QName(NAMESPACE_URI, "float", PREFIX);
+
+ public static final QName IMPORT_QNAME =
+ new QName(NAMESPACE_URI, "import", PREFIX);
+
+ public static final QName INCLUDE_QNAME =
+ new QName(NAMESPACE_URI, "include", PREFIX);
+
+ public static final QName INT_QNAME =
+ new QName(NAMESPACE_URI, "int", PREFIX);
+
+ public static final QName INTEGER_QNAME =
+ new QName(NAMESPACE_URI, "integer", PREFIX);
+
+ public static final QName LANGSTRING_QNAME =
+ new QName("http://docs.oasis-open.org/wsdm/muws2-2.xsd", "LangString");
+
+ public static final QName LONG_QNAME =
+ new QName(NAMESPACE_URI, "long", PREFIX);
+
+ public static final QName NC_NAME_QNAME =
+ new QName(NAMESPACE_URI, "NCName", PREFIX);
+
+ public static final QName QNAME_QNAME =
+ new QName(NAMESPACE_URI, "QName", PREFIX);
+
+ public static final QName SCHEMA_QNAME =
+ new QName(NAMESPACE_URI, "schema", PREFIX);
+
+ public static final QName SEQUENCE_QNAME =
+ new QName(NAMESPACE_URI, "sequence", PREFIX);
+
+ public static final QName SHORT_QNAME =
+ new QName(NAMESPACE_URI, "short", PREFIX);
+
+ public static final QName SIMPLE_TYPE_QNAME =
+ new QName(NAMESPACE_URI, "simpleType", PREFIX);
+
+ public static final QName STRING_QNAME =
+ new QName(NAMESPACE_URI, "string", PREFIX);
+
static
{
_BASIC_RESOURCE_METHODS.add(WsrpConstants.GET_QNAME);
@@ -107,18 +198,95 @@
_BASIC_RESOURCE_METHODS.add(WsnConstants.NOTIFY_QNAME);
_BASIC_RESOURCE_METHODS.add(WsnConstants.SUBSCRIBE_QNAME);
_BASIC_RESOURCE_METHODS.add(WsnConstants.GET_CURRENT_QNAME);
+
+ //
+ // create the XSD -> JDK mapping for all supported types
+ //
+
+ _JAVA_TYPES.put(ANY_TYPE_QNAME, Element.class);
+ _JAVA_TYPES.put(ANY_URI_QNAME, URI.class);
+ _JAVA_TYPES.put(STRING_QNAME, String.class);
+ _JAVA_TYPES.put(NC_NAME_QNAME, String.class);
+ _JAVA_TYPES.put(QNAME_QNAME, QName.class);
+ _JAVA_TYPES.put(BOOLEAN_QNAME, boolean.class);
+ _JAVA_TYPES.put(INT_QNAME, int.class);
+ _JAVA_TYPES.put(INTEGER_QNAME, int.class);
+ _JAVA_TYPES.put(SHORT_QNAME, short.class);
+ _JAVA_TYPES.put(LONG_QNAME, long.class);
+ _JAVA_TYPES.put(FLOAT_QNAME, float.class);
+ _JAVA_TYPES.put(DOUBLE_QNAME, double.class);
+ _JAVA_TYPES.put(DATE_QNAME, Date.class);
+ _JAVA_TYPES.put(DATE_TIME_QNAME, Date.class);
+ _JAVA_TYPES.put(DURATION_QNAME, String.class);
+ _JAVA_TYPES.put(LANGSTRING_QNAME, String.class);
+
+ //
+ // this isn't a XSD type, but it's common to all WS-* services
+ //
+ _JAVA_TYPES.put(WsaConstants.EPR_QNAME, EndpointReference.class);
+ _JAVA_TYPES.put(WsaConstants.EPR_TYPE_QNAME, EndpointReference.class);
+ }
+
+ public static String getMethodName(String operationName)
+ {
+ if (operationName == null)
+ throw new NullPointerException(_MESSAGES.get("NullOperationName"));
+
+ char first = operationName.charAt(0);
+ return Character.toLowerCase(first) + operationName.substring(1);
+ }
+
+ /**
+ *
+ * @param type
+ * A Class representing the Java type that maps to the XSD type.
+ *
+ * @return The QName of the XSD type representing the given Java type,
+ * or ANY_TYPE_QNAME if no such mapping exists.
+ *
+ */
+ public static QName getSchemaType(Class type)
+ {
+ Iterator i = _JAVA_TYPES.entrySet().iterator();
+
+ while (i.hasNext())
+ {
+ Map.Entry next = (Map.Entry)i.next();
+ Class nextType = (Class)next.getValue();
+
+ if (type.equals(nextType))
+ return (QName)next.getKey();
+ }
+
+ return null;
+ }
+
+ /**
+ *
+ * @param typeName
+ * The _name of an XSD built-in type (or WS-A EndpointReference).
+ *
+ * @return A Class representing the Java type that maps to the XSD
+ * type, or null if no mapping exists.
+ *
+ */
+ public static Class getXsdJavaType(QName typeName)
+ {
+ return (Class)_JAVA_TYPES.get(typeName);
}
//
// The proxy type that will handle the core WS-* operations
//
private Class _baseProxyClass = null;
-
+
//
// Map[operation _name, ProxyHandler] for invoking services
//
private Map _handlersByName = null;
+ private LinkedHashMap _javaMethodsByName;
+
//
// A WSDL might have multiple port types, but it should only have one
// concrete service, which maps to one port type
@@ -135,8 +303,6 @@
// The service's WS-RP doc
//
private ResourcePropertiesSchema _wsrpSchema = null;
-
- private LinkedHashMap _javaMethodsByName;
private Object createBaseProxy(WsResourceClient resource)
throws Exception
@@ -217,19 +383,6 @@
return method;
}
-
- private QName getSchemaType(Element element)
- {
- if (element == null)
- return null;
-
- String typeName = element.getAttribute(XsdUtils.TYPE);
-
- if (typeName == null || typeName.length() == 0)
- return XsdUtils.ANY_TYPE_QNAME;
-
- return XmlUtils.parseQName(typeName, element);
- }
private ProxyHandler createReflectionHandler(JavaMethod method)
{
@@ -289,6 +442,7 @@
throw new RuntimeException(_MESSAGES.get("OperationUndefined", filler));
}
+
private ProxyHandler getHandler(String operation)
{
return (ProxyHandler)_handlersByName.get(operation);
@@ -316,15 +470,6 @@
return handlers;
}
- public static String getMethodName(String operationName)
- {
- if (operationName == null)
- throw new NullPointerException(_MESSAGES.get("NullOperationName"));
-
- char first = operationName.charAt(0);
- return Character.toLowerCase(first) + operationName.substring(1);
- }
-
private QName getInputName(Operation op)
{
Map parts = op.getInput().getMessage().getParts();
@@ -339,6 +484,15 @@
return docLiteralPart.getElementName();
}
+ //
+ // below are the names for some XSD built-in types
+ //
+
+
+ public Map getJavaMethods() {
+ return _javaMethodsByName;
+ }
+
private Class getJavaType(QName schemaType)
{
if (schemaType == null)
@@ -360,7 +514,7 @@
return ops;
}
-
+
private Map getOperations(Definition wsdlDef, Element wsdlXML, QName portTypeName)
{
PortType portType = wsdlDef.getPortType(portTypeName);
@@ -378,9 +532,9 @@
}
return getHandlers(_javaMethodsByName);
- }
-
- private QName getOutputName(Operation op)
+ }
+
+ private QName getOutputName(Operation op)
{
Output output = op.getOutput();
@@ -398,7 +552,7 @@
Part docLiteralPart = (Part)parts.values().iterator().next();
return docLiteralPart.getElementName();
}
-
+
public String[] getParameterNames(String operation)
{
QName[] qnames = getParameterQNames(operation);
@@ -410,7 +564,7 @@
return names;
}
-
+
public QName[] getParameterQNames(String operation)
{
ProxyHandler handler = getHandler(operation);
@@ -420,7 +574,7 @@
return new QName[0];
}
-
+
public QName[] getParameterSchemaTypes(String operation)
{
ProxyHandler handler = getHandler(operation);
@@ -437,7 +591,7 @@
return qnames;
}
-
+
public Class[] getParameterTypes(String operation)
{
ProxyHandler handler = getHandler(operation);
@@ -448,12 +602,12 @@
Method method = getBaseProxyMethod(operation);
return method.getParameterTypes();
}
-
+
public QName getPortType()
{
return _portType;
}
-
+
private QName getPortType(Definition wsdl)
{
Map services = wsdl.getServices();
@@ -471,12 +625,12 @@
PortType portType = port.getBinding().getPortType();
return portType.getQName();
}
-
+
public Collection getProperties()
{
return _wsrpSchema == null?null:_wsrpSchema.getPropertyNames();
}
-
+
public Class getPropertyType(QName property)
{
QName type = _wsrpSchema.getPropertyTypeName(property);
@@ -496,7 +650,7 @@
return javaType;
}
-
+
private Class getProxyExtends(Map operations)
{
if (operations.keySet().contains(WsnConstants.SUBSCRIBE_QNAME))
@@ -507,7 +661,7 @@
return WsResourceClient.class;
}
-
+
public QName getRequestName(String operation)
{
ProxyHandler handler = getHandler(operation);
@@ -517,7 +671,7 @@
return null;
}
-
+
public QName getReturnName(String operation)
{
ProxyHandler handler = getHandler(operation);
@@ -528,6 +682,24 @@
return null;
}
+ //
+ // below are the common names for XSD tags
+ //
+
+
+
+ public QName getReturnSchemaType(String operation)
+ {
+ ProxyHandler handler = getHandler(operation);
+
+ if (handler != null)
+ return handler.getReturnSchemaType();
+
+ Method method = getBaseProxyMethod(operation);
+ Class type = method.getReturnType();
+ return getSchemaType(type);
+ }
+
public Class getReturnType(String operation)
{
ProxyHandler handler = getHandler(operation);
@@ -539,16 +711,17 @@
return method.getReturnType();
}
- public QName getReturnSchemaType(String operation)
+ private QName getSchemaType(Element element)
{
- ProxyHandler handler = getHandler(operation);
+ if (element == null)
+ return null;
- if (handler != null)
- return handler.getReturnSchemaType();
+ String typeName = element.getAttribute(XsdUtils.TYPE);
- Method method = getBaseProxyMethod(operation);
- Class type = method.getReturnType();
- return getSchemaType(type);
+ if (typeName == null || typeName.length() == 0)
+ return XsdUtils.ANY_TYPE_QNAME;
+
+ return XmlUtils.parseQName(typeName, element);
}
private ResourcePropertiesSchema getWsrpSchema(Element wsdl, QName portType)
@@ -638,7 +811,7 @@
{
run(wsdl, null);
}
-
+
public void run(Element wsdl, Environment env)
{
Definition def = null;
@@ -674,183 +847,10 @@
_handlersByName = getOperations(def, wsdl, _portType);
}
-
+
public void setMetadata(Element rmdXML)
{
rmdXML = XmlUtils.getFirstElement(rmdXML);
_rmd = new SimpleMetadataDescriptor(rmdXML);
- }
-
-
- //
- // A Map between XSD built-in types and JDK types
- //
- private static Map _JAVA_TYPES = new HashMap();
-
- /**
- *
- * @param type
- * A Class representing the Java type that maps to the XSD type.
- *
- * @return The QName of the XSD type representing the given Java type,
- * or ANY_TYPE_QNAME if no such mapping exists.
- *
- */
- public static QName getSchemaType(Class type)
- {
- Iterator i = _JAVA_TYPES.entrySet().iterator();
-
- while (i.hasNext())
- {
- Map.Entry next = (Map.Entry)i.next();
- Class nextType = (Class)next.getValue();
-
- if (type.equals(nextType))
- return (QName)next.getKey();
- }
-
- return null;
- }
-
- /**
- *
- * @param typeName
- * The _name of an XSD built-in type (or WS-A EndpointReference).
- *
- * @return A Class representing the Java type that maps to the XSD
- * type, or null if no mapping exists.
- *
- */
- public static Class getXsdJavaType(QName typeName)
- {
- return (Class)_JAVA_TYPES.get(typeName);
- }
-
- //
- // below are the names for some XSD built-in types
- //
-
-
- //
- // The XMLSchema namespace URI
- //
- public static final String NAMESPACE_URI =
- "http://www.w3.org/2001/XMLSchema";
-
- public static final String PREFIX = "xsd";
-
- public static final QName ANY_TYPE_QNAME =
- new QName(NAMESPACE_URI, "anyType", PREFIX);
-
- public static final QName ANY_URI_QNAME =
- new QName(NAMESPACE_URI, "anyURI", PREFIX);
-
- public static final QName BOOLEAN_QNAME =
- new QName(NAMESPACE_URI, "boolean", PREFIX);
-
- public static final QName DATE_QNAME =
- new QName(NAMESPACE_URI, "date", PREFIX);
-
- public static final QName DATE_TIME_QNAME =
- new QName(NAMESPACE_URI, "dateTime", PREFIX);
-
- public static final QName DOUBLE_QNAME =
- new QName(NAMESPACE_URI, "double", PREFIX);
-
- public static final QName DURATION_QNAME =
- new QName(NAMESPACE_URI, "duration", PREFIX);
-
- public static final QName FLOAT_QNAME =
- new QName(NAMESPACE_URI, "float", PREFIX);
-
- public static final QName INT_QNAME =
- new QName(NAMESPACE_URI, "int", PREFIX);
-
- public static final QName INTEGER_QNAME =
- new QName(NAMESPACE_URI, "integer", PREFIX);
-
- public static final QName LONG_QNAME =
- new QName(NAMESPACE_URI, "long", PREFIX);
-
- public static final QName QNAME_QNAME =
- new QName(NAMESPACE_URI, "QName", PREFIX);
-
- public static final QName SHORT_QNAME =
- new QName(NAMESPACE_URI, "short", PREFIX);
-
- public static final QName STRING_QNAME =
- new QName(NAMESPACE_URI, "string", PREFIX);
-
- //
- // below are the common names for XSD tags
- //
-
-
-
- public static final QName ATTRIBUTE_QNAME =
- new QName(NAMESPACE_URI, "attribute", PREFIX);
-
- public static final QName ATTRIBUTE_GROUP_QNAME =
- new QName(NAMESPACE_URI, "attributeGroup", PREFIX);
-
- public static final QName COMPLEX_TYPE_QNAME =
- new QName(NAMESPACE_URI, "complexType", PREFIX);
-
- public static final QName ELEMENT_QNAME =
- new QName(NAMESPACE_URI, "element", PREFIX);
-
- public static final QName IMPORT_QNAME =
- new QName(NAMESPACE_URI, "import", PREFIX);
-
- public static final QName INCLUDE_QNAME =
- new QName(NAMESPACE_URI, "include", PREFIX);
-
- public static final QName NC_NAME_QNAME =
- new QName(NAMESPACE_URI, "NCName", PREFIX);
-
- public static final QName SCHEMA_QNAME =
- new QName(NAMESPACE_URI, "schema", PREFIX);
-
- public static final QName SEQUENCE_QNAME =
- new QName(NAMESPACE_URI, "sequence", PREFIX);
-
- public static final QName SIMPLE_TYPE_QNAME =
- new QName(NAMESPACE_URI, "simpleType", PREFIX);
-
- public static final QName LANGSTRING_QNAME =
- new QName("http://docs.oasis-open.org/wsdm/muws2-2.xsd", "LangString");
-
- static
- {
- //
- // create the XSD -> JDK mapping for all supported types
- //
-
- _JAVA_TYPES.put(ANY_TYPE_QNAME, Element.class);
- _JAVA_TYPES.put(ANY_URI_QNAME, URI.class);
- _JAVA_TYPES.put(STRING_QNAME, String.class);
- _JAVA_TYPES.put(NC_NAME_QNAME, String.class);
- _JAVA_TYPES.put(QNAME_QNAME, QName.class);
- _JAVA_TYPES.put(BOOLEAN_QNAME, boolean.class);
- _JAVA_TYPES.put(INT_QNAME, int.class);
- _JAVA_TYPES.put(INTEGER_QNAME, int.class);
- _JAVA_TYPES.put(SHORT_QNAME, short.class);
- _JAVA_TYPES.put(LONG_QNAME, long.class);
- _JAVA_TYPES.put(FLOAT_QNAME, float.class);
- _JAVA_TYPES.put(DOUBLE_QNAME, double.class);
- _JAVA_TYPES.put(DATE_QNAME, Date.class);
- _JAVA_TYPES.put(DATE_TIME_QNAME, Date.class);
- _JAVA_TYPES.put(DURATION_QNAME, String.class);
- _JAVA_TYPES.put(LANGSTRING_QNAME, String.class);
-
- //
- // this isn't a XSD type, but it's common to all WS-* services
- //
- _JAVA_TYPES.put(WsaConstants.EPR_QNAME, EndpointReference.class);
- _JAVA_TYPES.put(WsaConstants.EPR_TYPE_QNAME, EndpointReference.class);
- }
-
- public Map getJavaMethods() {
- return _javaMethodsByName;
}
}
Modified: webservices/muse/trunk/modules/muse-util-qname/src/javax/xml/namespace/QName.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-util-qname/src/javax/xml/namespace/QName.java?rev=434142&r1=434141&r2=434142&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-util-qname/src/javax/xml/namespace/QName.java (original)
+++ webservices/muse/trunk/modules/muse-util-qname/src/javax/xml/namespace/QName.java Wed Aug 23 12:54:57 2006
@@ -36,6 +36,32 @@
private String _prefix = null;
+ public static QName valueOf(String qnameFromToString)
+ {
+ String namespaceURI = null;
+ String localPart = null;
+
+ int startLocalPart = 0;
+
+ if (qnameFromToString.charAt(0) == '{')
+ {
+ int closeBracket = qnameFromToString.indexOf('}');
+
+ if (closeBracket < 0)
+ throw new IllegalArgumentException("Invalid QName string: namespace has no closing bracket.");
+
+ if (closeBracket == qnameFromToString.length() - 1)
+ throw new IllegalArgumentException("Invalid QName string: no local part after namespace.");
+
+ namespaceURI = qnameFromToString.substring(1, closeBracket);
+ startLocalPart = closeBracket + 1;
+ }
+
+ localPart = qnameFromToString.substring(startLocalPart);
+
+ return new QName(namespaceURI, localPart, null);
+ }
+
public QName(String localPart)
{
this("", localPart, "");
@@ -45,7 +71,7 @@
{
this(namespaceURI, localPart, "");
}
-
+
public QName(String namespaceURI, String localPart, String prefix)
{
if (namespaceURI == null)
@@ -62,31 +88,31 @@
_prefix = prefix;
}
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ return true;
+
+ QName other = (QName)obj;
+ return getNamespaceURI().equals(other.getNamespaceURI()) &&
+ getLocalPart().equals(other.getLocalPart());
+ }
+
public String getLocalPart()
{
return _localPart;
}
-
+
public String getNamespaceURI()
{
return _namespaceURI;
}
-
+
public String getPrefix()
{
return _prefix;
}
- public boolean equals(Object obj)
- {
- if (obj == this)
- return true;
-
- QName other = (QName)obj;
- return getNamespaceURI().equals(other.getNamespaceURI()) &&
- getLocalPart().equals(other.getLocalPart());
- }
-
public int hashCode()
{
return getNamespaceURI().hashCode() + getLocalPart().hashCode();
@@ -107,31 +133,5 @@
buffer.append(getLocalPart());
return buffer.toString();
- }
-
- public static QName valueOf(String qnameFromToString)
- {
- String namespaceURI = null;
- String localPart = null;
-
- int startLocalPart = 0;
-
- if (qnameFromToString.charAt(0) == '{')
- {
- int closeBracket = qnameFromToString.indexOf('}');
-
- if (closeBracket < 0)
- throw new IllegalArgumentException("Invalid QName string: namespace has no closing bracket.");
-
- if (closeBracket == qnameFromToString.length() - 1)
- throw new IllegalArgumentException("Invalid QName string: no local part after namespace.");
-
- namespaceURI = qnameFromToString.substring(1, closeBracket);
- startLocalPart = closeBracket + 1;
- }
-
- localPart = qnameFromToString.substring(startLocalPart);
-
- return new QName(namespaceURI, localPart, null);
}
}
Modified: webservices/muse/trunk/modules/muse-util-xml/src/org/apache/muse/util/xml/XPathUtils.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-util-xml/src/org/apache/muse/util/xml/XPathUtils.java?rev=434142&r1=434141&r2=434142&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-util-xml/src/org/apache/muse/util/xml/XPathUtils.java (original)
+++ webservices/muse/trunk/modules/muse-util-xml/src/org/apache/muse/util/xml/XPathUtils.java Wed Aug 23 12:54:57 2006
@@ -27,7 +27,8 @@
/**
*
- * XPathUtils is a collection of utility methods related to XPath 1.0.
+ * XPathUtils is a collection of utility methods related to XPath 1.0. It
+ * depends on Apache Xalan.
*
* @author Dan Jemiolo (danj)
*
Modified: webservices/muse/trunk/modules/muse-util-xml/src/org/apache/muse/util/xml/XmlUtils.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-util-xml/src/org/apache/muse/util/xml/XmlUtils.java?rev=434142&r1=434141&r2=434142&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-util-xml/src/org/apache/muse/util/xml/XmlUtils.java (original)
+++ webservices/muse/trunk/modules/muse-util-xml/src/org/apache/muse/util/xml/XmlUtils.java Wed Aug 23 12:54:57 2006
@@ -58,7 +58,7 @@
*/
public class XmlUtils
-{
+{
/**
*
* An empty Document that can be used as a DOM factory for creation of
@@ -84,7 +84,7 @@
*
*/
public static final String XML_HEADER = "<?xml version=\"1.0\"?>";
-
+
/**
*
* Standard prefix for XML namespace attributes.
Modified: webservices/muse/trunk/modules/muse-util-xml/src/org/apache/muse/util/xml/XsdUtils.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-util-xml/src/org/apache/muse/util/xml/XsdUtils.java?rev=434142&r1=434141&r2=434142&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-util-xml/src/org/apache/muse/util/xml/XsdUtils.java (original)
+++ webservices/muse/trunk/modules/muse-util-xml/src/org/apache/muse/util/xml/XsdUtils.java Wed Aug 23 12:54:57 2006
@@ -35,12 +35,14 @@
public class XsdUtils
{
- //
- // The XMLSchema namespace URI
- //
+ /**
+ *
+ * The XML Schema namespace URI.
+ *
+ */
public static final String NAMESPACE_URI =
"http://www.w3.org/2001/XMLSchema";
-
+
public static final String PREFIX = "xsd";
//
@@ -49,19 +51,28 @@
private static DateFormat _FORMATTER =
new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
- //
- // below are the names for some XSD built-in types
- //
-
public static final QName ANY_TYPE_QNAME =
new QName(NAMESPACE_URI, "anyType", PREFIX);
public static final QName ANY_URI_QNAME =
new QName(NAMESPACE_URI, "anyURI", PREFIX);
+
+ //
+ // below are the names for some XSD built-in types
+ //
+
+ public static final QName ATTRIBUTE_GROUP_QNAME =
+ new QName(NAMESPACE_URI, "attributeGroup", PREFIX);
+
+ public static final QName ATTRIBUTE_QNAME =
+ new QName(NAMESPACE_URI, "attribute", PREFIX);
public static final QName BOOLEAN_QNAME =
new QName(NAMESPACE_URI, "boolean", PREFIX);
+ public static final QName COMPLEX_TYPE_QNAME =
+ new QName(NAMESPACE_URI, "complexType", PREFIX);
+
public static final QName DATE_QNAME =
new QName(NAMESPACE_URI, "date", PREFIX);
@@ -74,92 +85,79 @@
public static final QName DURATION_QNAME =
new QName(NAMESPACE_URI, "duration", PREFIX);
+ public static final QName ELEMENT_QNAME =
+ new QName(NAMESPACE_URI, "element", PREFIX);
+
public static final QName FLOAT_QNAME =
new QName(NAMESPACE_URI, "float", PREFIX);
+ public static final QName IMPORT_QNAME =
+ new QName(NAMESPACE_URI, "import", PREFIX);
+
+ public static final QName INCLUDE_QNAME =
+ new QName(NAMESPACE_URI, "include", PREFIX);
+
public static final QName INT_QNAME =
new QName(NAMESPACE_URI, "int", PREFIX);
public static final QName INTEGER_QNAME =
new QName(NAMESPACE_URI, "integer", PREFIX);
-
- public static final QName LONG_QNAME =
- new QName(NAMESPACE_URI, "long", PREFIX);
-
- public static final QName QNAME_QNAME =
- new QName(NAMESPACE_URI, "QName", PREFIX);
-
- public static final QName SHORT_QNAME =
- new QName(NAMESPACE_URI, "short", PREFIX);
-
- public static final QName STRING_QNAME =
- new QName(NAMESPACE_URI, "string", PREFIX);
//
// below are the common names for XSD tags
//
- public static final QName ATTRIBUTE_QNAME =
- new QName(NAMESPACE_URI, "attribute", PREFIX);
+ public static final QName LONG_QNAME =
+ new QName(NAMESPACE_URI, "long", PREFIX);
- public static final QName ATTRIBUTE_GROUP_QNAME =
- new QName(NAMESPACE_URI, "attributeGroup", PREFIX);
-
- public static final QName COMPLEX_TYPE_QNAME =
- new QName(NAMESPACE_URI, "complexType", PREFIX);
-
- public static final QName ELEMENT_QNAME =
- new QName(NAMESPACE_URI, "element", PREFIX);
+ public static final String MAX_OCCURS = "maxOccurs";
- public static final QName IMPORT_QNAME =
- new QName(NAMESPACE_URI, "import", PREFIX);
+ public static final String MIN_OCCURS = "minOccurs";
- public static final QName INCLUDE_QNAME =
- new QName(NAMESPACE_URI, "include", PREFIX);
+ public static final long MS_IN_A_DAY = 86400 * 1000;
- public static final QName NC_NAME_QNAME =
- new QName(NAMESPACE_URI, "NCName", PREFIX);
+ public static final long MS_IN_A_HOUR = 3600 * 1000;
- public static final QName SCHEMA_QNAME =
- new QName(NAMESPACE_URI, "schema", PREFIX);
+ public static final long MS_IN_A_MINUTE = 60 * 1000;
- public static final QName SEQUENCE_QNAME =
- new QName(NAMESPACE_URI, "sequence", PREFIX);
+ public static final long MS_IN_A_MONTH = 2629744 * 1000;
- public static final QName SIMPLE_TYPE_QNAME =
- new QName(NAMESPACE_URI, "simpleType", PREFIX);
+ public static final long MS_IN_A_YEAR = 31556926 * 1000;
- //
- // below are the common attribute names/values found in XSD tags
- //
+ public static final String NAME = "name";
- public static final String MAX_OCCURS = "maxOccurs";
-
- public static final String MIN_OCCURS = "minOccurs";
+ public static final String NAMESPACE = "namespace";
- public static final String NAME = "name";
+ public static final QName NC_NAME_QNAME =
+ new QName(NAMESPACE_URI, "NCName", PREFIX);
public static final String NILLABLE = "nillable";
-
- public static final String REF = "ref";
- public static final String SCHEMA_LOCATION = "schemaLocation";
+ public static final QName QNAME_QNAME =
+ new QName(NAMESPACE_URI, "QName", PREFIX);
+
+ public static final String REF = "ref";
- public static final String TYPE = "type";
+ public static final String SCHEMA_LOCATION = "schemaLocation";
- public static final String UNBOUNDED = "unbounded";
+ public static final QName SCHEMA_QNAME =
+ new QName(NAMESPACE_URI, "schema", PREFIX);
- public static final String NAMESPACE = "namespace";
+ public static final QName SEQUENCE_QNAME =
+ new QName(NAMESPACE_URI, "sequence", PREFIX);
//
// millisecond values used when serializing xsd:durations
//
- public static final long MS_IN_A_DAY = 86400 * 1000;
- public static final long MS_IN_A_HOUR = 3600 * 1000;
- public static final long MS_IN_A_MINUTE = 60 * 1000;
- public static final long MS_IN_A_MONTH = 2629744 * 1000;
- public static final long MS_IN_A_YEAR = 31556926 * 1000;
+ public static final QName SHORT_QNAME =
+ new QName(NAMESPACE_URI, "short", PREFIX);
+ public static final QName SIMPLE_TYPE_QNAME =
+ new QName(NAMESPACE_URI, "simpleType", PREFIX);
+ public static final QName STRING_QNAME =
+ new QName(NAMESPACE_URI, "string", PREFIX);
+ public static final String TYPE = "type";
+ public static final String UNBOUNDED = "unbounded";
/**
*
Modified: webservices/muse/trunk/modules/muse-util-xstream/src/org/apache/muse/core/serializer/xstream/XStreamSerializer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-util-xstream/src/org/apache/muse/core/serializer/xstream/XStreamSerializer.java?rev=434142&r1=434141&r2=434142&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-util-xstream/src/org/apache/muse/core/serializer/xstream/XStreamSerializer.java (original)
+++ webservices/muse/trunk/modules/muse-util-xstream/src/org/apache/muse/core/serializer/xstream/XStreamSerializer.java Wed Aug 23 12:54:57 2006
@@ -57,7 +57,7 @@
*/
public abstract class XStreamSerializer implements Serializer
-{
+{
//
// The XStream facade that aggregates all of the core XStream features.
// Note we initialize XStream with the DOM driver so that sub-classes
@@ -114,7 +114,7 @@
return root;
}
-
+
/**
*
* @return A POJO representation of the given XML fragment.
@@ -169,27 +169,6 @@
/**
*
- * MuseSerializerXStream is a version of XStream that uses our
- * JavaFieldConverter class to map Java field names to XML elements.
- *
- * @author Dan Jemiolo (danj)
- *
- */
- private class MuseSerializerXStream extends XStream
- {
- public MuseSerializerXStream()
- {
- super(new DomDriver());
- }
-
- protected MapperWrapper wrapMapper(MapperWrapper next)
- {
- return new JavaFieldConverter(next);
- }
- }
-
- /**
- *
* JavaFieldConverter is a pluggable XStream component that allows us
* more control over the naming conventions XStream uses/accepts when
* serializing and deserializing XML. We use this component to achieve
@@ -294,6 +273,27 @@
fieldName = Character.toUpperCase(fieldName.charAt(0)) + fieldName.substring(1);
return super.serializedMember(theClass, fieldName);
+ }
+ }
+
+ /**
+ *
+ * MuseSerializerXStream is a version of XStream that uses our
+ * JavaFieldConverter class to map Java field names to XML elements.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+ private class MuseSerializerXStream extends XStream
+ {
+ public MuseSerializerXStream()
+ {
+ super(new DomDriver());
+ }
+
+ protected MapperWrapper wrapMapper(MapperWrapper next)
+ {
+ return new JavaFieldConverter(next);
}
}
}
Modified: webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/CommandLine.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/CommandLine.java?rev=434142&r1=434141&r2=434142&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/CommandLine.java (original)
+++ webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/CommandLine.java Wed Aug 23 12:54:57 2006
@@ -37,6 +37,11 @@
public class CommandLine
{
//
+ // all non-flag values
+ //
+ private String[] _arguments = null;
+
+ //
// the flags (-foo) that were found on the command line
//
private Map _flags = new HashMap();
@@ -46,11 +51,6 @@
// that allows the application to process the flag.
//
private Set _flagsWithValues = new HashSet();
-
- //
- // all non-flag values
- //
- private String[] _arguments = null;
/**
*
Modified: webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/FileUtils.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/FileUtils.java?rev=434142&r1=434141&r2=434142&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/FileUtils.java (original)
+++ webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/FileUtils.java Wed Aug 23 12:54:57 2006
@@ -182,42 +182,12 @@
copyFile(source, destination);
}
- public static void copyFile(InputStream input, File destination)
- throws IOException
- {
- OutputStream output = null;
-
- try
- {
- output = new FileOutputStream(destination);
-
- byte[] buffer = new byte[1024];
-
- int bytesRead = input.read(buffer);
-
- while (bytesRead >= 0)
- {
- output.write(buffer, 0, bytesRead);
- bytesRead = input.read(buffer);
- }
- }
-
- finally
- {
- if (input != null)
- close(input);
-
- if (output != null)
- close(output);
- }
- }
-
public static void copyDirectory(File source, File destination)
throws IOException
{
copyDirectory(source, destination, null);
}
-
+
public static void copyDirectory(File source, File destination, FileFilter filter)
throws IOException
{
@@ -250,8 +220,8 @@
}
}
}
-
- public static void copyFile(File source, File destination)
+
+ public static void copyFile(File source, File destination)
throws IOException
{
//
@@ -263,6 +233,36 @@
FileInputStream input = new FileInputStream(source);
copyFile(input, destination);
+ }
+
+ public static void copyFile(InputStream input, File destination)
+ throws IOException
+ {
+ OutputStream output = null;
+
+ try
+ {
+ output = new FileOutputStream(destination);
+
+ byte[] buffer = new byte[1024];
+
+ int bytesRead = input.read(buffer);
+
+ while (bytesRead >= 0)
+ {
+ output.write(buffer, 0, bytesRead);
+ bytesRead = input.read(buffer);
+ }
+ }
+
+ finally
+ {
+ if (input != null)
+ close(input);
+
+ if (output != null)
+ close(output);
+ }
}
/**
Modified: webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/ReflectUtilHelper.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/ReflectUtilHelper.java?rev=434142&r1=434141&r2=434142&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/ReflectUtilHelper.java (original)
+++ webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/ReflectUtilHelper.java Wed Aug 23 12:54:57 2006
@@ -2,15 +2,13 @@
/**
*
- * ReflectUtilHelper is ...
- *
* @author Joel Hawkins
*
*/
public interface ReflectUtilHelper
{
- Class getClass(String className);
-
boolean exists(String className);
+
+ Class getClass(String className);
}
Modified: webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/ReflectUtils.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/ReflectUtils.java?rev=434142&r1=434141&r2=434142&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/ReflectUtils.java (original)
+++ webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/ReflectUtils.java Wed Aug 23 12:54:57 2006
@@ -39,11 +39,6 @@
public class ReflectUtils
{
//
- // Used to lookup all exception messages
- //
- private static Messages _MESSAGES = MessagesFactory.get(ReflectUtils.class);
-
- //
// The class loader used by this class
//
private static final ClassLoader _DEFAULT_CLASS_LOADER;
@@ -53,6 +48,11 @@
//
private static ReflectUtilHelper _helper = null;
+ //
+ // Used to lookup all exception messages
+ //
+ private static Messages _MESSAGES = MessagesFactory.get(ReflectUtils.class);
+
static
{
//
@@ -62,7 +62,7 @@
_DEFAULT_CLASS_LOADER = instance.getClass().getClassLoader();
_helper = null;
}
-
+
/**
*
* @param className
@@ -136,82 +136,6 @@
/**
*
- * @param arrayClass
- * The array version of a given type (<em>YourType[].class</em>)
- *
- * @return The non-array version of the given type. For example, if you pass
- * <em>String[].class</em>, you get <em>String.class</em>. If
- * you pass <em>int[].class</em>, you get <em>int.class</em>.
- *
- * @see #getArrayClassFromClass(Class)
- *
- */
- public static Class getClassFromArrayClass(Class arrayClass)
- {
- if (arrayClass == null)
- throw new NullPointerException(_MESSAGES.get("NullClass"));
-
- String name = arrayClass.getName();
-
- //
- // make sure it's an array type
- //
- if (name.charAt(0) != '[')
- {
- Object[] filler = { name };
- throw new RuntimeException(_MESSAGES.get("NotArrayClass", filler));
- }
-
- if (name.charAt(1) == '[')
- {
- Object[] filler = { name };
- throw new RuntimeException(_MESSAGES.get("NoMultiArrays", filler));
- }
-
- //
- // the char after the [ signifies the type of the array. these
- // values are documented with java.lang.Class.getName()
- //
- char type = name.charAt(1);
-
- switch (type)
- {
- case 'Z':
- return boolean.class;
-
- case 'B':
- return byte.class;
-
- case 'C':
- return char.class;
-
- case 'D':
- return double.class;
-
- case 'F':
- return float.class;
-
- case 'I':
- return int.class;
-
- case 'J':
- return long.class;
-
- case 'S':
- return short.class;
-
- case 'L':
- return getClass(name.substring(2, name.length() - 1));
-
- default:
- Object[] filler = { name, new Character(type) };
- String message = _MESSAGES.get("UnsupportedType", filler);
- throw new RuntimeException(message);
- }
- }
-
- /**
- *
* This method calls getClass(Class, ClassLoader) with this class'
* ClassLoader.
*
@@ -285,6 +209,82 @@
Object[] filler = { className };
String message = _MESSAGES.get("JavaClassNotFound", filler);
throw new RuntimeException(message);
+ }
+ }
+
+ /**
+ *
+ * @param arrayClass
+ * The array version of a given type (<em>YourType[].class</em>)
+ *
+ * @return The non-array version of the given type. For example, if you pass
+ * <em>String[].class</em>, you get <em>String.class</em>. If
+ * you pass <em>int[].class</em>, you get <em>int.class</em>.
+ *
+ * @see #getArrayClassFromClass(Class)
+ *
+ */
+ public static Class getClassFromArrayClass(Class arrayClass)
+ {
+ if (arrayClass == null)
+ throw new NullPointerException(_MESSAGES.get("NullClass"));
+
+ String name = arrayClass.getName();
+
+ //
+ // make sure it's an array type
+ //
+ if (name.charAt(0) != '[')
+ {
+ Object[] filler = { name };
+ throw new RuntimeException(_MESSAGES.get("NotArrayClass", filler));
+ }
+
+ if (name.charAt(1) == '[')
+ {
+ Object[] filler = { name };
+ throw new RuntimeException(_MESSAGES.get("NoMultiArrays", filler));
+ }
+
+ //
+ // the char after the [ signifies the type of the array. these
+ // values are documented with java.lang.Class.getName()
+ //
+ char type = name.charAt(1);
+
+ switch (type)
+ {
+ case 'Z':
+ return boolean.class;
+
+ case 'B':
+ return byte.class;
+
+ case 'C':
+ return char.class;
+
+ case 'D':
+ return double.class;
+
+ case 'F':
+ return float.class;
+
+ case 'I':
+ return int.class;
+
+ case 'J':
+ return long.class;
+
+ case 'S':
+ return short.class;
+
+ case 'L':
+ return getClass(name.substring(2, name.length() - 1));
+
+ default:
+ Object[] filler = { name, new Character(type) };
+ String message = _MESSAGES.get("UnsupportedType", filler);
+ throw new RuntimeException(message);
}
}
Modified: webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/messages/MessagesFactory.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/messages/MessagesFactory.java?rev=434142&r1=434141&r2=434142&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/messages/MessagesFactory.java (original)
+++ webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/messages/MessagesFactory.java Wed Aug 23 12:54:57 2006
@@ -41,14 +41,14 @@
public class MessagesFactory
{
//
- // The standard name for .properties files with error messages.
+ // Each package can have one Messages.properties resources.
//
- private static final String _RESOURCE_NAME = "Messages";
+ private static Map _messagesByPackage = new HashMap();
//
- // Each package can have one Messages.properties resources.
+ // The standard name for .properties files with error messages.
//
- private static Map _messagesByPackage = new HashMap();
+ private static final String _RESOURCE_NAME = "Messages";
/**
*
Modified: webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/EndpointReference.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/EndpointReference.java?rev=434142&r1=434141&r2=434142&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/EndpointReference.java (original)
+++ webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/EndpointReference.java Wed Aug 23 12:54:57 2006
@@ -34,7 +34,7 @@
/**
*
* EndpointReference is a complete implementation of the EndpointReferenceType
- * type defined in WS-Addressing.
+ * type defined in WS-Addressing 1.0.
* <br><br>
* This class is implemented as a wrapper for an XML representation of an EPR,
* providing methods that allow users to get and set values with regular Java
@@ -415,6 +415,29 @@
}
/**
+ *
+ * @return All reference parameter instances (there is no guarantee as
+ * to the order of the elements). If there are no reference
+ * parameters, the array is empty.
+ *
+ */
+ public Element[] getParameters()
+ {
+ return XmlUtils.getAllElements(_parameters);
+ }
+
+ /**
+ *
+ * @return All reference parameter instances with the given name. If
+ * there are no instances with that name, the array is empty.
+ *
+ */
+ public Element[] getParameters(QName qname)
+ {
+ return XmlUtils.getElements(_parameters, qname);
+ }
+
+ /**
*
* @param qname
* The name of the reference parameter to look up.
@@ -446,29 +469,6 @@
return null;
return XmlUtils.extractText(xml);
- }
-
- /**
- *
- * @return All reference parameter instances (there is no guarantee as
- * to the order of the elements). If there are no reference
- * parameters, the array is empty.
- *
- */
- public Element[] getParameters()
- {
- return XmlUtils.getAllElements(_parameters);
- }
-
- /**
- *
- * @return All reference parameter instances with the given name. If
- * there are no instances with that name, the array is empty.
- *
- */
- public Element[] getParameters(QName qname)
- {
- return XmlUtils.getElements(_parameters, qname);
}
/**
Modified: webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/MessageHeaders.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/MessageHeaders.java?rev=434142&r1=434141&r2=434142&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/MessageHeaders.java (original)
+++ webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/MessageHeaders.java Wed Aug 23 12:54:57 2006
@@ -38,21 +38,10 @@
* values <b>or</b> create a new set of headers that can be serialized to a
* set of valid SOAP headers.
* <br><br>
- * This class processes WS-A headers differently from other implementations
- * in three ways:<br>
- * <ol>
- * <li>It provides the wsa:To header as an
- * {@linkplain EndpointReference EndpointReference}, not
- * a simple URI value.</li>
- * <li>It turns all non-WS-A SOAP headers into reference properties for
- * the wsa:To EPR.</li>
- * <li>It provides a simple mechanism for generating the appropriate response
- * headers for each set of request headers.</li>
- * </ol>
- * This class references the W3C DOM API rather than the JAX-RPC SOAP API
+ * This class references the W3C DOM API rather than the SAAJ API
* because SOAPElements can usually be converted into DOM Elements very
* easily, but having a DOM Element does not mean that the user code has
- * access to (or wants access to) the JAX-RPC API and its SOAP factories.
+ * access to (or wants access to) the SAAJ API and its SOAP factories.
*
* @author Dan Jemiolo (danj)
*
@@ -370,27 +359,6 @@
/**
*
- * @return The identifier found after the last slash in the wsa:Action
- * URI. If the URI is 'http://example.com/spec/DoStuff', the value
- * that is returned is 'DoStuff'.
- *
- */
- public String getMethodName()
- {
- String actionURI = getAction().toString();
- int lastSlash = actionURI.lastIndexOf('/');
- String name = actionURI.substring(lastSlash + 1);
-
- int request = name.indexOf("Request");
-
- if (request >= 0)
- name = name.substring(0, request);
-
- return Character.toLowerCase(name.charAt(0)) + name.substring(1);
- }
-
- /**
- *
* Parses the given XML to create a valid EPR. The EPR XML root element
* must have the given QName.
*
@@ -413,7 +381,7 @@
return new EndpointReference(epr);
}
-
+
/**
*
* @return The wsa:FaultTo EPR. The method returns null if the value is
@@ -444,6 +412,27 @@
public String getMessageID()
{
return _messageID;
+ }
+
+ /**
+ *
+ * @return The identifier found after the last slash in the wsa:Action
+ * URI. If the URI is 'http://example.com/spec/DoStuff', the value
+ * that is returned is 'DoStuff'.
+ *
+ */
+ public String getMethodName()
+ {
+ String actionURI = getAction().toString();
+ int lastSlash = actionURI.lastIndexOf('/');
+ String name = actionURI.substring(lastSlash + 1);
+
+ int request = name.indexOf("Request");
+
+ if (request >= 0)
+ name = name.substring(0, request);
+
+ return Character.toLowerCase(name.charAt(0)) + name.substring(1);
}
/**
Modified: webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/WsaConstants.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/WsaConstants.java?rev=434142&r1=434141&r2=434142&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/WsaConstants.java (original)
+++ webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/WsaConstants.java Wed Aug 23 12:54:57 2006
@@ -37,21 +37,18 @@
*
*/
public static final String NAMESPACE_URI = "http://www.w3.org/2005/08/addressing";
-
+
public static final String PREFIX = "wsa";
+ /**
+ *
+ * The default URI for WS-A reference parameters.
+ *
+ */
public static final String MUSE_ADDRESSING_URI = "http://ws.apache.org/muse/addressing";
public static final String MUSE_ADDRESSING_PREFIX = "muse-wsa";
- //
- // This is the default identifier used for the implied resource pattern.
- // This is preferred to something like MUWS P1 ResourceId because it is
- // generic to all resource types.
- //
- public static final QName DEFAULT_RESOURCE_ID_QNAME =
- new QName(MUSE_ADDRESSING_URI, "ResourceId", MUSE_ADDRESSING_PREFIX);
-
/**
*
* The URI for anonymous EPRs.
@@ -59,15 +56,31 @@
*/
public static final String ANONYMOUS_URI = NAMESPACE_URI + "/role/anonymous";
+ public static final QName ACTION_QNAME =
+ new QName(NAMESPACE_URI, "Action", PREFIX);
+
+ public static final QName ADDRESS_QNAME =
+ new QName(NAMESPACE_URI, "Address", PREFIX);
+
/**
*
- * The wsa:Action that all fault messages should use.
+ * The anonymous EPR - this can be used for messages going through
+ * firewalls or situations where the source doesn't want to receive
+ * the reply. Because this EPR is the same no matter where it is
+ * being "sent", we can share one instance of it with all components.
*
*/
- public static final String FAULT_URI = NAMESPACE_URI + "/fault";
+ public static final EndpointReference ANONYMOUS_EPR =
+ new EndpointReference(URI.create(ANONYMOUS_URI));
+
+ //
+ // This is the default identifier used for the implied resource pattern.
+ // This is preferred to something like MUWS P1 ResourceId because it is
+ // generic to all resource types.
+ //
+ public static final QName DEFAULT_RESOURCE_ID_QNAME =
+ new QName(MUSE_ADDRESSING_URI, "ResourceId", MUSE_ADDRESSING_PREFIX);
- public static final String REPLY_RELATIONSHIP = PREFIX + ":Reply";
-
/**
*
* The standard EndpointReference QName - note that EPRs are <b>not</b>
@@ -84,28 +97,33 @@
*/
public static final QName EPR_TYPE_QNAME =
new QName(NAMESPACE_URI, "EndpointReferenceType", PREFIX);
-
- public static final QName ACTION_QNAME =
- new QName(NAMESPACE_URI, "Action", PREFIX);
-
- public static final QName ADDRESS_QNAME =
- new QName(NAMESPACE_URI, "Address", PREFIX);
public static final QName FAULT_TO_QNAME =
new QName(NAMESPACE_URI, "FaultTo", PREFIX);
+
+ /**
+ *
+ * The wsa:Action that all fault messages should use.
+ *
+ */
+ public static final String FAULT_URI = NAMESPACE_URI + "/fault";
public static final QName FROM_QNAME =
new QName(NAMESPACE_URI, "From", PREFIX);
+
+ public static final String IS_REFERENCE_PARAMETER = "IsReferenceParameter";
- public static final QName METADATA_QNAME =
- new QName(NAMESPACE_URI, "Metadata", PREFIX);
+ public static final String IS_REFERENCE_PARAMETER_QNAME = "wsa:IsReferenceParameter";
public static final QName MESSAGE_ID_QNAME =
new QName(NAMESPACE_URI, "MessageID", PREFIX);
+ public static final QName METADATA_QNAME =
+ new QName(NAMESPACE_URI, "Metadata", PREFIX);
+
public static final QName PARAMETERS_QNAME =
new QName(NAMESPACE_URI, "ReferenceParameters", PREFIX);
-
+
public static final QName PORT_TYPE_QNAME =
new QName(NAMESPACE_URI, "PortType", PREFIX);
@@ -114,6 +132,8 @@
public static final String RELATIONSHIP_TYPE = "RelationshipType";
+ public static final String REPLY_RELATIONSHIP = PREFIX + ":Reply";
+
public static final QName REPLY_RELATIONSHIP_QNAME =
new QName(NAMESPACE_URI, "Reply", PREFIX);
@@ -122,24 +142,9 @@
public static final QName SERVICE_NAME_QNAME =
new QName(NAMESPACE_URI, "ServiceName", PREFIX);
-
+
public static final String SERVICE_PORT_NAME = "PortName";
public static final QName TO_QNAME =
new QName(NAMESPACE_URI, "To", PREFIX);
-
- public static final String IS_REFERENCE_PARAMETER = "IsReferenceParameter";
-
- public static final String IS_REFERENCE_PARAMETER_QNAME = "wsa:IsReferenceParameter";
-
- /**
- *
- * The anonymous EPR - this can be used for messages going through
- * firewalls or situations where the source doesn't want to receive
- * the reply. Because this EPR is the same no matter where it is
- * being "sent", we can share one instance of it with all components.
- *
- */
- public static final EndpointReference ANONYMOUS_EPR =
- new EndpointReference(URI.create(ANONYMOUS_URI));
}
---------------------------------------------------------------------
To unsubscribe, e-mail: muse-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-commits-help@ws.apache.org