User: peterbraswell
Date: 02/04/11 19:32:53
Modified: jboss.net/src/main/org/jboss/net/jmx/server Constants.java
MBeanProvider.java
Log:
added support for MBean->WSDL generation. Need yet to add WSDL generation for
MBean attributes.
Revision Changes Path
1.3 +5 -3
contrib/jboss.net/src/main/org/jboss/net/jmx/server/Constants.java
Index: Constants.java
===================================================================
RCS file:
/cvsroot/jboss/contrib/jboss.net/src/main/org/jboss/net/jmx/server/Constants.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Constants.java 3 Apr 2002 16:11:21 -0000 1.2
+++ Constants.java 12 Apr 2002 02:32:52 -0000 1.3
@@ -5,7 +5,7 @@
* See terms of license at gnu.org.
*/
-// $Id: Constants.java,v 1.2 2002/04/03 16:11:21 cgjung Exp $
+// $Id: Constants.java,v 1.3 2002/04/12 02:32:52 peterbraswell Exp $
package org.jboss.net.jmx.server;
@@ -15,7 +15,7 @@
* Some Constants for the jmx server package
* @author <a href="mailto:[EMAIL PROTECTED]">Christoph G. Jung</a>
* @created 1. October 2001
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public interface Constants {
@@ -35,7 +35,9 @@
static final String NO_SUCH_ATTRIBUTE = "Could not find MBean attribute.";
static final String INVALID_ARGUMENT = "Invalid Argument.";
static final String MBEAN_EXCEPTION = "Problems while interfacing JMX.";
+ static final String BEAN_INFO_IS_NULL = "MBeanInfo is null, could not aquire
MBean Meta Data!";
static final String EXCEPTION_OCCURED =
"Exception occurred in the target MBean method.";
- static final String INTROSPECTION_EXCEPTION="Could not introspect mbean.";
+ static final String COULDNT_GEN_WSDL = "Could not generate WSDL document";
+ static final String INTROSPECTION_EXCEPTION="Could not introspect mbean.";
}
1.6 +483 -274
contrib/jboss.net/src/main/org/jboss/net/jmx/server/MBeanProvider.java
Index: MBeanProvider.java
===================================================================
RCS file:
/cvsroot/jboss/contrib/jboss.net/src/main/org/jboss/net/jmx/server/MBeanProvider.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- MBeanProvider.java 10 Apr 2002 02:38:58 -0000 1.5
+++ MBeanProvider.java 12 Apr 2002 02:32:52 -0000 1.6
@@ -1,274 +1,483 @@
-/*
- * JBoss, the OpenSource J2EE webOS
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-
-// $Id: MBeanProvider.java,v 1.5 2002/04/10 02:38:58 peterbraswell Exp $
-
-package org.jboss.net.jmx.server;
-
-// axis package
-import org.apache.axis.AxisFault;
-import org.apache.axis.Message;
-import org.apache.axis.MessageContext;
-import org.apache.axis.providers.BasicProvider;
-import org.apache.axis.handlers.soap.SOAPService;
-import org.apache.axis.providers.BasicProvider;
-import org.apache.axis.message.SOAPEnvelope;
-import org.apache.axis.message.RPCParam;
-import org.apache.axis.message.RPCElement;
-import org.apache.axis.utils.JavaUtils;
-
-// log4j
-import org.apache.log4j.Category;
-
-// sax & jaxrpc
-import org.xml.sax.SAXException;
-import javax.xml.soap.SOAPException;
-
-// jmx
-import javax.management.MBeanServerFactory;
-import javax.management.MBeanServer;
-import javax.management.MBeanException;
-import javax.management.ReflectionException;
-import javax.management.InstanceNotFoundException;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import javax.management.Attribute;
-import javax.management.MBeanInfo;
-import javax.management.MBeanAttributeInfo;
-import javax.management.AttributeNotFoundException;
-import javax.management.InvalidAttributeValueException;
-import javax.management.InvalidAttributeValueException;
-import javax.management.IntrospectionException;
-import javax.management.ReflectionException;
-
-// utils
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Exposes mbeans as targets (pivot-handlers) of web-services. To
- * deploy a particular mbean as a web-service, a deployment descriptor
- * would look like:
- *
- * <wsdd:deployment>
- * <handler name="MBeanDispatcher" class="org.jboss.net.jmx.MBeanProvider"/>
- * <wsdd:service name="${ServiceName}" handler="Handler">
- * <option name="handlerClass" value="org.jboss.net.jmx.server.MBeanProvider"/>
- * <option name="ObjectName" value="${JMX_ObjectName}"/>
- * </wsdd:service>
- * </wsdd:deployment>
- *
- * The message format (WSDL generation is to come ...) requires the first
- * parameter being always a String[] of the length of the following
- * parameters that describes the signature of the target method.
- *
- * <br>
- * <h3>Change History</h3>
- * <ul>
- * <li> jung, 03.04.2002: cache some meta-data about mbean. </li>
- * <li> braswell, 03.04.2002: JMX1.1 does not expose attribut accessors as methods
anymore. </li>
- * <li> jung, 21.03.2002: made apache axis beta1 compliant. </li>
- * </ul>
- *
- * @created 1. Oktober 2001, 16:38
- * @author <a href="mailto:[EMAIL PROTECTED]">Christoph G. Jung</a>
- * @version $Revision: 1.5 $
- */
-
-public class MBeanProvider extends BasicProvider {
-
- /** stores meta-data about mbean */
- protected MBeanInfo info;
-
- /** stores attribute meta-data */
- protected MBeanAttributeInfo[] attributes;
-
- /** hashmap from attribute-name to attribute info */
- protected Map attributeMap = new java.util.HashMap();
-
- /** the server which we are tight to */
- protected MBeanServer server;
-
- /** the objectName which we are running into */
- protected ObjectName name;
-
- /** whether this provider has been already initialized */
- protected boolean initialized;
-
- /** Creates new MBeanProvider */
- public MBeanProvider() {
- }
-
- /** initialize the meta-data */
- protected synchronized void initialize(MessageContext msgContext)
- throws AxisFault {
- if (!initialized) {
- initialized = true;
- SOAPService service = msgContext.getService();
- // include the JMX objectname
- String objectName = (String)
service.getOption(Constants.OBJECTNAME_PROPERTY);
- // and the server id (maybe)
- String serverId =
- (String) service.getOption(Constants.MBEAN_SERVER_ID_PROPERTY);
-
- // process server id
- Iterator allServers =
MBeanServerFactory.findMBeanServer(serverId).iterator();
- if (!allServers.hasNext())
- throw new AxisFault(Constants.NO_MBEAN_SERVER_FOUND);
- else
- server = (MBeanServer) allServers.next();
-
- // process objectname
- try {
- name = new ObjectName(objectName);
- } catch (MalformedObjectNameException e) {
- throw new AxisFault(Constants.WRONG_OBJECT_NAME, e);
- }
-
- try {
- info = server.getMBeanInfo(name);
- } catch (InstanceNotFoundException e) {
- throw new AxisFault(Constants.NO_MBEAN_INSTANCE, e);
- } catch (IntrospectionException e) {
- throw new AxisFault(Constants.INTROSPECTION_EXCEPTION, e);
- } catch (ReflectionException e) {
- throw new AxisFault(Constants.INTROSPECTION_EXCEPTION, e);
- }
-
- attributes = info.getAttributes();
-
- for (int i = 0; i < attributes.length; ++i) {
- attributeMap.put(attributes[i].getName(), attributes[i]);
- }
-
- }
- }
-
- /**
- * Invoke is called to do the actual work of the Handler object.
- */
-
- public void invoke(MessageContext msgContext) throws AxisFault {
- // initialize first
- initialize(msgContext);
-
- // the options of the service
- String serviceName = msgContext.getTargetService();
-
- // dissect the message
- Message reqMsg = msgContext.getRequestMessage();
- SOAPEnvelope reqEnv = (SOAPEnvelope) reqMsg.getSOAPEnvelope();
- Message resMsg = msgContext.getResponseMessage();
- SOAPEnvelope resEnv =
- (resMsg == null) ? new SOAPEnvelope() : (SOAPEnvelope)
resMsg.getSOAPEnvelope();
-
- // copied code from RobJ, duh?
- if (msgContext.getResponseMessage() == null) {
- resMsg = new Message(resEnv);
- msgContext.setResponseMessage(resMsg);
- }
-
- // navigate the bodies
- Iterator allBodies = reqEnv.getBodyElements().iterator();
-
- while (allBodies.hasNext()) {
- Object nextBody = allBodies.next();
- if (nextBody instanceof RPCElement) {
- RPCElement body = (RPCElement) nextBody;
- String mName = body.getMethodName();
- List args = null;
- try {
- args = body.getParams();
- } catch (SAXException e) {
- throw new AxisFault(Constants.EXCEPTION_OCCURED, e);
- }
- Object[] arguments;
- String[] classNames;
-
- // parameter preprocessing
- if (args == null || args.size() == 0) {
- arguments = new Object[0];
- classNames = new String[0];
- } else {
- arguments = new Object[args.size() - 1];
- RPCParam param = (RPCParam) args.get(0);
- try {
- classNames = (String[]) JavaUtils.convert(param.getValue(),
String[].class);
- for (int count = 0; count < classNames.length; count++) {
- param = (RPCParam) args.get(count + 1);
- try {
- arguments[count] =
- JavaUtils.convert(
- param.getValue(),
-
msgContext.getClassLoader().loadClass(classNames[count]));
- } catch (ClassNotFoundException e) {
- throw new AxisFault(Constants.CLASS_NOT_FOUND, e);
- }
- }
- } catch (ClassCastException e) {
- throw new AxisFault(Constants.COULD_NOT_CONVERT_PARAMS, e);
- }
- }
-
- // now do the JMX call
- try {
- Object result;
- // now we have to distinguish attribute from
- // "regular" method access, taken over from MBeanProxy
- if (mName.startsWith("get") && arguments.length == 0) {
- String attrName = mName.substring(3);
- result = server.getAttribute(name, attrName);
- } else if (mName.startsWith("is") && arguments.length == 0) {
- String attrName = mName.substring(2);
- result = server.getAttribute(name, attrName);
- } else if (mName.startsWith("set") && arguments.length == 1) {
- String attrName = mName.substring(3);
- server.setAttribute(name, new Attribute(attrName, arguments[0]));
- result = null;
- } else {
- result = server.invoke(name, mName, arguments, classNames);
- }
- // and encode it back to the response
- RPCElement resBody = new RPCElement(mName + "Response");
- resBody.setPrefix(body.getPrefix());
- resBody.setNamespaceURI(body.getNamespaceURI());
- RPCParam param = new RPCParam(mName + "Result", result);
- resBody.addParam(param);
- resEnv.addBodyElement(resBody);
- resEnv.setEncodingStyle(org.apache.axis.Constants.URI_SOAP_ENC);
- } catch (InstanceNotFoundException e) {
- throw new AxisFault(Constants.NO_MBEAN_INSTANCE, e);
- } catch (AttributeNotFoundException e) {
- throw new AxisFault(Constants.NO_SUCH_ATTRIBUTE, e);
- } catch (InvalidAttributeValueException e) {
- throw new AxisFault(Constants.INVALID_ARGUMENT, e);
- } catch (MBeanException e) {
- throw new AxisFault(Constants.MBEAN_EXCEPTION, e);
- } catch (ReflectionException e) {
- throw new AxisFault(Constants.EXCEPTION_OCCURED,
e.getTargetException());
- } catch (SOAPException e) {
- throw new AxisFault(Constants.EXCEPTION_OCCURED, e);
- }
-
- } // if(nextBody instanceof RPCElement)
- } // // while(allBodies.hasNext())
- } // invoke
-
- /**
- * ToDo, inspect mbean-interfaces or so?
- */
- public void generateWSDL(MessageContext msgContext) throws AxisFault {
- }
-
- /**
- * ToDo, called when a fault occurs to 'undo' whatever 'invoke' did.
- */
- public void undo(MessageContext msgContext) {
- // unbelievable this foresight
- }
-}
\ No newline at end of file
+
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
+// $Id: MBeanProvider.java,v 1.6 2002/04/12 02:32:52 peterbraswell Exp $
+package org.jboss.net.jmx.server;
+
+
+
+// axis package
+import org.apache.axis.AxisFault;
+import org.apache.axis.Message;
+import org.apache.axis.Handler;
+import org.apache.axis.MessageContext;
+import org.apache.axis.providers.BasicProvider;
+import org.apache.axis.handlers.soap.SOAPService;
+import org.apache.axis.providers.BasicProvider;
+import org.apache.axis.message.SOAPEnvelope;
+import org.apache.axis.message.RPCParam;
+import org.apache.axis.message.RPCElement;
+import org.apache.axis.utils.JavaUtils;
+import org.apache.axis.EngineConfiguration;
+import org.apache.axis.wsdl.fromJava.Emitter;
+import org.apache.axis.encoding.TypeMapping;
+import org.apache.axis.handlers.soap.SOAPService;
+
+// Jboss
+import org.jboss.net.axis.XMLResourceProvider;
+
+// log4j
+import org.apache.log4j.Category;
+
+// sax & jaxrpc
+import org.xml.sax.SAXException;
+import javax.xml.soap.SOAPException;
+import javax.xml.rpc.namespace.QName;
+
+// jmx
+import javax.management.MBeanServerFactory;
+import javax.management.MBeanServer;
+import javax.management.MBeanException;
+import javax.management.ReflectionException;
+import javax.management.InstanceNotFoundException;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.Attribute;
+import javax.management.MBeanInfo;
+import javax.management.MBeanAttributeInfo;
+import javax.management.AttributeNotFoundException;
+import javax.management.InvalidAttributeValueException;
+import javax.management.InvalidAttributeValueException;
+import javax.management.IntrospectionException;
+import javax.management.ReflectionException;
+import javax.management.MBeanOperationInfo;
+
+// W3C
+import org.w3c.dom.Document;
+
+// utils
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+
+
+
+/**
+ * Exposes mbeans as targets (pivot-handlers) of web-services. To
+ * deploy a particular mbean as a web-service, a deployment descriptor
+ * would look like:
+ *
+ * <wsdd:deployment>
+ * <handler name="MBeanDispatcher" class="org.jboss.net.jmx.MBeanProvider"/>
+ * <wsdd:service name="${ServiceName}" handler="Handler">
+ * <option name="handlerClass" value="org.jboss.net.jmx.server.MBeanProvider"/>
+ * <option name="ObjectName" value="${JMX_ObjectName}"/>
+ * </wsdd:service>
+ * </wsdd:deployment>
+ *
+ * The message format (WSDL generation is to come ...) requires the first
+ * parameter being always a String[] of the length of the following
+ * parameters that describes the signature of the target method.
+ *
+ * <br>
+ * <h3>Change History</h3>
+ * <ul>
+ * <li> jung, 03.04.2002: cache some meta-data about mbean. </li>
+ * <li> braswell, 03.04.2002: JMX1.1 does not expose attribut accessors as methods
anymore. </li>
+ * <li> jung, 21.03.2002: made apache axis beta1 compliant. </li>
+ * </ul>
+ *
+ * @created 1. Oktober 2001, 16:38
+ * @author <a href="mailto:[EMAIL PROTECTED]">Christoph G. Jung</a>
+ * @version $Revision: 1.6 $
+ */
+
+public class MBeanProvider
+ extends BasicProvider
+{
+
+ /** stores meta-data about mbean */
+
+ protected MBeanInfo info;
+
+ /** stores attribute meta-data */
+
+ protected MBeanAttributeInfo[] attributes;
+
+ /** hashmap from attribute-name to attribute info */
+
+ protected Map attributeMap = new java.util.HashMap();
+
+ /** the server which we are tight to */
+
+ protected MBeanServer server;
+
+ /** the objectName which we are running into */
+
+ protected ObjectName name;
+
+ /** whether this provider has been already initialized */
+
+ protected boolean initialized;
+
+ /** Creates new MBeanProvider */
+
+ private String allowedMethodsOption = "allowedMethods";
+
+ public MBeanProvider ()
+ {
+ }
+
+ /** initialize the meta-data */
+
+ protected synchronized void initialize (MessageContext msgCtx)
+ throws AxisFault
+ {
+ if (!initialized)
+ {
+ initialized = true;
+
+ SOAPService service = msgCtx.getService();
+
+ // include the JMX objectname
+ String objectName =
+ ( String ) service.getOption(Constants.OBJECTNAME_PROPERTY);
+
+ // and the server id (maybe)
+ String serverId =
+ ( String ) service.getOption(Constants.MBEAN_SERVER_ID_PROPERTY);
+
+ // process server id
+ Iterator allServers =
+ MBeanServerFactory.findMBeanServer(serverId).iterator();
+
+ if (!allServers.hasNext())
+ throw new AxisFault(Constants.NO_MBEAN_SERVER_FOUND);
+ else server = ( MBeanServer ) allServers.next();
+
+ // process objectname
+ try
+ {
+ name = new ObjectName(objectName);
+ }
+ catch (MalformedObjectNameException e)
+ {
+ throw new AxisFault(Constants.WRONG_OBJECT_NAME, e);
+ }
+
+ try
+ {
+ info = server.getMBeanInfo(name);
+ }
+ catch (InstanceNotFoundException e)
+ {
+ throw new AxisFault(Constants.NO_MBEAN_INSTANCE, e);
+ }
+ catch (IntrospectionException e)
+ {
+ throw new AxisFault(Constants.INTROSPECTION_EXCEPTION, e);
+ }
+ catch (ReflectionException e)
+ {
+ throw new AxisFault(Constants.INTROSPECTION_EXCEPTION, e);
+ }
+
+ attributes = info.getAttributes();
+
+ for (int i = 0; i < attributes.length; ++i)
+ {
+ attributeMap.put(attributes [i].getName(), attributes [i]);
+ }
+ }
+ }
+
+ /**
+ * Invoke is called to do the actual work of the Handler object.
+ */
+
+ public void invoke (MessageContext msgContext)
+ throws AxisFault
+ {
+
+ // initialize first
+ initialize(msgContext);
+
+ // the options of the service
+ String serviceName = msgContext.getTargetService();
+
+ // dissect the message
+ Message reqMsg = msgContext.getRequestMessage();
+ SOAPEnvelope reqEnv = ( SOAPEnvelope ) reqMsg.getSOAPEnvelope();
+ Message resMsg = msgContext.getResponseMessage();
+ SOAPEnvelope resEnv = (resMsg == null) ? new SOAPEnvelope()
+ : ( SOAPEnvelope )
resMsg.getSOAPEnvelope();
+
+ // copied code from RobJ, duh?
+ if (msgContext.getResponseMessage() == null)
+ {
+ resMsg = new Message(resEnv);
+
+ msgContext.setResponseMessage(resMsg);
+ }
+
+ // navigate the bodies
+ Iterator allBodies = reqEnv.getBodyElements().iterator();
+
+ while (allBodies.hasNext())
+ {
+ Object nextBody = allBodies.next();
+
+ if (nextBody instanceof RPCElement)
+ {
+ RPCElement body = ( RPCElement ) nextBody;
+ String mName = body.getMethodName();
+ List args = null;
+
+ try
+ {
+ args = body.getParams();
+ }
+ catch (SAXException e)
+ {
+ throw new AxisFault(Constants.EXCEPTION_OCCURED, e);
+ }
+
+ Object[] arguments;
+ String[] classNames;
+
+ // parameter preprocessing
+ if (args == null || args.size() == 0)
+ {
+ arguments = new Object [0];
+ classNames = new String [0];
+ }
+ else
+ {
+ arguments = new Object [args.size() - 1];
+
+ RPCParam param = ( RPCParam ) args.get(0);
+
+ try
+ {
+ classNames =
+ ( String[] ) JavaUtils.convert(param.getValue(),
+ String[].class);
+
+ for (int count = 0; count < classNames.length; count++)
+ {
+ param = ( RPCParam ) args.get(count + 1);
+
+ try
+ {
+ arguments [count] = JavaUtils.convert(
+ param.getValue(),
+ msgContext.getClassLoader().loadClass(
+ classNames [count]));
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new AxisFault(Constants.CLASS_NOT_FOUND, e);
+ }
+ }
+ }
+ catch (ClassCastException e)
+ {
+ throw new AxisFault(Constants.COULD_NOT_CONVERT_PARAMS, e);
+ }
+ }
+
+ // now do the JMX call
+ try
+ {
+ Object result;
+
+ // now we have to distinguish attribute from
+ // "regular" method access, taken over from MBeanProxy
+ if (mName.startsWith("get") && arguments.length == 0)
+ {
+ String attrName = mName.substring(3);
+
+ result = server.getAttribute(name, attrName);
+ }
+ else
+ if (mName.startsWith("is") && arguments.length == 0)
+ {
+ String attrName = mName.substring(2);
+
+ result = server.getAttribute(name, attrName);
+ }
+ else
+ if (mName.startsWith("set") && arguments.length == 1)
+ {
+ String attrName = mName.substring(3);
+
+ server.setAttribute(name,
+ new Attribute(attrName,
+ arguments [0]));
+
+ result = null;
+ }
+ else
+ {
+ result = server.invoke(name, mName, arguments,
+ classNames);
+ }
+
+ // and encode it back to the response
+ RPCElement resBody = new RPCElement(mName + "Response");
+
+ resBody.setPrefix(body.getPrefix());
+ resBody.setNamespaceURI(body.getNamespaceURI());
+
+ RPCParam param = new RPCParam(mName + "Result", result);
+
+ resBody.addParam(param);
+ resEnv.addBodyElement(resBody);
+ resEnv.setEncodingStyle(
+ org.apache.axis.Constants.URI_SOAP_ENC);
+ }
+ catch (InstanceNotFoundException e)
+ {
+ throw new AxisFault(Constants.NO_MBEAN_INSTANCE, e);
+ }
+ catch (AttributeNotFoundException e)
+ {
+ throw new AxisFault(Constants.NO_SUCH_ATTRIBUTE, e);
+ }
+ catch (InvalidAttributeValueException e)
+ {
+ throw new AxisFault(Constants.INVALID_ARGUMENT, e);
+ }
+ catch (MBeanException e)
+ {
+ throw new AxisFault(Constants.MBEAN_EXCEPTION, e);
+ }
+ catch (ReflectionException e)
+ {
+ throw new AxisFault(Constants.EXCEPTION_OCCURED,
+ e.getTargetException());
+ }
+ catch (SOAPException e)
+ {
+ throw new AxisFault(Constants.EXCEPTION_OCCURED, e);
+ }
+ } // if(nextBody instanceof RPCElement)
+ } // // while(allBodies.hasNext())
+ } // invoke
+
+ /**
+ * ToDo, inspect mbean-interfaces or so?
+ */
+
+ public void generateWSDL (MessageContext msgCtx)
+ throws AxisFault
+ {
+
+ initialize(msgCtx);
+
+ EngineConfiguration engineConfig =
+ msgCtx.getAxisEngine().getConfig();
+
+ if (!(engineConfig instanceof XMLResourceProvider)) return;
+
+ XMLResourceProvider config =
+ ( XMLResourceProvider ) engineConfig;
+ ClassLoader newLoader =
+ config.getMyDeployment().getClassLoader(new QName(null,
+ msgCtx.getTargetService()));
+ ClassLoader currentLoader =
+ Thread.currentThread().getContextClassLoader();
+
+ try
+ {
+ Thread.currentThread().setContextClassLoader(newLoader);
+ /* Find the service we're invoking so we can grab it's options */
+ /***************************************************************/
+ String serviceName = msgCtx.getTargetService();
+ SOAPService service = msgCtx.getService();
+
+ /* Now get the service (RPC) specific info */
+ /********************************************/
+ String allowedMethods = getAllowedMethods(service);
+
+ /** ??? Should we enforce setting methodName? As it was,
+ * if it's null, we allowed any method. This seems like it might
+ * be considered somewhat insecure (it's an easy mistake to
+ * make). Tossing an Exception if it's not set, and using "*"
+ * to explicitly indicate "any method" is probably better.
+ */
+ if ((allowedMethods == null) || allowedMethods.equals(""))
+ throw new AxisFault("Server.NoMethodConfig",
+ JavaUtils.getMessage("noOption00", info.getClassName(), serviceName),
+ null, null);
+
+ if (allowedMethods.equals("*"))
+ {
+
+
+
+ }
+
+
+ String url = msgCtx.getStrProp(MessageContext.TRANS_URL);
+ String urn = (String)msgCtx.getTargetService();
+ String description = "JMX MBean exposed as a WebService";
+
+ Class cls = Class.forName(info.getClassName());
+
+ Emitter emitter = new Emitter();
+ emitter.setMode(service.getStyle());
+ emitter.setClsSmart(cls,url);
+ emitter.setAllowedMethods(allowedMethods);
+ emitter.setIntfNamespace(url);
+ emitter.setLocationUrl(url);
+ emitter.setTypeMapping((TypeMapping)msgCtx.getTypeMappingRegistry().
+
getTypeMapping(org.apache.axis.Constants.URI_CURRENT_SOAP_ENC));
+
emitter.setDefaultTypeMapping((TypeMapping)msgCtx.getTypeMappingRegistry().
+ getDefaultTypeMapping());
+ Document doc = emitter.emit(Emitter.MODE_ALL);
+
+ msgCtx.setProperty("WSDL", doc);
+
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ Thread.currentThread().setContextClassLoader(currentLoader);
+ throw new AxisFault(Constants.COULDNT_GEN_WSDL, ex);
+
+ }
+
+ Thread.currentThread().setContextClassLoader(currentLoader);
+
+ }
+
+ /**
+ * ToDo, called when a fault occurs to 'undo' whatever 'invoke' did.
+ */
+
+ public void undo (MessageContext msgContext)
+ {
+
+ // unbelievable this foresight
+ }
+
+ private String getAllowedMethods(Handler service)
+ {
+ String val = (String)service.getOption(allowedMethodsOption);
+ if (val == null || val.length() == 0) {
+ // Try the old option for backwards-compatibility
+ val = (String)service.getOption("methodName");
+ }
+ return val;
+ }
+}
+
+
+/*------ Formatted by Jindent 3.23 Basic 1.0 --- http://www.jindent.de ------*/
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development