You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2002/08/28 16:51:50 UTC
cvs commit: xml-axis/java/src/org/apache/axis/deployment/wsdd WSDDJAXRPCHandlerInfo.java WSDDJAXRPCHandlerInfoChain.java WSDDConstants.java WSDDService.java
dims 2002/08/28 07:51:50
Modified: java/src/org/apache/axis/client AxisClient.java
java/src/org/apache/axis AxisEngine.java Constants.java
java/src/org/apache/axis/utils axisNLS.properties
java/src/org/apache/axis/configuration
EngineConfigurationFactoryFinder.java
java/src/org/apache/axis/handlers HandlerChainImpl.java
java/src/org/apache/axis/providers/java JavaProvider.java
java/src/org/apache/axis/deployment/wsdd WSDDConstants.java
WSDDService.java
Added: java/src/org/apache/axis/handlers
HandlerInfoChainFactory.java
java/src/org/apache/axis/deployment/wsdd
WSDDJAXRPCHandlerInfo.java
WSDDJAXRPCHandlerInfoChain.java
Log:
Fix for Better "JAX-RPC Handler Support in Axis" from Greg Truty <gt...@us.ibm.com>
See http://marc.theaimsgroup.com/?t=103050265700007&r=1&w=2 for details.
Revision Changes Path
1.53 +43 -0 xml-axis/java/src/org/apache/axis/client/AxisClient.java
Index: AxisClient.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/AxisClient.java,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- AxisClient.java 23 Aug 2002 15:05:14 -0000 1.52
+++ AxisClient.java 28 Aug 2002 14:51:49 -0000 1.53
@@ -67,6 +67,10 @@
import org.apache.axis.components.logger.LogFactory;
import org.apache.commons.logging.Log;
+import javax.xml.namespace.QName;
+import org.apache.axis.handlers.HandlerInfoChainFactory;
+import org.apache.axis.handlers.HandlerChainImpl;
+import org.apache.axis.Constants;
/**
* Provides the equivalent of an "Axis engine" on the client side.
@@ -209,6 +213,45 @@
if (log.isDebugEnabled()) {
log.debug("Exit: AxisClient::invoke");
}
+ }
+
+ protected void invokeJAXRPCHandlers(MessageContext context){
+ Service service
+ = (Service)context.getProperty(Call.WSDL_SERVICE);
+ if(service == null)
+ return;
+
+ QName portName = (QName) context.getProperty(Call.WSDL_PORT_NAME);
+ if(portName == null)
+ return;
+
+ javax.xml.rpc.handler.HandlerRegistry registry = service.getHandlerRegistry();
+ if(registry == null)
+ return;
+
+ java.util.List chain = registry.getHandlerChain(portName);
+
+ if(chain == null || chain.isEmpty())
+ return;
+
+ SOAPService soapService = context.getService();
+ if (soapService != null) {
+ // A client configuration exists for this service. Check to see
+ // if there is a HandlerInfoChain configured upon it.
+ java.util.List cfgChain = (java.util.List) soapService.getOption(Constants.ATTR_HANDLERINFOCHAIN);
+ // GLT - merge this w/an existing chain
+ // for now... use the container version
+ chain = cfgChain;
+ }
+
+ HandlerInfoChainFactory _handlerChainFactory = new HandlerInfoChainFactory(chain);
+ HandlerChainImpl impl = (HandlerChainImpl) _handlerChainFactory.createHandlerChain();
+
+ if(!context.getPastPivot())
+ impl.handleRequest(context);
+ else
+ impl.handleResponse(context);
+ impl.destroy();
}
}
1.95 +1 -29 xml-axis/java/src/org/apache/axis/AxisEngine.java
Index: AxisEngine.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/AxisEngine.java,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -r1.94 -r1.95
--- AxisEngine.java 23 Aug 2002 01:06:50 -0000 1.94
+++ AxisEngine.java 28 Aug 2002 14:51:49 -0000 1.95
@@ -418,33 +418,5 @@
public ClassCache getClassCache() {
return classCache;
}
-
- protected void invokeJAXRPCHandlers(MessageContext context){
- Service service
- = (Service)context.getProperty(Call.WSDL_SERVICE);
- if(service == null)
- return;
-
- QName portName = (QName) context.getProperty(Call.WSDL_PORT_NAME);
- if(portName == null)
- return;
-
- javax.xml.rpc.handler.HandlerRegistry registry = service.getHandlerRegistry();
- if(registry == null)
- return;
-
- java.util.List chain = registry.getHandlerChain(portName);
-
- if(chain == null || chain.isEmpty())
- return;
-
- HandlerChainImpl impl
- = new HandlerChainImpl(chain);
-
- if(!context.getPastPivot())
- impl.handleRequest(context);
- else
- impl.handleResponse(context);
- impl.destroy();
- }
+
}
1.86 +1 -0 xml-axis/java/src/org/apache/axis/Constants.java
Index: Constants.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/Constants.java,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -r1.85 -r1.86
--- Constants.java 24 Aug 2002 18:18:17 -0000 1.85
+++ Constants.java 28 Aug 2002 14:51:49 -0000 1.86
@@ -418,6 +418,7 @@
public static final String ATTR_OFFSET = "offset";
public static final String ATTR_POSITION = "position";
public static final String ATTR_TYPE = "type";
+ public static final String ATTR_HANDLERINFOCHAIN = "handlerInfoChain";
// Fault Codes
//////////////////////////////////////////////////////////////////////////
1.55 +4 -0 xml-axis/java/src/org/apache/axis/utils/axisNLS.properties
Index: axisNLS.properties
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/axisNLS.properties,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -r1.54 -r1.55
--- axisNLS.properties 28 Aug 2002 03:15:11 -0000 1.54
+++ axisNLS.properties 28 Aug 2002 14:51:49 -0000 1.55
@@ -1000,6 +1000,10 @@
noServiceClass=No service class was found! Are you missing a className option?
jpegOnly=Cannot handle {0}, can only handle JPEG image types.
+engineFactory=Got EngineFactory: {0}
engineConfigMissingNewFactory=Factory {0} Ignored: missing required method: {1}.
engineConfigInvokeNewFactory=Factory {0} Ignored: invoke method failed: {1}.
engineConfigFactoryMissing=Unable to locate a valid EngineConfigurationFactory
+
+noClassNameAttr00=classname attribute is missing.
+noValidHeader=qname attribute is missing.
\ No newline at end of file
1.4 +15 -15 xml-axis/java/src/org/apache/axis/configuration/EngineConfigurationFactoryFinder.java
Index: EngineConfigurationFactoryFinder.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/configuration/EngineConfigurationFactoryFinder.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- EngineConfigurationFactoryFinder.java 28 Aug 2002 03:15:11 -0000 1.3
+++ EngineConfigurationFactoryFinder.java 28 Aug 2002 14:51:49 -0000 1.4
@@ -91,7 +91,7 @@
private static final Class[] newFactoryParamTypes =
new Class[] { Object.class };
-
+
private static final String requiredMethod =
"public static EngineConfigurationFactory newFactory(Object)";
@@ -102,9 +102,9 @@
/**
* Create the default engine configuration and detect whether the user
* has overridden this with their own.
- *
+ *
* The discovery mechanism will use the following logic:
- *
+ *
* - discover all available EngineConfigurationFactories
* - find all META-INF/services/org.apache.axis.EngineConfigurationFactory
* files available through class loaders.
@@ -119,13 +119,13 @@
* - Try EngineConfigurationFactoryServlet.newFactory(obj)
* - Try EngineConfigurationFactoryDefault.newFactory(obj)
* - If zero found (all return null), throw exception
- *
+ *
* ***
* This needs more work: System.properties, etc.
* Discovery will have more tools to help with that
* (in the manner of use below) in the near future.
* ***
- *
+ *
*/
public static EngineConfigurationFactory newFactory(Object obj) {
/**
@@ -141,14 +141,14 @@
* Find and examine each service
*/
EngineConfigurationFactory factory = null;
-
+
Enumeration services = sd.find(mySpi.getName());
while (factory == null && services.hasMoreElements()) {
Class service = ((ClassInfo)services.nextElement()).getResourceClass();
-
+
factory = newFactory(service, newFactoryParamTypes, params);
}
-
+
if (factory == null) {
try {
factory = EngineConfigurationFactoryServlet.newFactory(obj);
@@ -157,7 +157,7 @@
EngineConfigurationFactoryServlet.class.getName(),
requiredMethod), e);
}
-
+
if (factory == null) {
try {
// should NEVER return null.
@@ -169,12 +169,12 @@
}
}
}
-
+
if (factory != null) {
- log.debug("Got EngineFactory: " + factory.getClass().getName());
+ log.debug(JavaUtils.getMessage("engineFactory", factory.getClass().getName()));
} else {
String msg = JavaUtils.getMessage("engineConfigFactoryMissing");
- log.error(msg);
+ log.error(JavaUtils.getMessage("error01", msg));
// we should be throwing an exception here,
//
// but again, requires more refactoring than we want to swallow
@@ -183,7 +183,7 @@
// Testing will find this, as NullPointerExceptions will be generated
// elsewhere.
}
-
+
return factory;
}
@@ -204,7 +204,7 @@
"newFactory",
paramTypes);
-
+
if (method == null) {
log.warn(JavaUtils.getMessage("engineConfigMissingNewFactory",
service.getName(),
@@ -218,7 +218,7 @@
requiredMethod), e);
}
}
-
+
return null;
}
}
1.3 +16 -1 xml-axis/java/src/org/apache/axis/handlers/HandlerChainImpl.java
Index: HandlerChainImpl.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/handlers/HandlerChainImpl.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- HandlerChainImpl.java 24 Jul 2002 17:50:21 -0000 1.2
+++ HandlerChainImpl.java 28 Aug 2002 14:51:49 -0000 1.3
@@ -68,7 +68,22 @@
import java.util.List;
import java.util.Map;
-public class HandlerChainImpl extends ArrayList {
+public class HandlerChainImpl extends ArrayList implements javax.xml.rpc.handler.HandlerChain {
+
+ private String[] _roles;
+
+ public String[] getRoles() {
+ return _roles;
+ }
+
+ public void setRoles(String[] roles) {
+ _roles = roles;
+ }
+
+ public void init(Map map) {
+ // DO SOMETHING WITH THIS
+ }
+
protected List handlerInfos = new ArrayList();
String[] roles = null;
1.1 xml-axis/java/src/org/apache/axis/handlers/HandlerInfoChainFactory.java
Index: HandlerInfoChainFactory.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Axis" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.axis.handlers;
import javax.xml.rpc.handler.HandlerChain;
import javax.xml.rpc.handler.HandlerInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class HandlerInfoChainFactory {
protected List handlerInfos = new ArrayList();
protected String[] _roles = null;
public HandlerInfoChainFactory() {
}
public HandlerInfoChainFactory(List handlerInfos) {
this.handlerInfos = handlerInfos;
}
public HandlerInfo getHandlerInfo(int index) {
return (HandlerInfo) handlerInfos.get(index);
}
public HandlerChain createHandlerChain() {
HandlerChain hc = new HandlerChainImpl(handlerInfos);
return hc;
}
public String[] getRoles() {
return _roles;
}
public void setRoles(String[] roles) {
_roles = roles;
}
public void init(Map map) {
// DO SOMETHING WITH THIS
}
}
1.74 +14 -0 xml-axis/java/src/org/apache/axis/providers/java/JavaProvider.java
Index: JavaProvider.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/providers/java/JavaProvider.java,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -r1.73 -r1.74
--- JavaProvider.java 23 Aug 2002 15:08:55 -0000 1.73
+++ JavaProvider.java 28 Aug 2002 14:51:49 -0000 1.74
@@ -77,6 +77,9 @@
import org.apache.axis.components.logger.LogFactory;
import org.apache.commons.logging.Log;
+import org.apache.axis.handlers.HandlerChainImpl;
+import org.apache.axis.handlers.HandlerInfoChainFactory;
+
import org.w3c.dom.Document;
import javax.xml.rpc.server.ServiceLifecycle;
@@ -265,6 +268,11 @@
msgContext.setResponseMessage( resMsg );
}
+ HandlerInfoChainFactory handlerFactory = (HandlerInfoChainFactory) service.getOption(Constants.ATTR_HANDLERINFOCHAIN);
+ HandlerChainImpl handlerImpl = null;
+ if (handlerFactory != null) handlerImpl = (HandlerChainImpl) handlerFactory.createHandlerChain();
+ if (handlerImpl != null) handlerImpl.handleRequest(msgContext);
+
try {
processMessage(msgContext, reqEnv,
resEnv, obj);
@@ -278,6 +286,12 @@
((ServiceLifecycle)obj).destroy();
}
}
+
+ if ( handlerImpl != null) {
+ handlerImpl.handleResponse(msgContext);
+ handlerImpl.destroy();
+ }
+
}
catch( Exception exp ) {
entLog.debug( JavaUtils.getMessage("toAxisFault00"), exp);
1.22 +9 -0 xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDConstants.java
Index: WSDDConstants.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDConstants.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- WSDDConstants.java 25 Aug 2002 14:00:02 -0000 1.21
+++ WSDDConstants.java 28 Aug 2002 14:51:49 -0000 1.22
@@ -128,6 +128,10 @@
public static final String ELEM_WSDD_WSDLFILE = "wsdlFile";
public static final String ELEM_WSDD_NAMESPACE = "namespace";
public static final String ELEM_WSDD_ENDPOINTURL = "endpointURL";
+ public static final String ELEM_WSDD_JAXRPC_HANDLERINFO = "handlerInfo";
+ public static final String ELEM_WSDD_JAXRPC_CHAIN = "handlerInfoChain";
+ public static final String ELEM_WSDD_JAXRPC_ROLE = "role";
+ public static final String ELEM_WSDD_JAXRPC_HEADER = "header";
public static final QName QNAME_PARAM = new QName(URI_WSDD, ELEM_WSDD_PARAM);
public static final QName QNAME_DOC = new QName(URI_WSDD, ELEM_WSDD_DOC);
@@ -148,6 +152,9 @@
public static final QName QNAME_WSDLFILE = new QName(URI_WSDD, ELEM_WSDD_WSDLFILE);
public static final QName QNAME_NAMESPACE = new QName(URI_WSDD, ELEM_WSDD_NAMESPACE);
public static final QName QNAME_ENDPOINTURL = new QName(URI_WSDD, ELEM_WSDD_ENDPOINTURL);
+ public static final QName QNAME_JAXRPC_HANDLERINFO = new QName(URI_WSDD, ELEM_WSDD_JAXRPC_HANDLERINFO);
+ public static final QName QNAME_JAXRPC_HANDLERINFOCHAIN = new QName(URI_WSDD, ELEM_WSDD_JAXRPC_CHAIN);
+ public static final QName QNAME_JAXRPC_HEADER = new QName(URI_WSDD, ELEM_WSDD_JAXRPC_HEADER);
public static final String ATTR_LANG_SPEC_TYPE = "languageSpecificType";
public static final String ATTR_QNAME = "qname";
@@ -166,4 +173,6 @@
public static final String ATTR_SERIALIZER = "serializer";
public static final String ATTR_DESERIALIZER = "deserializer";
public static final String ATTR_ENCSTYLE = "encodingStyle";
+ public static final String ATTR_SOAPACTORNAME = "soapActorName";
+ public static final String ATTR_CLASSNAME = "classname";
}
1.83 +16 -0 xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java
Index: WSDDService.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -r1.82 -r1.83
--- WSDDService.java 26 Aug 2002 15:00:46 -0000 1.82
+++ WSDDService.java 28 Aug 2002 14:51:50 -0000 1.83
@@ -79,6 +79,8 @@
import org.apache.axis.utils.XMLUtils;
import org.w3c.dom.Element;
import org.xml.sax.helpers.AttributesImpl;
+import org.apache.axis.handlers.HandlerInfoChainFactory;
+import org.apache.axis.Constants;
import javax.xml.namespace.QName;
import java.io.IOException;
@@ -117,6 +119,8 @@
*/
private QName providerQName;
+ private HandlerInfoChainFactory _hiChainFactory;
+
ServiceDesc desc = new ServiceDesc();
/**
@@ -217,6 +221,13 @@
}
}
+ // Add in JAX-RPC support for HandlerInfo chains
+ Element hcEl = getChildElement(e, ELEM_WSDD_JAXRPC_CHAIN);
+ if (hcEl != null) {
+ WSDDJAXRPCHandlerInfoChain wsddHIChain = new WSDDJAXRPCHandlerInfoChain(hcEl);
+ _hiChainFactory = wsddHIChain.getHandlerChainFactory();
+ }
+
initTMR();
// call to validate standard descriptors for this service
@@ -411,6 +422,11 @@
service.setOption(AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
service.setOption(AxisEngine.PROP_SEND_XSI, Boolean.FALSE);
}
+
+ // Set handlerInfoChain
+ if (_hiChainFactory != null) {
+ service.setOption(Constants.ATTR_HANDLERINFOCHAIN, _hiChainFactory);
+ }
AxisEngine.normaliseOptions(service);
1.1 xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDJAXRPCHandlerInfo.java
Index: WSDDJAXRPCHandlerInfo.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Axis" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.axis.deployment.wsdd;
import org.apache.axis.encoding.SerializationContext;
import org.apache.axis.utils.JavaUtils;
import org.apache.axis.utils.XMLUtils;
import org.w3c.dom.Element;
import org.xml.sax.helpers.AttributesImpl;
import javax.xml.namespace.QName;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
/**
*
*/
public class WSDDJAXRPCHandlerInfo
extends WSDDDeployableItem
{
private String _classname;
private QName[] _headers;
private Map _map;
/**
* Default constructor
*/
public WSDDJAXRPCHandlerInfo()
{
}
/**
*
* @param e (Element) XXX
* @throws WSDDException XXX
*/
public WSDDJAXRPCHandlerInfo(Element e)
throws WSDDException
{
super(e);
String classnameStr = e.getAttribute(ATTR_CLASSNAME);
if (classnameStr != null && !classnameStr.equals("")) {
_classname = classnameStr;
}
else
throw new WSDDException(JavaUtils.getMessage("noClassNameAttr00"));
Element[] elements = getChildElements(e, ELEM_WSDD_PARAM);
if (elements.length != 0) {
_map = new HashMap();
// Load up the map
for (int i = 0; i < elements.length; i++) {
Element param = elements[i];
String pname = param.getAttribute(ATTR_NAME);
String value = param.getAttribute(ATTR_VALUE);
parameters.put(pname, value);
}
}
elements = getChildElements(e, ELEM_WSDD_JAXRPC_HEADER);
if (elements.length != 0) {
java.util.ArrayList headerList = new java.util.ArrayList();
for (int i = 0; i < elements.length; i++) {
Element qElem = elements[i];
String headerStr = qElem.getAttribute(ATTR_QNAME);
if (headerStr == null || headerStr.equals(""))
throw new WSDDException(JavaUtils.getMessage("noValidHeader"));
QName headerQName = XMLUtils.getQNameFromString(headerStr, e);
headerList.add(headerQName);
}
QName[] headers = new QName[headerList.size()];
_headers = (QName[]) headerList.toArray(headers);
}
}
protected QName getElementName()
{
return QNAME_JAXRPC_HANDLERINFO;
}
public String getHandlerClassName() {
return _classname;
}
public void setHandlerClassName(String classname) {
_classname = classname;
}
public Map getHandlerMap() {
return _map;
}
public void setHandlerMap(Map map) {
_map = map;
}
public QName[] getHeaders() {
return _headers;
}
public void setHeaders(QName[] headers) {
_headers = headers;
}
public void writeToContext(SerializationContext context)
throws IOException
{
// GLT - FIX THIS UP
AttributesImpl attrs = new AttributesImpl();
QName name = getQName();
if (name != null) {
attrs.addAttribute("", ATTR_NAME, ATTR_NAME,
"CDATA", context.qName2String(name));
}
attrs.addAttribute("", ATTR_TYPE, ATTR_TYPE,
"CDATA", context.qName2String(getType()));
context.startElement(WSDDConstants.QNAME_HANDLER, attrs);
writeParamsToContext(context);
context.endElement();
}
}
1.1 xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDJAXRPCHandlerInfoChain.java
Index: WSDDJAXRPCHandlerInfoChain.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Axis" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.axis.deployment.wsdd;
import org.apache.axis.handlers.HandlerInfoChainFactory;
import org.apache.axis.utils.ClassUtils;
import org.w3c.dom.Element;
import javax.xml.namespace.QName;
import javax.xml.rpc.handler.HandlerInfo;
import java.util.ArrayList;
import java.util.Map;
/**
*
*/
public class WSDDJAXRPCHandlerInfoChain extends WSDDHandler {
private HandlerInfoChainFactory _hiChainFactory;
private String[] _roles;
/**
* Default constructor
*/
public WSDDJAXRPCHandlerInfoChain() {
}
/**
*
* @param e (Element) XXX
* @throws WSDDException XXX
*/
public WSDDJAXRPCHandlerInfoChain(Element e) throws WSDDException {
super(e);
ArrayList infoList = new ArrayList();
Element[] elements = getChildElements(e, ELEM_WSDD_JAXRPC_HANDLERINFO);
if (elements.length != 0) {
for (int i = 0; i < elements.length; i++) {
WSDDJAXRPCHandlerInfo handlerInfo =
new WSDDJAXRPCHandlerInfo(elements[i]);
String handlerClassName = handlerInfo.getHandlerClassName();
Class handlerClass = null;
try {
handlerClass = ClassUtils.forName(handlerClassName);
} catch (ClassNotFoundException cnf) {
// GLT - do something here
}
Map handlerMap = handlerInfo.getHandlerMap();
QName[] headers = handlerInfo.getHeaders();
if (handlerClass != null) {
HandlerInfo hi =
new HandlerInfo(handlerClass, handlerMap, headers);
infoList.add(hi);
}
}
}
_hiChainFactory = new HandlerInfoChainFactory(infoList);
elements = getChildElements(e, ELEM_WSDD_JAXRPC_ROLE);
if (elements.length != 0) {
ArrayList roleList = new ArrayList();
for (int i = 0; i < elements.length; i++) {
String role = elements[i].getAttribute( ATTR_SOAPACTORNAME);
roleList.add(role);
}
String [] roles =new String[roleList.size()];
roles = (String[]) roleList.toArray(roles);
_hiChainFactory.setRoles(roles);
}
}
public HandlerInfoChainFactory getHandlerChainFactory() {
return _hiChainFactory;
}
public void setHandlerChainFactory(HandlerInfoChainFactory handlerInfoChainFactory) {
_hiChainFactory = handlerInfoChainFactory;
}
protected QName getElementName() {
return WSDDConstants.QNAME_JAXRPC_HANDLERINFOCHAIN;
}
}