Author: azeez
Date: Thu Dec 20 09:14:03 2007
New Revision: 11614
Log:
Added MX4J dependency
Added more methods to be exposed via JMX
Modified:
trunk/commons/utils/src/main/java/org/wso2/utils/AbstractAdmin.java
trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServerAdmin.java
trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServerAdminMBean.java
trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServiceAdminMBean.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/DefaultServerInitializer.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/ServerManagement.java
trunk/wsas/java/pom.xml
Modified: trunk/commons/utils/src/main/java/org/wso2/utils/AbstractAdmin.java
==============================================================================
--- trunk/commons/utils/src/main/java/org/wso2/utils/AbstractAdmin.java
(original)
+++ trunk/commons/utils/src/main/java/org/wso2/utils/AbstractAdmin.java Thu Dec
20 09:14:03 2007
@@ -62,6 +62,16 @@
}
public ConfigurationContext getConfigContext() {
+ if (configCtx == null) {
+ try {
+ configCtx = WSO2ConfigurationContextFactory.
+
getConfigurationContext(ServerConfigurator.getInstance());
+ axisConfig = configCtx.getAxisConfiguration();
+ } catch (AxisFault axisFault) {
+ throw new
RuntimeException(Messages.getMessage("InvalidAxisConfiguration"),
+ axisFault);
+ }
+ }
return configCtx;
}
}
Modified:
trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServerAdmin.java
==============================================================================
---
trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServerAdmin.java
(original)
+++
trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServerAdmin.java
Thu Dec 20 09:14:03 2007
@@ -78,9 +78,8 @@
return serverStatus;
}
- public void restart() throws AxisFault {
- ConfigurationContext configurationContext =
-
MessageContext.getCurrentMessageContext().getConfigurationContext();
+ public void restart() {
+ ConfigurationContext configurationContext = getConfigContext();
controllable =
(Controllable) configurationContext.
getProperty(ServerConstants.WSO2WSAS_INSTANCE);
@@ -99,9 +98,8 @@
th.start();
}
- public void restartGracefully() throws AxisFault {
- ConfigurationContext configurationContext =
-
MessageContext.getCurrentMessageContext().getConfigurationContext();
+ public void restartGracefully() {
+ ConfigurationContext configurationContext = getConfigContext();
controllable =
(Controllable) configurationContext.
getProperty(ServerConstants.WSO2WSAS_INSTANCE);
@@ -120,9 +118,8 @@
th.start();
}
- public void shutdown() throws AxisFault {
- ConfigurationContext configurationContext =
-
MessageContext.getCurrentMessageContext().getConfigurationContext();
+ public void shutdown() {
+ ConfigurationContext configurationContext = getConfigContext();
controllable =
(Controllable) configurationContext.
getProperty(ServerConstants.WSO2WSAS_INSTANCE);
@@ -141,9 +138,8 @@
th.start();
}
- public void shutdownGracefully() throws AxisFault {
- ConfigurationContext configurationContext =
-
MessageContext.getCurrentMessageContext().getConfigurationContext();
+ public void shutdownGracefully() {
+ ConfigurationContext configurationContext = getConfigContext();
controllable =
(Controllable) configurationContext.
getProperty(ServerConstants.WSO2WSAS_INSTANCE);
@@ -162,14 +158,14 @@
th.start();
}
- public String startMaintenance() throws Exception {
+ public void startMaintenance() throws Exception {
HashMap inTransports = getAxisConfig().getTransportsIn();
- return new ServerManagement(inTransports).startMaintenance();
+ new ServerManagement(inTransports).startMaintenance();
}
- public String endMaintenance() throws Exception {
+ public void endMaintenance() throws Exception {
HashMap inTransports = getAxisConfig().getTransportsIn();
- return new ServerManagement(inTransports).endMaintenance();
+ new ServerManagement(inTransports).endMaintenance();
}
public boolean isAlive() {
Modified:
trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServerAdminMBean.java
==============================================================================
---
trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServerAdminMBean.java
(original)
+++
trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServerAdminMBean.java
Thu Dec 20 09:14:03 2007
@@ -16,11 +16,42 @@
package org.wso2.wsas.admin.service;
/**
- *
+ * MBean interface for exposing Server Adminstration functionalities
*/
public interface ServerAdminMBean {
/**
+ * Forcefully restart this WSAS instance
+ *
+ * @throws Exception If an error occurs while restarting
+ */
+ void restart() throws Exception;
+
+ /**
+ * Forcefully shutdown this WSAS instance
+ *
+ * @throws Exception If an error occurs while shutting down
+ */
+ void shutdown() throws Exception;
+
+ /**
+ * Gracefully restart this WSAS instance.
+ * All client connections will be served before restarting the server
+ *
+ * @throws Exception If an error occurs while restarting
+ */
+ void restartGracefully() throws Exception;
+
+ /**
+ * Gracefully shutdown this WSAS instance
+ * All client connections will be served before shutting down the server
+ *
+ * @throws Exception If an error occurs while shutting down
+ */
+ void shutdownGracefully() throws Exception;
+
+
+ /**
* Method to switch a node to maintenance mode.
* <p/>
* Here is the sequence of events:
@@ -32,23 +63,22 @@
* <li>Once all requests have been processed, the method returns</li
* </ol>
*
- * @return An appropriate message
* @throws Exception If an error occurred while switching to maintenace
mode
*/
- String startMaintenance() throws Exception;
+ void startMaintenance() throws Exception;
/**
* Method to change the state of a node from "maintenance" to "normal"
*
- * @return An appropriate message
* @throws Exception If an error occurred while switching to normal mode
*/
- String endMaintenance() throws Exception;
+ void endMaintenance() throws Exception;
/**
* Get information about this WSAS instance
+ *
* @return The server information as a string
- * @throws Exception If an error occurred while retrieving server
information
+ * @throws Exception If an error occurred while retrieving server
information
*/
String getServerDataAsString() throws Exception;
Modified:
trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServiceAdminMBean.java
==============================================================================
---
trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServiceAdminMBean.java
(original)
+++
trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServiceAdminMBean.java
Thu Dec 20 09:14:03 2007
@@ -15,16 +15,30 @@
*/
package org.wso2.wsas.admin.service;
-import org.wso2.wsas.admin.service.util.ServiceMetaData;
-
/**
- *
+ * MBean interface for exposing Service Adminstration functionalities
*/
public interface ServiceAdminMBean {
+
+ /**
+ * Get the number of faulty services
+ * @return number of faulty services
+ * @throws Exception If an error occurs
+ */
int getNumberOfFaultyServices() throws Exception;
+ /**
+ * Start the service specified by <code>serviceName</code>
+ * @param serviceName Name of the service to be restarted
+ * @throws Exception If an error occurs while starting the service
+ */
void startService(String serviceName) throws Exception;
+ /**
+ * Stop the service specified by <code>serviceName</code>
+ * @param serviceName Name of the service to be restarted
+ * @throws Exception If an error occurs while stopping the service
+ */
void stopService(String serviceName) throws Exception;
}
Modified:
trunk/wsas/java/modules/core/src/org/wso2/wsas/DefaultServerInitializer.java
==============================================================================
---
trunk/wsas/java/modules/core/src/org/wso2/wsas/DefaultServerInitializer.java
(original)
+++
trunk/wsas/java/modules/core/src/org/wso2/wsas/DefaultServerInitializer.java
Thu Dec 20 09:14:03 2007
@@ -144,10 +144,7 @@
int jmxPortInt = Integer.parseInt(jmxPort);
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
try {
- /*mbs.registerMBean(new ServerManagement(inTransports),
- new
ObjectName("WSO2WSAS:type=ServerManagement"));
- mbs.registerMBean(new ServiceAdmin(),
- new
ObjectName("WSO2WSAS:type=ServerManagement"));*/
+// mbs.
LocateRegistry.createRegistry(jmxPortInt);
@@ -156,7 +153,7 @@
NetworkUtils.getLocalHostname() + ":" +
jmxPortInt + "/server";
JMXServiceURL url = new JMXServiceURL(jmxURL);
JMXConnectorServer cs =
- JMXConnectorServerFactory.newJMXConnectorServer(url,
null, mbs);
+ JMXConnectorServerFactory.newJMXConnectorServer(url,
null, mbs); //TODO: This is where we have to provide security stuff
cs.start();
log.info("JMX Service URL : " + jmxURL);
isJMXServiceStarted = true;
Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/ServerManagement.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/ServerManagement.java
(original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/ServerManagement.java
Thu Dec 20 09:14:03 2007
@@ -93,9 +93,8 @@
* <li>Once all requests have been processed, the method returns</li
* </ol>
*
- * @return An appropriate message
*/
- public String startMaintenance() throws Exception {
+ public void startMaintenance() throws Exception {
long start = System.currentTimeMillis();
log.info("Starting to switch to maintenance mode...");
for (Iterator iter = inTransports.values().iterator();
iter.hasNext();) {
@@ -128,18 +127,14 @@
}
} while (areRequestsInService);
log.info("All requests have been served.");
-
- return "Switched to maintenance mode";
}
/**
* Method to change the state of a node from "maintenance" to "normal"
*
- * @return An appropriate message
* @throws org.apache.axis2.AxisFault
*/
- public String endMaintenance
- () throws Exception {
+ public void endMaintenance() throws Exception {
log.info("Switching to normal mode...");
for (Iterator iter = inTransports.values().iterator();
iter.hasNext();) {
TransportInDescription tinDesc = (TransportInDescription)
iter.next();
@@ -147,29 +142,5 @@
transport.start();
}
log.info("Switched to normal mode");
- return "Switched to normal mode";
- }
-
- public boolean isAlive() {
- return true;
- }
-
- private void callTransportListeners
- (String
- methodName) throws AxisFault {
- for (Iterator iter = inTransports.values().iterator();
iter.hasNext();) {
- TransportInDescription tinDesc = (TransportInDescription)
iter.next();
- TransportListener transport = tinDesc.getReceiver();
- try {
- Method method = transport.getClass().getMethod(methodName, new
Class[0]);
- if (method != null) {
- method.invoke(transport, null);
- }
- } catch (Exception e) {
- String msg = "Cannot invoke " + methodName + " on " +
transport;
- log.error(msg, e);
- throw new AxisFault(msg, e);
- }
- }
}
}
Modified: trunk/wsas/java/pom.xml
==============================================================================
--- trunk/wsas/java/pom.xml (original)
+++ trunk/wsas/java/pom.xml Thu Dec 20 09:14:03 2007
@@ -775,20 +775,25 @@
<version>${wso2dataservice.version}</version>
</dependency>
+ <dependency>
+ <groupId>mx4j</groupId>
+ <artifactId>mx4j</artifactId>
+ <version>${mx4j.version}</version>
+ </dependency>
</dependencies>
</dependencyManagement>
<ciManagement>
<system>bamboo</system>
- <url>http://builder.wso2.org/</url>
- <notifiers>
- <notifier>
- <type>mail</type>
- <configuration>
- <address>[email protected]</address>
- </configuration>
- </notifier>
- </notifiers>
+ <url>http://builder.wso2.org/</url>
+ <notifiers>
+ <notifier>
+ <type>mail</type>
+ <configuration>
+ <address>[email protected]</address>
+ </configuration>
+ </notifier>
+ </notifiers>
</ciManagement>
<dependencies>
@@ -965,13 +970,13 @@
<version>${wso2xfer.version}</version>
<type>mar</type>
</dependency>
- <dependency>
+ <dependency>
<groupId>org.wso2.xfer</groupId>
<artifactId>wso2xfer</artifactId>
<version>${wso2xfer.version}</version>
<type>jar</type>
</dependency>
-
+
<!-- Statistics mar-->
<dependency>
@@ -1001,10 +1006,10 @@
</dependency>
<!-- Throttle aar only with testing scope-->
<!--<dependency>-->
- <!--<groupId>org.wso2.throttle</groupId>-->
- <!--<artifactId>wso2throttle</artifactId>-->
- <!--<version>${wso2throttle.version}</version>-->
- <!--<scope>test</scope>-->
+ <!--<groupId>org.wso2.throttle</groupId>-->
+ <!--<artifactId>wso2throttle</artifactId>-->
+ <!--<version>${wso2throttle.version}</version>-->
+ <!--<scope>test</scope>-->
<!--</dependency>-->
<dependency>
<groupId>org.wso2.tracer</groupId>
@@ -2076,7 +2081,7 @@
<wsdlview.version>SNAPSHOT</wsdlview.version>
<wsdlconverter.version>SNAPSHOT</wsdlconverter.version>
<archive.validator.version>SNAPSHOT</archive.validator.version>
-
+ <mx4j.version>2.1.1</mx4j.version>
</properties>
<mailingLists>
_______________________________________________
Wsas-java-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/wsas-java-dev