dims 2002/12/05 07:02:53
Modified: java/src/org/apache/axis/providers/java RPCProvider.java
java/src/org/apache/axis/deployment/wsdd WSDDConstants.java
WSDDProvider.java
Added: java/src/org/apache/axis/providers/java RMIProvider.java
java/src/org/apache/axis/deployment/wsdd/providers
WSDDJavaRMIProvider.java
Log:
RMI Provider (using JRMP) - Initial commit.
Revision Changes Path
1.99 +50 -55
xml-axis/java/src/org/apache/axis/providers/java/RPCProvider.java
Index: RPCProvider.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/providers/java/RPCProvider.java,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -r1.98 -r1.99
--- RPCProvider.java 15 Oct 2002 21:15:42 -0000 1.98
+++ RPCProvider.java 5 Dec 2002 15:02:52 -0000 1.99
@@ -53,7 +53,7 @@
* <http://www.apache.org/>.
*/
-package org.apache.axis.providers.java ;
+package org.apache.axis.providers.java;
import org.apache.axis.AxisFault;
import org.apache.axis.Constants;
@@ -95,12 +95,11 @@
*
* @author Doug Davis ([EMAIL PROTECTED])
*/
-public class RPCProvider extends JavaProvider
-{
+public class RPCProvider extends JavaProvider {
protected static Log log =
- LogFactory.getLog(RPCProvider.class.getName());
+ LogFactory.getLog(RPCProvider.class.getName());
- /**
+ /**
* Process the current message.
* Result in resEnv.
*
@@ -109,12 +108,11 @@
* @param resEnv the response envelope
* @param obj the service object itself
*/
- public void processMessage (MessageContext msgContext,
- SOAPEnvelope reqEnv,
- SOAPEnvelope resEnv,
- Object obj)
- throws Exception
- {
+ public void processMessage(MessageContext msgContext,
+ SOAPEnvelope reqEnv,
+ SOAPEnvelope resEnv,
+ Object obj)
+ throws Exception {
if (log.isDebugEnabled()) {
log.debug("Enter: RPCProvider.processMessage()");
}
@@ -123,43 +121,43 @@
ServiceDesc serviceDesc = service.getServiceDescription();
OperationDesc operation = msgContext.getOperation();
- Vector bodies = reqEnv.getBodyElements();
+ Vector bodies = reqEnv.getBodyElements();
if (log.isDebugEnabled()) {
log.debug(Messages.getMessage("bodyElems00", "" + bodies.size()));
log.debug(Messages.getMessage("bodyIs00", "" + bodies.get(0)));
}
- RPCElement body = null;
+ RPCElement body = null;
// Find the first "root" body element, which is the RPC call.
- for ( int bNum = 0 ; body == null && bNum < bodies.size() ; bNum++ ) {
+ for (int bNum = 0; body == null && bNum < bodies.size(); bNum++) {
// If this is a regular old SOAPBodyElement, and it's a root,
// we're probably a non-wrapped doc/lit service. In this case,
// we deserialize the element, and create an RPCElement "wrapper"
// around it which points to the correct method.
// FIXME : There should be a cleaner way to do this...
if (!(bodies.get(bNum) instanceof RPCElement)) {
- SOAPBodyElement bodyEl = (SOAPBodyElement)bodies.get(bNum);
+ SOAPBodyElement bodyEl = (SOAPBodyElement) bodies.get(bNum);
// igors: better check if bodyEl.getID() != null
// to make sure this loop does not step on SOAP-ENC objects
// that follow the parameters! FIXME?
if (bodyEl.isRoot() && operation != null && bodyEl.getID() == null)
{
ParameterDesc param = operation.getParameter(bNum);
// at least do not step on non-existent parameters!
- if(param != null) {
+ if (param != null) {
Object val = bodyEl.getValueAsType(param.getTypeQName());
body = new RPCElement("",
- operation.getName(),
- new Object [] { val });
+ operation.getName(),
+ new Object[]{val});
}
}
} else {
- body = (RPCElement) bodies.get( bNum );
+ body = (RPCElement) bodies.get(bNum);
}
}
- // special case code for a document style operation with no
- // arguments (which is a strange thing to have, but whatever)
+ // special case code for a document style operation with no
+ // arguments (which is a strange thing to have, but whatever)
if (body == null) {
// throw an error if this isn't a document style service
if (!(serviceDesc.getStyle().equals(Style.DOCUMENT))) {
@@ -197,18 +195,18 @@
if (operation == null) {
QName qname = new QName(body.getNamespaceURI(),
- body.getName());
+ body.getName());
operation = serviceDesc.getOperationByElementQName(qname);
}
if (operation == null) {
throw new AxisFault(Messages.getMessage("noSuchOperation",
- methodName));
+ methodName));
}
// Create the array we'll use to hold the actual parameter
// values. We know how big to make it from the metadata.
- Object[] argValues = new Object [operation.getNumParams()];
+ Object[] argValues = new Object[operation.getNumParams()];
// A place to keep track of the out params (INOUTs and OUTs)
ArrayList outs = new ArrayList();
@@ -218,8 +216,8 @@
// Make sure we respect parameter ordering if we know about it
// from metadata, and handle whatever conversions are necessary
// (values -> Holders, etc)
- for ( int i = 0 ; i < numArgs ; i++ ) {
- RPCParam rpcParam = (RPCParam)args.get(i);
+ for (int i = 0; i < numArgs; i++) {
+ RPCParam rpcParam = (RPCParam) args.get(i);
Object value = rpcParam.getValue();
// first check the type on the paramter
@@ -235,7 +233,7 @@
// Convert the value into the expected type in the signature
value = JavaUtils.convert(value,
- sigType);
+ sigType);
rpcParam.setValue(value);
if (paramDesc.getMode() == ParameterDesc.INOUT) {
@@ -246,43 +244,43 @@
// Put the value (possibly converted) in the argument array
// make sure to use the parameter order if we have it
if (paramDesc == null || paramDesc.getOrder() == -1) {
- argValues[i] = value;
+ argValues[i] = value;
} else {
argValues[paramDesc.getOrder()] = value;
}
if (log.isDebugEnabled()) {
log.debug(" " + Messages.getMessage("value00",
- "" + argValues[i]) );
+ "" + argValues[i]));
}
}
// See if any subclasses want a crack at faulting on a bad operation
// FIXME : Does this make sense here???
- String allowedMethods = (String)service.getOption("allowedMethods");
+ String allowedMethods = (String) service.getOption("allowedMethods");
checkMethodName(msgContext, allowedMethods, operation.getName());
- // Now create any out holders we need to pass in
+ // Now create any out holders we need to pass in
if (numArgs < argValues.length) {
ArrayList outParams = operation.getOutParams();
for (int i = 0; i < outParams.size(); i++) {
- ParameterDesc param = (ParameterDesc)outParams.get(i);
+ ParameterDesc param = (ParameterDesc) outParams.get(i);
Class holderClass = param.getJavaType();
if (holderClass != null &&
- Holder.class.isAssignableFrom(holderClass)) {
+ Holder.class.isAssignableFrom(holderClass)) {
argValues[numArgs + i] = holderClass.newInstance();
// Store an RPCParam in the outs collection so we
// have an easy and consistent way to write these
// back to the client below
RPCParam p = new RPCParam(param.getQName(),
- argValues[numArgs + i]);
+ argValues[numArgs + i]);
p.setParamDesc(param);
outs.add(p);
} else {
throw new AxisFault(Messages.getMessage("badOutParameter00",
- "" + param.getQName(),
- operation.getName()));
+ "" + param.getQName(),
+ operation.getName()));
}
}
}
@@ -291,39 +289,39 @@
Object objRes = null;
try {
objRes = invokeMethod(msgContext,
- operation.getMethod(),
- obj, argValues);
+ operation.getMethod(),
+ obj, argValues);
} catch (IllegalArgumentException e) {
String methodSig = operation.getMethod().toString();
String argClasses = "";
- for (int i=0; i < argValues.length; i++) {
+ for (int i = 0; i < argValues.length; i++) {
if (argValues[i] == null) {
argClasses += "null";
} else {
argClasses += argValues[i].getClass().getName();
}
- if (i+1 < argValues.length) {
+ if (i + 1 < argValues.length) {
argClasses += ",";
}
}
log.info(Messages.getMessage("dispatchIAE00",
- new String[] {methodSig, argClasses}),
- e);
+ new String[]{methodSig, argClasses}),
+ e);
throw new AxisFault(Messages.getMessage("dispatchIAE00",
- new String[] {methodSig, argClasses}),
- e);
+ new String[]{methodSig, argClasses}),
+ e);
}
/* Now put the result in the result SOAPEnvelope */
/*************************************************/
RPCElement resBody = new RPCElement(methodName + "Response");
- resBody.setPrefix( body.getPrefix() );
- resBody.setNamespaceURI( body.getNamespaceURI() );
+ resBody.setPrefix(body.getPrefix());
+ resBody.setNamespaceURI(body.getNamespaceURI());
resBody.setEncodingStyle(msgContext.getEncodingStyle());
try {
// Return first
- if ( operation.getMethod().getReturnType() != Void.TYPE ) {
+ if (operation.getMethod().getReturnType() != Void.TYPE) {
QName returnQName = operation.getReturnQName();
if (returnQName == null) {
returnQName = new QName("", methodName + "Return");
@@ -331,8 +329,7 @@
// For SOAP 1.2, add a result
if (msgContext.getSOAPConstants() ==
- SOAPConstants.SOAP12_CONSTANTS)
- {
+ SOAPConstants.SOAP12_CONSTANTS) {
returnQName = Constants.QNAME_RPC_RESULT;
}
@@ -340,7 +337,7 @@
param.setParamDesc(operation.getReturnParamDesc());
if (!operation.isReturnHeader()) {
resBody.addParam(param);
- } else {
+ } else {
resEnv.addHeader(new RPCHeaderParam(param));
}
@@ -351,7 +348,7 @@
for (Iterator i = outs.iterator(); i.hasNext();) {
// We know this has a holder, so just unwrap the value
RPCParam param = (RPCParam) i.next();
- Holder holder = (Holder)param.getValue();
+ Holder holder = (Holder) param.getValue();
Object value = JavaUtils.getHolderValue(holder);
ParameterDesc paramDesc = param.getParamDesc();
@@ -380,8 +377,7 @@
protected Object invokeMethod(MessageContext msgContext,
Method method, Object obj,
Object[] argValues)
- throws Exception
- {
+ throws Exception {
return (method.invoke(obj, argValues));
}
@@ -394,8 +390,7 @@
protected void checkMethodName(MessageContext msgContext,
String allowedMethods,
String methodName)
- throws Exception
- {
+ throws Exception {
// Our version doesn't need to do anything, though inherited
// ones might.
}
1.1
xml-axis/java/src/org/apache/axis/providers/java/RMIProvider.java
Index: RMIProvider.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 [EMAIL PROTECTED]
*
* 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.providers.java;
import org.apache.axis.Constants;
import org.apache.axis.Handler;
import org.apache.axis.MessageContext;
import org.apache.axis.components.logger.LogFactory;
import org.apache.commons.logging.Log;
import java.rmi.Naming;
import java.rmi.RMISecurityManager;
/**
* A basic RMI Provider
*
* @author Davanum Srinivas ([EMAIL PROTECTED])
*/
public class RMIProvider extends RPCProvider {
protected static Log log =
LogFactory.getLog(RMIProvider.class.getName());
// The enterprise category is for stuff that an enterprise product might
// want to track, but in a simple environment (like the AXIS build) would
// be nothing more than a nuisance.
protected static Log entLog =
LogFactory.getLog(Constants.ENTERPRISE_LOG_CATEGORY);
public static final String OPTION_NAMING_LOOKUP = "NamingLookup";
public static final String OPTION_INTERFACE_CLASSNAME = "InterfaceClassName";
/**
* Return a object which implements the service.
*
* @param msgContext the message context
* @param clsName The JNDI name of the EJB home class
* @return an object that implements the service
*/
protected Object makeNewServiceObject(MessageContext msgContext,
String clsName)
throws Exception {
// Read deployment descriptor options
String namingLookup = getStrOption(OPTION_NAMING_LOOKUP,
msgContext.getService());
if (System.getSecurityManager() == null) {
System.setSecurityManager(new RMISecurityManager());
}
Object targetObject = Naming.lookup(namingLookup);
return targetObject;
}
/**
* Return the option in the configuration that contains the service class
* name.
*/
protected String getServiceClassNameOptionName() {
return OPTION_INTERFACE_CLASSNAME;
}
/**
* Get a String option by looking first in the service options,
* and then at the Handler's options. This allows defaults to be
* specified at the provider level, and then overriden for particular
* services.
*
* @param optionName the option to retrieve
* @return String the value of the option or null if not found in
* either scope
*/
protected String getStrOption(String optionName, Handler service) {
String value = null;
if (service != null)
value = (String) service.getOption(optionName);
if (value == null)
value = (String) getOption(optionName);
return value;
}
}
1.28 +2 -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.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- WSDDConstants.java 18 Nov 2002 21:07:31 -0000 1.27
+++ WSDDConstants.java 5 Dec 2002 15:02:53 -0000 1.28
@@ -106,12 +106,14 @@
public static final String PROVIDER_COM = "COM";
public static final String PROVIDER_BSF = "BSF";
public static final String PROVIDER_CORBA = "CORBA";
+ public static final String PROVIDER_RMI = "RMI";
public static final QName QNAME_JAVARPC_PROVIDER = new QName(URI_WSDD_JAVA,
PROVIDER_RPC);
public static final QName QNAME_JAVAMSG_PROVIDER = new QName(URI_WSDD_JAVA,
PROVIDER_MSG);
public static final QName QNAME_HANDLER_PROVIDER = new QName("",
PROVIDER_HANDLER);
public static final QName QNAME_EJB_PROVIDER = new QName(URI_WSDD_JAVA,
PROVIDER_EJB);
public static final QName QNAME_CORBA_PROVIDER = new QName(URI_WSDD_JAVA,
PROVIDER_CORBA);
+ public static final QName QNAME_RMI_PROVIDER = new QName(URI_WSDD_JAVA,
PROVIDER_RMI);
public static final String ELEM_WSDD_PARAM = "parameter";
public static final String ELEM_WSDD_DOC = "documentation";
1.26 +2 -0
xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDProvider.java
Index: WSDDProvider.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDProvider.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- WSDDProvider.java 18 Nov 2002 21:07:31 -0000 1.25
+++ WSDDProvider.java 5 Dec 2002 15:02:53 -0000 1.26
@@ -62,6 +62,7 @@
import org.apache.axis.deployment.wsdd.providers.WSDDJavaMsgProvider;
import org.apache.axis.deployment.wsdd.providers.WSDDJavaRPCProvider;
import org.apache.axis.deployment.wsdd.providers.WSDDJavaCORBAProvider;
+import org.apache.axis.deployment.wsdd.providers.WSDDJavaRMIProvider;
import org.apache.axis.utils.JavaUtils;
import org.apache.axis.utils.Messages;
@@ -104,6 +105,7 @@
providers.put(WSDDConstants.QNAME_HANDLER_PROVIDER, new
WSDDHandlerProvider());
providers.put(WSDDConstants.QNAME_EJB_PROVIDER, new WSDDJavaEJBProvider());
providers.put(WSDDConstants.QNAME_CORBA_PROVIDER, new
WSDDJavaCORBAProvider());
+ providers.put(WSDDConstants.QNAME_RMI_PROVIDER, new WSDDJavaRMIProvider());
try {
loadPluggableProviders();
} catch (Throwable t){
1.1
xml-axis/java/src/org/apache/axis/deployment/wsdd/providers/WSDDJavaRMIProvider.java
Index: WSDDJavaRMIProvider.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 [EMAIL PROTECTED]
*
* 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.providers;
import org.apache.axis.EngineConfiguration;
import org.apache.axis.Handler;
import org.apache.axis.deployment.wsdd.WSDDProvider;
import org.apache.axis.deployment.wsdd.WSDDService;
import org.apache.axis.deployment.wsdd.WSDDConstants;
/**
* A WSDD RMI provider
*
* @author Davanum Srinivas ([EMAIL PROTECTED])
*/
public class WSDDJavaRMIProvider
extends WSDDProvider
{
public String getName() {
return WSDDConstants.PROVIDER_RMI;
}
/**
*
*/
public Handler newProviderInstance(WSDDService service,
EngineConfiguration registry)
throws Exception
{
return new org.apache.axis.providers.java.RMIProvider();
}
}