[wsas-java-dev] svn commit r445 - in
wsas/java/trunk/modules/admin/src/org/wso2/wsas/admin/service:
. util
svn at wso2.com
svn at wso2.com
Tue Jan 16 02:09:26 PST 2007
Author: azeez
Date: Tue Jan 16 02:09:01 2007
New Revision: 445
Added:
wsas/java/trunk/modules/admin/src/org/wso2/wsas/admin/service/StatisticsClient.java
Modified:
wsas/java/trunk/modules/admin/src/org/wso2/wsas/admin/service/OperationAdmin.java
wsas/java/trunk/modules/admin/src/org/wso2/wsas/admin/service/ServerAdmin.java
wsas/java/trunk/modules/admin/src/org/wso2/wsas/admin/service/ServiceAdmin.java
wsas/java/trunk/modules/admin/src/org/wso2/wsas/admin/service/util/OperationMetaData.java
wsas/java/trunk/modules/admin/src/org/wso2/wsas/admin/service/util/ServerStatus.java
wsas/java/trunk/modules/admin/src/org/wso2/wsas/admin/service/util/ServiceMetaData.java
Log:
Introduces statistics client
Modified: wsas/java/trunk/modules/admin/src/org/wso2/wsas/admin/service/OperationAdmin.java
==============================================================================
--- wsas/java/trunk/modules/admin/src/org/wso2/wsas/admin/service/OperationAdmin.java (original)
+++ wsas/java/trunk/modules/admin/src/org/wso2/wsas/admin/service/OperationAdmin.java Tue Jan 16 02:09:01 2007
@@ -32,7 +32,6 @@
import org.wso2.wsas.persistence.exception.DuplicateEntityException;
import org.wso2.wsas.util.HibernateConfigFactory;
import org.wso2.wsas.util.ParameterUtil;
-import org.wso2.statistics.service.StatisticsStub;
import javax.xml.namespace.QName;
import java.util.ArrayList;
@@ -548,25 +547,20 @@
opMetaData.setControlOperation(axisOperation.isControlOperation());
try {
- StatisticsStub statService = new StatisticsStub();
- opMetaData.setOpRequestCount(statService.
- getOperationRequestCount(serviceName,
- operationName).get_return());
- opMetaData.setOpResponseCount(statService.
- getOperationResponseCount(serviceName,
- operationName).get_return());
- opMetaData.setOpFaultCount(statService.
- getOperationFaultCount(serviceName,
- operationName).get_return());
- opMetaData.setMaxResponseTime(statService.
- getMaxOperationResponseTime(serviceName,
- operationName).get_return());
- opMetaData.setMinResponseTime(statService.
- getMinOperationResponseTime(serviceName,
- operationName).get_return());
- opMetaData.setAvgResponseTime(statService.
- getAvgOperationResponseTime(serviceName,
- operationName).get_return());
+ StatisticsClient statClient = new StatisticsClient(configCtx);
+
+ opMetaData.setOpRequestCount(statClient.getOperationRequestCount(serviceName,
+ operationName));
+ opMetaData.setOpResponseCount(statClient.getOperationResponseCount(serviceName,
+ operationName));
+ opMetaData.setOpFaultCount(statClient.getOperationFaultCount(serviceName,
+ operationName));
+ opMetaData.setMaxResponseTime(statClient.getMaxOperationResponseTime(serviceName,
+ operationName));
+ opMetaData.setMinResponseTime(statClient.getMinOperationResponseTime(serviceName,
+ operationName));
+ opMetaData.setAvgResponseTime(statClient.getAvgOperationResponseTime(serviceName,
+ operationName));
} catch (Exception e) {
throw new AxisFault(e);
}
Modified: wsas/java/trunk/modules/admin/src/org/wso2/wsas/admin/service/ServerAdmin.java
==============================================================================
--- wsas/java/trunk/modules/admin/src/org/wso2/wsas/admin/service/ServerAdmin.java (original)
+++ wsas/java/trunk/modules/admin/src/org/wso2/wsas/admin/service/ServerAdmin.java Tue Jan 16 02:09:01 2007
@@ -39,7 +39,7 @@
}
public ServerStatus getStatus() throws AxisFault {
- ServerStatus serverStatus = new ServerStatus();
+ ServerStatus serverStatus = new ServerStatus(configCtx);
serverStatus.update(getAxisConfig());
return serverStatus;
}
Modified: wsas/java/trunk/modules/admin/src/org/wso2/wsas/admin/service/ServiceAdmin.java
==============================================================================
--- wsas/java/trunk/modules/admin/src/org/wso2/wsas/admin/service/ServiceAdmin.java (original)
+++ wsas/java/trunk/modules/admin/src/org/wso2/wsas/admin/service/ServiceAdmin.java Tue Jan 16 02:09:01 2007
@@ -29,7 +29,6 @@
import org.apache.neethi.PolicyReference;
import org.apache.neethi.PolicyRegistry;
import org.springframework.context.ApplicationContext;
-import org.wso2.statistics.service.StatisticsStub;
import org.wso2.utils.ArchiveManipulator;
import org.wso2.utils.FileManipulator;
import org.wso2.utils.ServerConfiguration;
@@ -296,19 +295,13 @@
ServiceMetaData smd = new ServiceMetaData();
try {
- StatisticsStub statService = new StatisticsStub();
- smd.setServiceRequestCount(statService.
- getServiceRequestCount(serviceName).get_return());
- smd.setServiceResponseCount(statService.
- getServiceResponseCount(serviceName).get_return());
- smd.setServiceFaultCount(statService.
- getServiceFaultCount(serviceName).get_return());
- smd.setMaxResponseTime(statService.
- getMaxServiceResponseTime(serviceName).get_return());
- smd.setMinResponseTime(statService.
- getMinServiceResponseTime(serviceName).get_return());
- smd.setAvgResponseTime(statService.
- getAvgServiceResponseTime(serviceName).get_return());
+ StatisticsClient statClient = new StatisticsClient(configCtx);
+ smd.setServiceRequestCount(statClient.getServiceRequestCount(serviceName));
+ smd.setServiceResponseCount(statClient.getServiceResponseCount(serviceName));
+ smd.setServiceFaultCount(statClient.getServiceFaultCount(serviceName));
+ smd.setMaxResponseTime(statClient.getMaxServiceResponseTime(serviceName));
+ smd.setMinResponseTime(statClient.getMinServiceResponseTime(serviceName));
+ smd.setAvgResponseTime(statClient.getAvgServiceResponseTime(serviceName));
} catch (Exception e) {
throw new AxisFault(e);
}
@@ -355,19 +348,13 @@
ServiceMetaData smd = new ServiceMetaData();
String serviceName = axisService.getName();
try {
- StatisticsStub statService = new StatisticsStub();
- smd.setServiceRequestCount(statService.
- getServiceRequestCount(serviceName).get_return());
- smd.setServiceResponseCount(statService.
- getServiceResponseCount(serviceName).get_return());
- smd.setServiceFaultCount(statService.
- getServiceFaultCount(serviceName).get_return());
- smd.setMaxResponseTime(statService.
- getMaxServiceResponseTime(serviceName).get_return());
- smd.setMinResponseTime(statService.
- getMinServiceResponseTime(serviceName).get_return());
- smd.setAvgResponseTime(statService.
- getAvgServiceResponseTime(serviceName).get_return());
+ StatisticsClient statClient = new StatisticsClient(configCtx);
+ smd.setServiceRequestCount(statClient.getServiceRequestCount(serviceName));
+ smd.setServiceResponseCount(statClient.getServiceResponseCount(serviceName));
+ smd.setServiceFaultCount(statClient.getServiceFaultCount(serviceName));
+ smd.setMaxResponseTime(statClient.getMaxServiceResponseTime(serviceName));
+ smd.setMinResponseTime(statClient.getMinServiceResponseTime(serviceName));
+ smd.setAvgResponseTime(statClient.getAvgServiceResponseTime(serviceName));
} catch (Exception e) {
throw new AxisFault(e);
}
Added: wsas/java/trunk/modules/admin/src/org/wso2/wsas/admin/service/StatisticsClient.java
==============================================================================
--- (empty file)
+++ wsas/java/trunk/modules/admin/src/org/wso2/wsas/admin/service/StatisticsClient.java Tue Jan 16 02:09:01 2007
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2004,2005 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.wso2.wsas.admin.service;
+
+import org.wso2.statistics.service.StatisticsStub;
+import org.wso2.statistics.service.GetSystemRequestCountFaultException;
+import org.wso2.utils.NetworkUtils;
+import org.wso2.wsas.ServerManager;
+import org.wso2.wsas.ServerConstants;
+import org.apache.axis2.context.ConfigurationContext;
+
+import java.rmi.RemoteException;
+
+/**
+ *
+ */
+public class StatisticsClient {
+
+ private StatisticsStub stub;
+
+ public StatisticsClient(ConfigurationContext configCtx) throws Exception{
+ stub = new StatisticsStub(null,
+ "http://" + NetworkUtils.getLocalHostname() +
+ ":" + ServerManager.httpPort + configCtx.getServiceContextPath() +
+ "/" + ServerConstants.STATISTICS_SERVICE_GROUP);
+ }
+
+ public int getSystemRequestCount() throws Exception {
+ return stub.getSystemRequestCount().get_return();
+ }
+
+ public int getSystemResponseCount() throws Exception {
+ return stub.getSystemResponseCount().get_return();
+ }
+
+ public int getSystemFaultCount() throws Exception {
+ return stub.getSystemFaultCount().get_return();
+ }
+
+ public double getAvgSystemResponseTime() throws Exception {
+ return stub.getAvgSystemResponseTime().get_return();
+ }
+
+ public long getMaxSystemResponseTime() throws Exception {
+ return stub.getMaxSystemResponseTime().get_return();
+ }
+
+ public long getMinSystemResponseTime() throws Exception {
+ return stub.getMinSystemResponseTime().get_return();
+ }
+
+ public long getOperationRequestCount(String serviceName,
+ String operationName) throws Exception {
+ return stub.getOperationRequestCount(serviceName,
+ operationName).get_return();
+ }
+
+ public long getOperationResponseCount(String serviceName,
+ String operationName) throws Exception {
+ return stub.getOperationResponseCount(serviceName,
+ operationName).get_return();
+ }
+
+ public long getOperationFaultCount(String serviceName,
+ String operationName) throws Exception {
+ return stub.getOperationFaultCount(serviceName,
+ operationName).get_return();
+ }
+
+ public long getMaxOperationResponseTime(String serviceName,
+ String operationName) throws Exception {
+ return stub.getMaxOperationResponseTime(serviceName, operationName).get_return();
+ }
+
+ public long getMinOperationResponseTime(String serviceName,
+ String operationName) throws Exception {
+ return stub.getMinOperationResponseTime(serviceName, operationName).get_return();
+ }
+
+ public double getAvgOperationResponseTime(String serviceName,
+ String operationName) throws Exception {
+ return stub.getAvgOperationResponseTime(serviceName, operationName).get_return();
+ }
+
+ public long getServiceRequestCount(String serviceName) throws Exception {
+ return stub.getServiceRequestCount(serviceName).get_return();
+ }
+
+ public long getServiceResponseCount(String serviceName) throws Exception {
+ return stub.getServiceResponseCount(serviceName).get_return();
+ }
+
+ public long getServiceFaultCount(String serviceName) throws Exception {
+ return stub.getServiceFaultCount(serviceName).get_return();
+ }
+
+ public long getMaxServiceResponseTime(String serviceName) throws Exception {
+ return stub.getMaxServiceResponseTime(serviceName).get_return();
+ }
+
+ public long getMinServiceResponseTime(String serviceName) throws Exception {
+ return stub.getMinServiceResponseTime(serviceName).get_return();
+ }
+
+ public double getAvgServiceResponseTime(String serviceName) throws Exception {
+ return stub.getAvgServiceResponseTime(serviceName).get_return();
+ }
+}
Modified: wsas/java/trunk/modules/admin/src/org/wso2/wsas/admin/service/util/OperationMetaData.java
==============================================================================
--- wsas/java/trunk/modules/admin/src/org/wso2/wsas/admin/service/util/OperationMetaData.java (original)
+++ wsas/java/trunk/modules/admin/src/org/wso2/wsas/admin/service/util/OperationMetaData.java Tue Jan 16 02:09:01 2007
@@ -17,9 +17,9 @@
public class OperationMetaData {
private String name;
- private int opRequestCount;
- private int opResponseCount;
- private int opFaultCount;
+ private long opRequestCount;
+ private long opResponseCount;
+ private long opFaultCount;
private long maxResponseTime = 0;
private long minResponseTime = 0;
private double avgResponseTime = 0;
@@ -48,7 +48,7 @@
*
* @return Value for property 'opRequestCount'.
*/
- public int getOpRequestCount() {
+ public long getOpRequestCount() {
return opRequestCount;
}
@@ -57,7 +57,7 @@
*
* @param opRequestCount Value to set for property 'opRequestCount'.
*/
- public void setOpRequestCount(int opRequestCount) {
+ public void setOpRequestCount(long opRequestCount) {
this.opRequestCount = opRequestCount;
}
@@ -66,7 +66,7 @@
*
* @return Value for property 'opResponseCount'.
*/
- public int getOpResponseCount() {
+ public long getOpResponseCount() {
return opResponseCount;
}
@@ -75,7 +75,7 @@
*
* @param opResponseCount Value to set for property 'opResponseCount'.
*/
- public void setOpResponseCount(int opResponseCount) {
+ public void setOpResponseCount(long opResponseCount) {
this.opResponseCount = opResponseCount;
}
@@ -84,7 +84,7 @@
*
* @return Value for property 'opFaultCount'.
*/
- public int getOpFaultCount() {
+ public long getOpFaultCount() {
return opFaultCount;
}
@@ -93,7 +93,7 @@
*
* @param opFaultCount Value to set for property 'opFaultCount'.
*/
- public void setOpFaultCount(int opFaultCount) {
+ public void setOpFaultCount(long opFaultCount) {
this.opFaultCount = opFaultCount;
}
Modified: wsas/java/trunk/modules/admin/src/org/wso2/wsas/admin/service/util/ServerStatus.java
==============================================================================
--- wsas/java/trunk/modules/admin/src/org/wso2/wsas/admin/service/util/ServerStatus.java (original)
+++ wsas/java/trunk/modules/admin/src/org/wso2/wsas/admin/service/util/ServerStatus.java Tue Jan 16 02:09:01 2007
@@ -16,13 +16,14 @@
package org.wso2.wsas.admin.service.util;
import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.AxisServiceGroup;
import org.apache.axis2.description.Parameter;
import org.apache.axis2.engine.AxisConfiguration;
-import org.wso2.statistics.service.StatisticsStub;
import org.wso2.utils.ServerConfiguration;
import org.wso2.wsas.ServerConstants;
+import org.wso2.wsas.admin.service.StatisticsClient;
import java.text.SimpleDateFormat;
import java.util.Date;
@@ -49,6 +50,16 @@
private static final long KB_IN_BYTES = 1024;
private static final int SECONDS_PER_DAY = 3600 * 24;
+ private StatisticsClient statClient;
+
+ public ServerStatus(ConfigurationContext configCtx) throws AxisFault{
+ try {
+ statClient = new StatisticsClient(configCtx);
+ } catch (Exception e) {
+ throw new AxisFault(e);
+ }
+ }
+
public void update(AxisConfiguration axisConfig) throws AxisFault {
Parameter systemStartTime =
axisConfig.getParameter("wso2statistics.server.start.time");
@@ -58,13 +69,12 @@
systemUpTime = (getTime((System.currentTimeMillis() - startTime) / 1000));
try {
- StatisticsStub statisticsService = new StatisticsStub();
- requestCount = statisticsService.getSystemRequestCount().get_return();
- responseCount = statisticsService.getSystemResponseCount().get_return();
- faultCount = statisticsService.getSystemFaultCount().get_return();
- avgResponseTime = statisticsService.getAvgSystemResponseTime().get_return();
- maxResponseTime = statisticsService.getMaxSystemResponseTime().get_return();
- minResponseTime = statisticsService.getMinSystemResponseTime().get_return();
+ requestCount = statClient.getSystemRequestCount();
+ responseCount = statClient.getSystemResponseCount();
+ faultCount = statClient.getSystemFaultCount();
+ avgResponseTime = statClient.getAvgSystemResponseTime();
+ maxResponseTime = statClient.getMaxSystemResponseTime();
+ minResponseTime = statClient.getMinSystemResponseTime();
} catch (Exception e) {
throw new AxisFault(e);
}
Modified: wsas/java/trunk/modules/admin/src/org/wso2/wsas/admin/service/util/ServiceMetaData.java
==============================================================================
--- wsas/java/trunk/modules/admin/src/org/wso2/wsas/admin/service/util/ServiceMetaData.java (original)
+++ wsas/java/trunk/modules/admin/src/org/wso2/wsas/admin/service/util/ServiceMetaData.java Tue Jan 16 02:09:01 2007
@@ -22,9 +22,9 @@
private boolean active;
private String description;
private String[] operations;
- private int serviceRequestCount;
- private int serviceResponseCount;
- private int serviceFaultCount;
+ private long serviceRequestCount;
+ private long serviceResponseCount;
+ private long serviceFaultCount;
private long maxResponseTime = 0;
private long minResponseTime = 0;
private double avgResponseTime = 0;
@@ -87,27 +87,27 @@
this.operations = operations;
}
- public int getServiceRequestCount() {
+ public long getServiceRequestCount() {
return serviceRequestCount;
}
- public void setServiceRequestCount(int serviceRequestCount) {
+ public void setServiceRequestCount(long serviceRequestCount) {
this.serviceRequestCount = serviceRequestCount;
}
- public int getServiceResponseCount() {
+ public long getServiceResponseCount() {
return serviceResponseCount;
}
- public void setServiceResponseCount(int serviceResponseCount) {
+ public void setServiceResponseCount(long serviceResponseCount) {
this.serviceResponseCount = serviceResponseCount;
}
- public int getServiceFaultCount() {
+ public long getServiceFaultCount() {
return serviceFaultCount;
}
- public void setServiceFaultCount(int serviceFaultCount) {
+ public void setServiceFaultCount(long serviceFaultCount) {
this.serviceFaultCount = serviceFaultCount;
}
More information about the Wsas-java-dev
mailing list