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 2005/04/21 21:47:06 UTC
cvs commit: ws-axis/java/src/org/apache/axis/management/jmx DeploymentAdministrator.java DeploymentAdministratorMBean.java DeploymentQuery.java DeploymentQueryMBean.java WSDDServiceWrapper.java WSDDTransportWrapper.java ServiceAdministrator.java ServiceAdministratorMBean.java
dims 2005/04/21 12:47:06
Modified: java/src/org/apache/axis AxisEngine.java
java/src/org/apache/axis/deployment/wsdd WSDDDeployment.java
WSDDService.java
java/src/org/apache/axis/description JavaServiceDesc.java
java/src/org/apache/axis/management Registrar.java
ServiceAdmin.java
java/src/org/apache/axis/management/jmx
ServiceAdministrator.java
ServiceAdministratorMBean.java
Added: java/src/org/apache/axis/management/jmx
DeploymentAdministrator.java
DeploymentAdministratorMBean.java
DeploymentQuery.java DeploymentQueryMBean.java
WSDDServiceWrapper.java WSDDTransportWrapper.java
Log:
Fix for AXIS-1941 - WSDDDeployment MBean contribution
heavily tweaked code contrib originally sent by Algirdas Veitas. Tested using a combination of Tomcat55, MX4J, MC4J, JDK15, JCONSOLE.
URL: http://issues.apache.org/jira/browse/AXIS-1941
Revision Changes Path
1.121 +1 -1 ws-axis/java/src/org/apache/axis/AxisEngine.java
Index: AxisEngine.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/AxisEngine.java,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -r1.120 -r1.121
--- AxisEngine.java 26 Feb 2005 21:37:33 -0000 1.120
+++ AxisEngine.java 21 Apr 2005 19:47:06 -0000 1.121
@@ -107,7 +107,7 @@
protected boolean shouldSaveConfig = false;
/** Java class cache. */
- protected ClassCache classCache = new ClassCache();
+ protected transient ClassCache classCache = new ClassCache();
/**
* This engine's Session. This Session supports "application scope"
1.63 +98 -130 ws-axis/java/src/org/apache/axis/deployment/wsdd/WSDDDeployment.java
Index: WSDDDeployment.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/deployment/wsdd/WSDDDeployment.java,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -r1.62 -r1.63
--- WSDDDeployment.java 12 Nov 2004 19:19:19 -0000 1.62
+++ WSDDDeployment.java 21 Apr 2005 19:47:06 -0000 1.63
@@ -42,7 +42,6 @@
import java.util.Iterator;
import java.util.List;
-
/**
* WSDD deployment element
*
@@ -50,42 +49,38 @@
* @author Glen Daniels (gdaniels@apache.org)
*/
public class WSDDDeployment
- extends WSDDElement
- implements WSDDTypeMappingContainer,
- WSDDEngineConfiguration
+ extends WSDDElement
+ implements WSDDTypeMappingContainer,
+ WSDDEngineConfiguration
{
protected static Log log =
- LogFactory.getLog(WSDDDeployment.class.getName());
-
+ LogFactory.getLog(WSDDDeployment.class.getName());
private HashMap handlers = new HashMap();
private HashMap services = new HashMap();
private HashMap transports = new HashMap();
private HashMap typeMappings = new HashMap();
private WSDDGlobalConfiguration globalConfig = null;
-
- /** Mapping of namespaces -> services */
- private HashMap namespaceToServices = new HashMap();
+ /**
+ * Mapping of namespaces -> services
+ */
+ private HashMap namespaceToServices = new HashMap();
private AxisEngine engine;
- protected void addHandler(WSDDHandler handler)
- {
+ protected void addHandler(WSDDHandler handler) {
handlers.put(handler.getQName(), handler);
}
-
- protected void addService(WSDDService service)
- {
- WSDDService oldService = (WSDDService)services.get(service.getQName());
+
+ protected void addService(WSDDService service) {
+ WSDDService oldService = (WSDDService) services.get(service.getQName());
if (oldService != null) {
oldService.removeNamespaceMappings(this);
}
services.put(service.getQName(), service);
}
-
- protected void addTransport(WSDDTransport transport)
- {
+
+ protected void addTransport(WSDDTransport transport) {
transports.put(transport.getQName(), transport);
}
-
/**
* Put a WSDDHandler into this deployment, replacing any other
@@ -93,8 +88,7 @@
*
* @param handler a WSDDHandler to insert in this deployment
*/
- public void deployHandler(WSDDHandler handler)
- {
+ public void deployHandler(WSDDHandler handler) {
handler.deployToRegistry(this);
}
@@ -104,8 +98,7 @@
*
* @param transport a WSDDTransport to insert in this deployment
*/
- public void deployTransport(WSDDTransport transport)
- {
+ public void deployTransport(WSDDTransport transport) {
transport.deployToRegistry(this);
}
@@ -115,27 +108,26 @@
*
* @param service a WSDDHandler to insert in this deployment
*/
- public void deployService(WSDDService service)
- {
+ public void deployService(WSDDService service) {
service.deployToRegistry(this);
}
/**
* Remove a named handler
+ *
* @param qname the QName of the handler to remove
*/
- public void undeployHandler(QName qname)
- {
+ public void undeployHandler(QName qname) {
handlers.remove(qname);
}
/**
* Remove a named service
+ *
* @param qname the QName of the service to remove
*/
- public void undeployService(QName qname)
- {
- WSDDService service = (WSDDService)services.get(qname);
+ public void undeployService(QName qname) {
+ WSDDService service = (WSDDService) services.get(qname);
if (service != null) {
service.removeNamespaceMappings(this);
services.remove(qname);
@@ -144,23 +136,20 @@
/**
* Remove a named transport
+ *
* @param qname the QName of the transport to remove
*/
- public void undeployTransport(QName qname)
- {
+ public void undeployTransport(QName qname) {
transports.remove(qname);
}
public void deployTypeMapping(WSDDTypeMapping typeMapping)
- throws WSDDException
- {
+ throws WSDDException {
QName qname = typeMapping.getQName();
String encoding = typeMapping.getEncodingStyle();
-
// We have to include the encoding in the key
// because otherwise we would overwrite exiting mappings
typeMappings.put(qname + encoding, typeMapping);
-
if (tmrDeployed)
deployMapping(typeMapping);
}
@@ -168,40 +157,34 @@
/**
* Default constructor
*/
- public WSDDDeployment()
- {
+ public WSDDDeployment() {
}
/**
* Create an element in WSDD that wraps an extant DOM element
+ *
* @param e the element to create the deployment from
* @throws WSDDException when problems occur deploying a service or type mapping.
*/
public WSDDDeployment(Element e)
- throws WSDDException
- {
+ throws WSDDException {
super(e);
-
Element [] elements = getChildElements(e, ELEM_WSDD_HANDLER);
int i;
-
for (i = 0; i < elements.length; i++) {
WSDDHandler handler = new WSDDHandler(elements[i]);
deployHandler(handler);
}
-
elements = getChildElements(e, ELEM_WSDD_CHAIN);
for (i = 0; i < elements.length; i++) {
WSDDChain chain = new WSDDChain(elements[i]);
deployHandler(chain);
}
-
elements = getChildElements(e, ELEM_WSDD_TRANSPORT);
for (i = 0; i < elements.length; i++) {
WSDDTransport transport = new WSDDTransport(elements[i]);
deployTransport(transport);
}
-
elements = getChildElements(e, ELEM_WSDD_SERVICE);
for (i = 0; i < elements.length; i++) {
try {
@@ -215,7 +198,6 @@
throw ex;
}
}
-
elements = getChildElements(e, ELEM_WSDD_TYPEMAPPING);
for (i = 0; i < elements.length; i++) {
try {
@@ -229,51 +211,41 @@
throw ex;
}
}
-
elements = getChildElements(e, ELEM_WSDD_BEANMAPPING);
for (i = 0; i < elements.length; i++) {
WSDDBeanMapping mapping = new WSDDBeanMapping(elements[i]);
deployTypeMapping(mapping);
}
-
Element el = getChildElement(e, ELEM_WSDD_GLOBAL);
if (el != null)
globalConfig = new WSDDGlobalConfiguration(el);
}
- protected QName getElementName()
- {
+ protected QName getElementName() {
return QNAME_DEPLOY;
}
public void deployToRegistry(WSDDDeployment target)
- throws ConfigurationException
- {
-
+ throws ConfigurationException {
WSDDGlobalConfiguration global = getGlobalConfiguration();
-
if (global != null) {
target.setGlobalConfiguration(global);
}
-
Iterator i = handlers.values().iterator();
while (i.hasNext()) {
WSDDHandler handler = (WSDDHandler) i.next();
target.deployHandler(handler);
}
-
i = transports.values().iterator();
while (i.hasNext()) {
WSDDTransport transport = (WSDDTransport) i.next();
target.deployTransport(transport);
}
-
i = services.values().iterator();
while (i.hasNext()) {
WSDDService service = (WSDDService) i.next();
service.deployToRegistry(target);
}
-
i = typeMappings.values().iterator();
while (i.hasNext()) {
WSDDTypeMapping mapping = (WSDDTypeMapping) i.next();
@@ -282,18 +254,15 @@
}
private void deployMapping(WSDDTypeMapping mapping)
- throws WSDDException
- {
+ throws WSDDException {
try {
String encodingStyle = mapping.getEncodingStyle();
if (encodingStyle == null) {
encodingStyle = Constants.URI_DEFAULT_SOAP_ENC;
}
TypeMapping tm = tmr.getOrMakeTypeMapping(encodingStyle);
-
- SerializerFactory ser = null;
+ SerializerFactory ser = null;
DeserializerFactory deser = null;
-
// Try to construct a serializerFactory by introspecting for the
// following:
// public static create(Class javaType, QName xmlType)
@@ -304,21 +273,21 @@
// that does this for us.
//log.debug("start creating sf and df");
if (mapping.getSerializerName() != null &&
- !mapping.getSerializerName().equals("")) {
+ !mapping.getSerializerName().equals("")) {
ser = BaseSerializerFactory.createFactory(mapping.getSerializer(),
- mapping.getLanguageSpecificType(),
- mapping.getQName());
+ mapping.getLanguageSpecificType(),
+ mapping.getQName());
}
//log.debug("set ser factory");
if (mapping.getDeserializerName() != null &&
- !mapping.getDeserializerName().equals("")) {
+ !mapping.getDeserializerName().equals("")) {
deser = BaseDeserializerFactory.createFactory(mapping.getDeserializer(),
- mapping.getLanguageSpecificType(),
- mapping.getQName());
+ mapping.getLanguageSpecificType(),
+ mapping.getQName());
}
//log.debug("set dser factory");
- tm.register( mapping.getLanguageSpecificType(), mapping.getQName(), ser, deser);
+ tm.register(mapping.getLanguageSpecificType(), mapping.getQName(), ser, deser);
//log.debug("registered");
} catch (ClassNotFoundException e) {
log.error(Messages.getMessage("unabletoDeployTypemapping00", mapping.getQName().toString()), e);
@@ -329,39 +298,31 @@
}
public void writeToContext(SerializationContext context)
- throws IOException
- {
+ throws IOException {
context.registerPrefixForURI(NS_PREFIX_WSDD, URI_WSDD);
-
context.registerPrefixForURI(NS_PREFIX_WSDD_JAVA, URI_WSDD_JAVA);
-
context.startElement(QNAME_DEPLOY, null);
-
if (globalConfig != null) {
globalConfig.writeToContext(context);
}
-
Iterator i = handlers.values().iterator();
while (i.hasNext()) {
- WSDDHandler handler = (WSDDHandler)i.next();
+ WSDDHandler handler = (WSDDHandler) i.next();
handler.writeToContext(context);
}
-
i = services.values().iterator();
while (i.hasNext()) {
- WSDDService service = (WSDDService)i.next();
+ WSDDService service = (WSDDService) i.next();
service.writeToContext(context);
}
-
i = transports.values().iterator();
while (i.hasNext()) {
- WSDDTransport transport = (WSDDTransport)i.next();
+ WSDDTransport transport = (WSDDTransport) i.next();
transport.writeToContext(context);
}
-
i = typeMappings.values().iterator();
while (i.hasNext()) {
- WSDDTypeMapping mapping = (WSDDTypeMapping)i.next();
+ WSDDTypeMapping mapping = (WSDDTypeMapping) i.next();
mapping.writeToContext(context);
}
context.endElement();
@@ -372,8 +333,7 @@
*
* @return a global configuration object
*/
- public WSDDGlobalConfiguration getGlobalConfiguration()
- {
+ public WSDDGlobalConfiguration getGlobalConfiguration() {
return globalConfig;
}
@@ -382,11 +342,9 @@
}
/**
- *
* @return an array of type mappings in this deployment
*/
- public WSDDTypeMapping[] getTypeMappings()
- {
+ public WSDDTypeMapping[] getTypeMappings() {
WSDDTypeMapping[] t = new WSDDTypeMapping[typeMappings.size()];
typeMappings.values().toArray(t);
return t;
@@ -395,8 +353,7 @@
/**
* Return an array of the services in this deployment
*/
- public WSDDService[] getServices()
- {
+ public WSDDService[] getServices() {
WSDDService [] serviceArray = new WSDDService[services.size()];
services.values().toArray(serviceArray);
return serviceArray;
@@ -404,25 +361,22 @@
/**
* Return the WSDD description for a given named service
- */
- public WSDDService getWSDDService(QName qname)
- {
- return (WSDDService)services.get(qname);
+ */
+ public WSDDService getWSDDService(QName qname) {
+ return (WSDDService) services.get(qname);
}
-
+
/**
* Return an instance of the named handler.
*
* @param name the name of the handler to get
* @return an Axis handler with the specified QName or null of not found
*/
- public Handler getHandler(QName name) throws ConfigurationException
- {
- WSDDHandler h = (WSDDHandler)handlers.get(name);
+ public Handler getHandler(QName name) throws ConfigurationException {
+ WSDDHandler h = (WSDDHandler) handlers.get(name);
if (h != null) {
return h.getInstance(this);
}
-
return null;
}
@@ -432,15 +386,13 @@
* @param name the <code>QName</code> of the transport
* @return a <code>Handler</code> implementing the transport
* @throws ConfigurationException if there was an error resolving the
- * transport
+ * transport
*/
- public Handler getTransport(QName name) throws ConfigurationException
- {
- WSDDTransport t = (WSDDTransport)transports.get(name);
+ public Handler getTransport(QName name) throws ConfigurationException {
+ WSDDTransport t = (WSDDTransport) transports.get(name);
if (t != null) {
return t.getInstance(this);
}
-
return null;
}
@@ -448,29 +400,25 @@
* Retrieve an instance of the named service.
*
* @param name the <code>QName</code> identifying the
- * <code>Service</code>
+ * <code>Service</code>
* @return the <code>Service</code> associated with <code>qname</code>
* @throws ConfigurationException if there was an error resolving the
- * qname
+ * qname
*/
- public SOAPService getService(QName name) throws ConfigurationException
- {
- WSDDService s = (WSDDService)services.get(name);
+ public SOAPService getService(QName name) throws ConfigurationException {
+ WSDDService s = (WSDDService) services.get(name);
if (s != null) {
- return (SOAPService)s.getInstance(this);
+ return (SOAPService) s.getInstance(this);
}
-
return null;
}
public SOAPService getServiceByNamespaceURI(String namespace)
- throws ConfigurationException
- {
- WSDDService s = (WSDDService)namespaceToServices.get(namespace);
+ throws ConfigurationException {
+ WSDDService s = (WSDDService) namespaceToServices.get(namespace);
if (s != null) {
- return (SOAPService)s.getInstance(this);
+ return (SOAPService) s.getInstance(this);
}
-
return null;
}
@@ -483,11 +431,13 @@
}
TypeMappingRegistry tmr = new TypeMappingRegistryImpl();
+
public TypeMapping getTypeMapping(String encodingStyle) throws ConfigurationException {
- return (TypeMapping)getTypeMappingRegistry().getTypeMapping(encodingStyle);
+ return (TypeMapping) getTypeMappingRegistry().getTypeMapping(encodingStyle);
}
private boolean tmrDeployed = false;
+
public TypeMappingRegistry getTypeMappingRegistry() throws ConfigurationException {
if (false == tmrDeployed) {
Iterator i = typeMappings.values().iterator();
@@ -506,7 +456,6 @@
if (reqFlow != null)
return reqFlow.getInstance(this);
}
-
return null;
}
@@ -516,7 +465,6 @@
if (respFlow != null)
return respFlow.getInstance(this);
}
-
return null;
}
@@ -549,23 +497,21 @@
/**
* Register a particular namepsace which maps to a given WSDDService.
* This will be used for namespace-based dispatching.
- *
+ *
* @param namespace a namespace URI
- * @param service the target WSDDService
- */
+ * @param service the target WSDDService
+ */
public void registerNamespaceForService(String namespace,
- WSDDService service)
- {
+ WSDDService service) {
namespaceToServices.put(namespace, service);
}
-
+
/**
* Remove a namespace -> WSDDService mapping.
- *
+ *
* @param namespace the namespace URI to unmap
- */
- public void removeNamespaceMapping(String namespace)
- {
+ */
+ public void removeNamespaceMapping(String namespace) {
namespaceToServices.remove(namespace);
}
@@ -573,5 +519,27 @@
return engine;
}
- public WSDDDeployment getDeployment() { return this; }
+ public WSDDDeployment getDeployment() {
+ return this;
+ }
+
+ public WSDDHandler[] getHandlers() {
+ WSDDHandler [] handlerArray = new WSDDHandler[handlers.size()];
+ handlers.values().toArray(handlerArray);
+ return handlerArray;
+ }
+
+ public WSDDHandler getWSDDHandler(QName qname) {
+ return (WSDDHandler) handlers.get(qname);
+ }
+
+ public WSDDTransport[] getTransports() {
+ WSDDTransport [] transportArray = new WSDDTransport[transports.size()];
+ transports.values().toArray(transportArray);
+ return transportArray;
+ }
+
+ public WSDDTransport getWSDDTransport(QName qname) {
+ return (WSDDTransport) transports.get(qname);
+ }
}
1.113 +1 -1 ws-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java
Index: WSDDService.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -r1.112 -r1.113
--- WSDDService.java 26 Feb 2005 21:37:33 -0000 1.112
+++ WSDDService.java 21 Apr 2005 19:47:06 -0000 1.113
@@ -80,7 +80,7 @@
/** Use - encoded (the default) or literal */
private Use use = Use.DEFAULT;
- private SOAPService cachedService = null;
+ private transient SOAPService cachedService = null;
/**
* Our provider - used to figure out which Handler we use as a service
1.25 +3 -3 ws-axis/java/src/org/apache/axis/description/JavaServiceDesc.java
Index: JavaServiceDesc.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/description/JavaServiceDesc.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- JavaServiceDesc.java 26 Feb 2005 21:37:33 -0000 1.24
+++ JavaServiceDesc.java 21 Apr 2005 19:47:06 -0000 1.25
@@ -104,7 +104,7 @@
/** Lookup caches */
private HashMap name2OperationsMap = null;
private HashMap qname2OperationsMap = null;
- private HashMap method2OperationMap = new HashMap();
+ private transient HashMap method2OperationMap = new HashMap();
// THE FOLLOWING STUFF IS ALL JAVA-SPECIFIC, AND WILL BE FACTORED INTO
// A JAVA-SPECIFIC SUBCLASS. --Glen
@@ -126,7 +126,7 @@
private boolean isSkeletonClass = false;
/** Cached copy of the skeleton "getOperationDescByName" method */
- private Method skelMethod = null;
+ private transient Method skelMethod = null;
/** Classes at which we should stop looking up the inheritance chain
* when introspecting
@@ -134,7 +134,7 @@
private ArrayList stopClasses = null;
/** Lookup caches */
- private HashMap method2ParamsMap = new HashMap();
+ private transient HashMap method2ParamsMap = new HashMap();
private OperationDesc messageServiceDefaultOp = null;
/** Method names for which we have completed any introspection necessary */
1.6 +20 -33 ws-axis/java/src/org/apache/axis/management/Registrar.java
Index: Registrar.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/management/Registrar.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Registrar.java 27 Oct 2004 21:41:01 -0000 1.5
+++ Registrar.java 21 Apr 2005 19:47:06 -0000 1.6
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.axis.management;
import org.apache.axis.components.logger.LogFactory;
@@ -26,28 +25,29 @@
/**
* class to act as a dynamic loading registrar to commons-modeler, so
* as to autoregister stuff
+ *
* @link http://www.webweavertech.com/costin/archives/000168.html#000168
*/
public class Registrar {
/**
* our log
*/
- protected static Log log = LogFactory.getLog(Registrar.class.getName());
+ protected static Log log = LogFactory.getLog(Registrar.class.getName());
/**
- * register using reflection. The perf hit is moot as jmx is
+ * register using reflection. The perf hit is moot as jmx is
* all reflection anyway
+ *
* @param objectToRegister
* @param name
* @param context
*/
public static boolean register(Object objectToRegister,
String name, String context) {
-
if (isBound()) {
- if(log.isDebugEnabled()) {
- log.debug("Registering "+objectToRegister+" as "
- +name);
+ if (log.isDebugEnabled()) {
+ log.debug("Registering " + objectToRegister + " as "
+ + name);
}
return modelerBinding.register(objectToRegister, name, context);
} else {
@@ -58,6 +58,7 @@
/**
* Check for being bound to a modeler -this will force
* a binding if none existed.
+ *
* @return
*/
@@ -79,14 +80,13 @@
/**
* the inner class that does the binding
*/
- private static ModelerBinding modelerBinding = null;
+ private static ModelerBinding modelerBinding = null;
/**
* This class provides a dynamic binding to the
* commons-modeler registry at run time
*/
static class ModelerBinding {
-
/**
* the constructor binds
*/
@@ -96,6 +96,7 @@
/**
* can the binding bind?
+ *
* @return true iff the classes are bound
*/
public boolean canBind() {
@@ -103,34 +104,22 @@
}
/**
- * our log
+ * log
*/
- protected static Log log = LogFactory.getLog(ModelerBinding.class.getName());
-
+ protected static Log log = LogFactory.getLog(ModelerBinding.class.getName());
/**
* registry object
*/
- Object registry;
-
+ Object registry;
/**
* method to call
*/
- Method registerComponent;
+ Method registerComponent;
- /*
- * this is what we could do without reflection
- */
- /*
- void simpleRegister(Object objectToRegister, String name, String context)
- throws Exception {
- Registry.setUseContextClassLoader(true);
- Registry reg = Registry.getRegistry(null, null);
- reg.registerComponent(objectToRegister, name, context);
- }
-*/
/**
- * register using reflection. The perf hit is moot as jmx is
+ * register using reflection. The perf hit is moot as jmx is
* all reflection anyway
+ *
* @param objectToRegister
* @param name
* @param context
@@ -161,6 +150,7 @@
/**
* bind to the modeler; return success/failure flag
+ *
* @return true if the binding worked
*/
private boolean bindToModeler() {
@@ -174,14 +164,13 @@
return false;
}
try {
- Class[] getRegistryArgs = new Class[]{Object.class, Object.class, };
+ Class[] getRegistryArgs = new Class[]{Object.class, Object.class,};
Method getRegistry = clazz.getMethod("getRegistry", getRegistryArgs);
Object[] getRegistryOptions = new Object[]{null, null};
registry = getRegistry.invoke(null, getRegistryOptions);
Class[] registerArgs = new Class[]{Object.class,
- String.class,
- String.class};
-
+ String.class,
+ String.class};
registerComponent = clazz.getMethod("registerComponent", registerArgs);
} catch (IllegalAccessException e) {
ex = e;
@@ -204,8 +193,6 @@
//success
return true;
}
-
}
}
-
}
1.4 +116 -16 ws-axis/java/src/org/apache/axis/management/ServiceAdmin.java
Index: ServiceAdmin.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/management/ServiceAdmin.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ServiceAdmin.java 20 Oct 2004 20:54:11 -0000 1.3
+++ ServiceAdmin.java 21 Apr 2005 19:47:06 -0000 1.4
@@ -17,26 +17,33 @@
import org.apache.axis.AxisFault;
import org.apache.axis.ConfigurationException;
-import org.apache.axis.management.jmx.ServiceAdministrator;
+import org.apache.axis.EngineConfiguration;
+import org.apache.axis.WSDDEngineConfiguration;
+import org.apache.axis.deployment.wsdd.WSDDGlobalConfiguration;
+import org.apache.axis.deployment.wsdd.WSDDHandler;
+import org.apache.axis.deployment.wsdd.WSDDService;
+import org.apache.axis.deployment.wsdd.WSDDTransport;
import org.apache.axis.description.ServiceDesc;
import org.apache.axis.handlers.soap.SOAPService;
+import org.apache.axis.management.jmx.DeploymentAdministrator;
+import org.apache.axis.management.jmx.DeploymentQuery;
+import org.apache.axis.management.jmx.ServiceAdministrator;
import org.apache.axis.server.AxisServer;
import javax.xml.namespace.QName;
-import java.util.HashMap;
+import java.util.ArrayList;
import java.util.Iterator;
/**
- * The ServiceControl Object is responsible for starting and
+ * The ServiceControl Object is responsible for starting and
* stopping specific services
*
* @author bdillon
* @version 1.0
*/
public class ServiceAdmin {
-
//Singleton AxisServer for Management
- static private AxisServer axisServer = null;
+ static private AxisServer axisServer = null;
/**
* Start the Service
@@ -53,7 +60,7 @@
service.start();
} catch (ConfigurationException configException) {
if (configException.getContainedException() instanceof AxisFault) {
- throw (AxisFault) configException.getContainedException();
+ throw (AxisFault) configException.getContainedException();
} else {
throw configException;
}
@@ -75,7 +82,7 @@
service.stop();
} catch (ConfigurationException configException) {
if (configException.getContainedException() instanceof AxisFault) {
- throw (AxisFault) configException.getContainedException();//Throw Axis fault if ist. of
+ throw (AxisFault) configException.getContainedException();//Throw Axis fault if ist. of
} else {
throw configException;
}
@@ -88,16 +95,16 @@
* @return Map of Services (SOAPService objects, Key is the ServiceName)
* @throws AxisFault ConfigurationException
*/
- static public HashMap listServices()
+ static public String[] listServices()
throws AxisFault, ConfigurationException {
+ ArrayList list = new ArrayList();
AxisServer server = getEngine();
- HashMap serviceMap = new HashMap();
Iterator iter; // get list of ServiceDesc objects
try {
iter = server.getConfig().getDeployedServices();
} catch (ConfigurationException configException) {
if (configException.getContainedException() instanceof AxisFault) {
- throw (AxisFault) configException.getContainedException();//Throw Axis fault if inst. of
+ throw (AxisFault) configException.getContainedException();//Throw Axis fault if inst. of
} else {
throw configException;
}
@@ -105,11 +112,9 @@
while (iter.hasNext()) {
ServiceDesc sd = (ServiceDesc) iter.next();
String name = sd.getName();
- SOAPService service = server.getConfig().getService(
- new QName("", name));
- serviceMap.put(name, service);
+ list.add(name);
}
- return serviceMap;
+ return (String[]) list.toArray(new String[list.size()]);
}
/**
@@ -129,11 +134,106 @@
/**
* Set the singleton engine
+ *
* @param axisSrv
- */
+ */
static public void setEngine(AxisServer axisSrv, String name) {
ServiceAdmin.axisServer = axisSrv;
- Registrar.register(new ServiceAdministrator(), "AxisServer:name=" + name, "AxisServerContext");
+ Registrar.register(new ServiceAdministrator(), "axis:type=server", "ServiceAdministrator");
+ Registrar.register(new DeploymentAdministrator(), "axis:type=deploy", "DeploymentAdministrator");
+ Registrar.register(new DeploymentQuery(), "axis:type=query", "DeploymentQuery");
+ }
+
+ static public void start() {
+ if (axisServer != null) {
+ axisServer.start();
+ }
+ }
+
+ static public void stop() {
+ if (axisServer != null) {
+ axisServer.stop();
+ }
+ }
+
+ static public void restart() {
+ if (axisServer != null) {
+ axisServer.stop();
+ axisServer.start();
+ }
+ }
+
+ static public void saveConfiguration() {
+ if (axisServer != null) {
+ axisServer.saveConfiguration();
+ }
+ }
+
+ static private WSDDEngineConfiguration getWSDDEngineConfiguration() {
+ if (axisServer != null) {
+ EngineConfiguration config = axisServer.getConfig();
+ if (config instanceof WSDDEngineConfiguration) {
+ return (WSDDEngineConfiguration) config;
+ } else {
+ throw new RuntimeException("WSDDDeploymentHelper.getWSDDEngineConfiguration(): EngineConguration not of type WSDDEngineConfiguration");
+ }
+ }
+ return null;
+ }
+
+ static public void setGlobalConfig(WSDDGlobalConfiguration globalConfig) {
+ getWSDDEngineConfiguration().getDeployment().setGlobalConfiguration(globalConfig);
}
+ static public WSDDGlobalConfiguration getGlobalConfig() {
+ return getWSDDEngineConfiguration().getDeployment().getGlobalConfiguration();
+ }
+
+ static public WSDDHandler getHandler(QName qname) {
+ return getWSDDEngineConfiguration().getDeployment().getWSDDHandler(qname);
+ }
+
+ static public WSDDHandler[] getHandlers() {
+ return getWSDDEngineConfiguration().getDeployment().getHandlers();
+ }
+
+ static public WSDDService getService(QName qname) {
+ return getWSDDEngineConfiguration().getDeployment().getWSDDService(qname);
+ }
+
+ static public WSDDService[] getServices() {
+ return getWSDDEngineConfiguration().getDeployment().getServices();
+ }
+
+ static public WSDDTransport getTransport(QName qname) {
+ return getWSDDEngineConfiguration().getDeployment().getWSDDTransport(qname);
+ }
+
+ static public WSDDTransport[] getTransports() {
+ return getWSDDEngineConfiguration().getDeployment().getTransports();
+ }
+
+ static public void deployHandler(WSDDHandler handler) {
+ getWSDDEngineConfiguration().getDeployment().deployHandler(handler);
+ }
+
+ static public void deployService(WSDDService service) {
+ getWSDDEngineConfiguration().getDeployment().deployService(service);
+ }
+
+ static public void deployTransport(WSDDTransport transport) {
+ getWSDDEngineConfiguration().getDeployment().deployTransport(transport);
+ }
+
+ static public void undeployHandler(QName qname) {
+ getWSDDEngineConfiguration().getDeployment().undeployHandler(qname);
+ }
+
+ static public void undeployService(QName qname) {
+ getWSDDEngineConfiguration().getDeployment().undeployService(qname);
+ }
+
+ static public void undeployTransport(QName qname) {
+ getWSDDEngineConfiguration().getDeployment().undeployTransport(qname);
+ }
}
\ No newline at end of file
1.3 +27 -10 ws-axis/java/src/org/apache/axis/management/jmx/ServiceAdministrator.java
Index: ServiceAdministrator.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/management/jmx/ServiceAdministrator.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ServiceAdministrator.java 20 Oct 2004 13:48:16 -0000 1.2
+++ ServiceAdministrator.java 21 Apr 2005 19:47:06 -0000 1.3
@@ -17,9 +17,8 @@
import org.apache.axis.AxisFault;
import org.apache.axis.ConfigurationException;
-
-import java.util.HashMap;
-import java.util.ArrayList;
+import org.apache.axis.Version;
+import org.apache.axis.management.ServiceAdmin;
/**
* The ServiceAdmininstrator MBean exposes the
@@ -29,7 +28,6 @@
* @version 1.0
*/
public class ServiceAdministrator implements ServiceAdministratorMBean {
-
/**
* CTR
*/
@@ -37,6 +35,27 @@
}
/**
+ * start the server
+ */
+ public void start() {
+ ServiceAdmin.start();
+ }
+
+ /**
+ * stop the server
+ */
+ public void stop() {
+ ServiceAdmin.stop();
+ }
+
+ /**
+ * restart the server
+ */
+ public void restart() {
+ ServiceAdmin.restart();
+ }
+
+ /**
* Start the Service
*
* @param serviceName
@@ -59,13 +78,11 @@
}
/**
- * List all registered services
+ * get the axis version
*
- * @return Map of Services (SOAPService objects, Key is the ServiceName)
- * @throws AxisFault ConfigurationException
+ * @return
*/
- public ArrayList listServices()
- throws AxisFault, ConfigurationException {
- return new ArrayList (org.apache.axis.management.ServiceAdmin.listServices().keySet());
+ public String getVersion() {
+ return Version.getVersionText();
}
}
\ No newline at end of file
1.3 +21 -13 ws-axis/java/src/org/apache/axis/management/jmx/ServiceAdministratorMBean.java
Index: ServiceAdministratorMBean.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/management/jmx/ServiceAdministratorMBean.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ServiceAdministratorMBean.java 20 Oct 2004 13:48:16 -0000 1.2
+++ ServiceAdministratorMBean.java 21 Apr 2005 19:47:06 -0000 1.3
@@ -18,9 +18,6 @@
import org.apache.axis.AxisFault;
import org.apache.axis.ConfigurationException;
-import java.util.HashMap;
-import java.util.ArrayList;
-
/**
* The ServiceAdministrator MBean exposes the
* org.apache.axis.management.ServiceAdmin object
@@ -29,6 +26,27 @@
* @version 1.0
*/
public interface ServiceAdministratorMBean {
+ /**
+ * get the axis version
+ *
+ * @return
+ */
+ public String getVersion();
+
+ /**
+ * Start the server
+ */
+ public void start();
+
+ /**
+ * stop the server
+ */
+ public void stop();
+
+ /**
+ * restart the server
+ */
+ public void restart();
/**
* Start the Service
@@ -47,14 +65,4 @@
*/
public void stopService(String serviceName) throws AxisFault,
ConfigurationException;
-
- /**
- * List all registered services
- *
- * @return Map of Services (SOAPService objects, Key is the ServiceName)
- * @throws AxisFault,ConfigurationException
- *
- */
- public ArrayList listServices() throws AxisFault, ConfigurationException;
-
}
\ No newline at end of file
1.1 ws-axis/java/src/org/apache/axis/management/jmx/DeploymentAdministrator.java
Index: DeploymentAdministrator.java
===================================================================
/*
* Copyright 2003,2004 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.axis.management.jmx;
import org.apache.axis.deployment.wsdd.WSDDGlobalConfiguration;
import org.apache.axis.deployment.wsdd.WSDDHandler;
import org.apache.axis.management.ServiceAdmin;
import javax.xml.namespace.QName;
public class DeploymentAdministrator implements DeploymentAdministratorMBean {
public DeploymentAdministrator() {
}
public void saveConfiguration() {
ServiceAdmin.saveConfiguration();
}
public void configureGlobalConfig(WSDDGlobalConfiguration config) {
ServiceAdmin.setGlobalConfig(config);
}
public void deployHandler(WSDDHandler handler) {
ServiceAdmin.deployHandler(handler);
}
public void deployService(WSDDServiceWrapper service) {
ServiceAdmin.deployService(service.getWSDDService());
}
public void deployTransport(WSDDTransportWrapper transport) {
ServiceAdmin.deployTransport(transport.getWSDDTransport());
}
public void undeployHandler(String qname) {
ServiceAdmin.undeployHandler(new QName(qname));
}
public void undeployService(String qname) {
ServiceAdmin.undeployService(new QName(qname));
}
public void undeployTransport(String qname) {
ServiceAdmin.undeployTransport(new QName(qname));
}
}
1.1 ws-axis/java/src/org/apache/axis/management/jmx/DeploymentAdministratorMBean.java
Index: DeploymentAdministratorMBean.java
===================================================================
/*
* Copyright 2003,2004 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.axis.management.jmx;
import org.apache.axis.deployment.wsdd.WSDDGlobalConfiguration;
import org.apache.axis.deployment.wsdd.WSDDHandler;
public interface DeploymentAdministratorMBean {
public void saveConfiguration();
public void configureGlobalConfig(WSDDGlobalConfiguration config);
public void deployHandler(WSDDHandler handler);
public void deployService(WSDDServiceWrapper service);
public void deployTransport(WSDDTransportWrapper transport);
public void undeployHandler(String qname);
public void undeployService(String qname);
public void undeployTransport(String qname);
}
1.1 ws-axis/java/src/org/apache/axis/management/jmx/DeploymentQuery.java
Index: DeploymentQuery.java
===================================================================
/*
* Copyright 2003,2004 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.axis.management.jmx;
import org.apache.axis.AxisFault;
import org.apache.axis.ConfigurationException;
import org.apache.axis.deployment.wsdd.WSDDGlobalConfiguration;
import org.apache.axis.deployment.wsdd.WSDDHandler;
import org.apache.axis.deployment.wsdd.WSDDService;
import org.apache.axis.deployment.wsdd.WSDDTransport;
import org.apache.axis.management.ServiceAdmin;
import javax.xml.namespace.QName;
public class DeploymentQuery implements DeploymentQueryMBean {
/**
* get the global configuration
*
* @return
*/
public WSDDGlobalConfiguration findGlobalConfig() {
return ServiceAdmin.getGlobalConfig();
}
/**
* find a specific handler
*
* @param qname
* @return
*/
public WSDDHandler findHandler(String qname) {
return ServiceAdmin.getHandler(new QName(qname));
}
/**
* get all handlers
*
* @return
*/
public WSDDHandler[] findHandlers() {
return ServiceAdmin.getHandlers();
}
/**
* fina a specific service
*
* @param qname
* @return
*/
public WSDDService findService(String qname) {
return ServiceAdmin.getService(new QName(qname));
}
/**
* get all services
*
* @return
*/
public WSDDService[] findServices() {
return ServiceAdmin.getServices();
}
/**
* find a specific transport
*
* @param qname
* @return
*/
public WSDDTransport findTransport(String qname) {
return ServiceAdmin.getTransport(new QName(qname));
}
/**
* return all transports
*
* @return
*/
public WSDDTransport[] findTransports() {
return ServiceAdmin.getTransports();
}
/**
* List all registered services
*
* @return Map of Services (SOAPService objects, Key is the ServiceName)
* @throws AxisFault ConfigurationException
*/
public String[] listServices()
throws AxisFault, ConfigurationException {
return org.apache.axis.management.ServiceAdmin.listServices();
}
}
1.1 ws-axis/java/src/org/apache/axis/management/jmx/DeploymentQueryMBean.java
Index: DeploymentQueryMBean.java
===================================================================
/*
* Copyright 2003,2004 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.axis.management.jmx;
import org.apache.axis.AxisFault;
import org.apache.axis.ConfigurationException;
import org.apache.axis.deployment.wsdd.WSDDGlobalConfiguration;
import org.apache.axis.deployment.wsdd.WSDDHandler;
import org.apache.axis.deployment.wsdd.WSDDService;
import org.apache.axis.deployment.wsdd.WSDDTransport;
public interface DeploymentQueryMBean {
/**
* get the global configuration
*
* @return
*/
public WSDDGlobalConfiguration findGlobalConfig();
/**
* find the handler
*
* @param qname
* @return
*/
public WSDDHandler findHandler(String qname);
/**
* return all handlers
*
* @return
*/
public WSDDHandler[] findHandlers();
/**
* find the service
*
* @param qname
* @return
*/
public WSDDService findService(String qname);
/**
* return all services
*
* @return
*/
public WSDDService[] findServices();
/**
* find the transport
*
* @param qname
* @return
*/
public WSDDTransport findTransport(String qname);
/**
* return all transports
*
* @return
*/
public WSDDTransport[] findTransports();
/**
* List all registered services
*
* @return string array
* @throws org.apache.axis.AxisFault ConfigurationException
*/
public String[] listServices() throws AxisFault, ConfigurationException;
}
1.1 ws-axis/java/src/org/apache/axis/management/jmx/WSDDServiceWrapper.java
Index: WSDDServiceWrapper.java
===================================================================
/*
* Copyright 2003,2004 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.axis.management.jmx;
import org.apache.axis.deployment.wsdd.WSDDService;
public class WSDDServiceWrapper {
private WSDDService _wsddService;
public WSDDService getWSDDService() {
return this._wsddService;
}
public void setWSDDService(WSDDService wsddService) {
this._wsddService = wsddService;
}
}
1.1 ws-axis/java/src/org/apache/axis/management/jmx/WSDDTransportWrapper.java
Index: WSDDTransportWrapper.java
===================================================================
/*
* Copyright 2003,2004 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.axis.management.jmx;
import org.apache.axis.deployment.wsdd.WSDDTransport;
public class WSDDTransportWrapper {
private WSDDTransport _wsddTransport;
public WSDDTransport getWSDDTransport() {
return this._wsddTransport;
}
public void setWSDDTransport(WSDDTransport _wsddTransport) {
this._wsddTransport = _wsddTransport;
}
}