[wsas-java-dev] svn commit r616 - in wsas/java/trunk/modules/core/src/org/wso2/wsas: deployment util

svn at wso2.com svn at wso2.com
Fri Jan 26 03:13:54 PST 2007


Author: azeez
Date: Fri Jan 26 03:13:38 2007
New Revision: 616

Modified:
   wsas/java/trunk/modules/core/src/org/wso2/wsas/deployment/DeploymentInterceptor.java
   wsas/java/trunk/modules/core/src/org/wso2/wsas/util/ModuleIdUtil.java
   wsas/java/trunk/modules/core/src/org/wso2/wsas/util/TraceFilterImpl.java
Log:
Do not persist admin services & modules, since this is not required



Modified: wsas/java/trunk/modules/core/src/org/wso2/wsas/deployment/DeploymentInterceptor.java
==============================================================================
--- wsas/java/trunk/modules/core/src/org/wso2/wsas/deployment/DeploymentInterceptor.java	(original)
+++ wsas/java/trunk/modules/core/src/org/wso2/wsas/deployment/DeploymentInterceptor.java	Fri Jan 26 03:13:38 2007
@@ -23,6 +23,8 @@
 import org.wso2.wsas.persistence.dataobject.ServiceIdentifierDO;
 import org.wso2.wsas.persistence.exception.ServiceNotFoundException;
 import org.wso2.wsas.util.HibernateConfigFactory;
+import org.wso2.wsas.util.AdminServicesFilter;
+import org.wso2.wsas.util.ModuleIdUtil;
 import org.apache.axiom.om.OMElement;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.description.AxisModule;
@@ -58,6 +60,12 @@
     }
 
     public void serviceGroupUpdate(AxisEvent axisEvent, AxisServiceGroup axisServiceGroup) {
+
+        // We do not persist Admin service events
+        if (AdminServicesFilter.isFiltered(axisServiceGroup.getServiceGroupName())) {
+            return;
+        }
+
         int eventType = axisEvent.getEventType();
         if (eventType == AxisEvent.SERVICE_DEPLOY) {
             ServiceGroupDO sgDO =
@@ -79,12 +87,19 @@
                     log.error(msg, e);
                 }
             }
-        } else if(eventType == AxisEvent.SERVICE_REMOVE){
+        } else if (eventType == AxisEvent.SERVICE_REMOVE) {
             // Nothing to do at the moment.
         }
     }
 
     public void serviceUpdate(AxisEvent axisEvent, AxisService axisService) {
+
+        // We do not persist Admin service events
+        if (AdminServicesFilter.
+                isFiltered(((AxisServiceGroup)axisService.getParent()).getServiceGroupName())) {
+            return;
+        }
+
         if (axisService.isClientSide()) {
             return;
         }
@@ -134,6 +149,16 @@
     }
 
     public void moduleUpdate(AxisEvent axisEvent, AxisModule axisModule) {
+
+        // We ignore admin module events
+        String moduleId = ModuleIdUtil.getModuleId(axisModule);
+        System.err.println("########## moduleId=" +moduleId);
+        if(moduleId.equals("wso2wsas-admin") ||
+                moduleId.equals("wso2tracer") ||
+                moduleId.equals("wso2statistics")){
+            return;
+        }
+
         int eventType = axisEvent.getEventType();
         if (eventType == AxisEvent.MODULE_REMOVE) {
             return;

Modified: wsas/java/trunk/modules/core/src/org/wso2/wsas/util/ModuleIdUtil.java
==============================================================================
--- wsas/java/trunk/modules/core/src/org/wso2/wsas/util/ModuleIdUtil.java	(original)
+++ wsas/java/trunk/modules/core/src/org/wso2/wsas/util/ModuleIdUtil.java	Fri Jan 26 03:13:38 2007
@@ -23,6 +23,8 @@
  * 
  */
 public class ModuleIdUtil {
+    private static final String SNAPSHOT = "-SNAPSHOT";
+
     public static QName getModuleName(String moduleId, String moduleVersion) {
         return (moduleVersion == null || moduleVersion.trim().length() == 0) ?
                new QName(moduleId) : new QName(moduleId + "-" + moduleVersion);
@@ -39,9 +41,9 @@
     }
 
     public static String getModuleId(QName name) {
-        String localPart = name.getLocalPart();
         String moduleId;
-        int index = localPart.indexOf("-");
+        String localPart = stripSnapshot(name.getLocalPart());
+        int index = localPart.lastIndexOf("-");
         if (index != -1) {
             moduleId = localPart.substring(0, index);
         } else {
@@ -50,14 +52,21 @@
         return moduleId;
     }
 
+    private static String stripSnapshot(String localPart) {
+        if(localPart.endsWith(SNAPSHOT)){
+            localPart = localPart.substring(0, localPart.indexOf(SNAPSHOT));
+        }
+        return localPart;
+    }
+
     public static String getModuleVersion(AxisModule axisModule) {
         return getModuleVersion(axisModule.getName());
     }
 
     public static String getModuleVersion(QName name) {
         String moduleVersion;
-        String localPart = name.getLocalPart();
-        int index = localPart.indexOf("-");
+        String localPart = stripSnapshot(name.getLocalPart());
+        int index = localPart.lastIndexOf("-");
         if (index != -1) {
             moduleVersion = localPart.substring(index + 1);
         } else {

Modified: wsas/java/trunk/modules/core/src/org/wso2/wsas/util/TraceFilterImpl.java
==============================================================================
--- wsas/java/trunk/modules/core/src/org/wso2/wsas/util/TraceFilterImpl.java	(original)
+++ wsas/java/trunk/modules/core/src/org/wso2/wsas/util/TraceFilterImpl.java	Fri Jan 26 03:13:38 2007
@@ -39,7 +39,7 @@
         }
         String serviceGroupName =
                 ((AxisServiceGroup) msgContext.getAxisService().getParent()).getServiceGroupName();
-        if(serviceGroupName.equals(ServerConstants.ADMINISTRATION_SERVICE_GROUP)){
+        if(AdminServicesFilter.isFiltered(serviceGroupName)){
             return true;
         }
 




More information about the Wsas-java-dev mailing list