[Carbon-dev] svn commit r15525 - in trunk/carbon: core/src/org/wso2/carbon core/src/org/wso2/carbon/deployment core/src/org/wso2/carbon/persistence distribution/carbon-home/registry/WSO2REGISTRY_DB distribution/carbon-home/registry/WSO2REGISTRY_DB/log distribution/carbon-home/registry/WSO2REGISTRY_DB/seg0

svn at wso2.org svn at wso2.org
Thu Apr 3 05:05:24 PDT 2008


Author: azeez
Date: Thu Apr  3 05:05:02 2008
New Revision: 15525

Log:

Updated registry
Adding module engagements as associations



Modified:
   trunk/carbon/core/src/org/wso2/carbon/RegistryResources.java
   trunk/carbon/core/src/org/wso2/carbon/deployment/DeploymentInterceptor.java
   trunk/carbon/core/src/org/wso2/carbon/persistence/PersistenceManager.java
   trunk/carbon/distribution/carbon-home/registry/WSO2REGISTRY_DB/db.lck
   trunk/carbon/distribution/carbon-home/registry/WSO2REGISTRY_DB/log/log1.dat
   trunk/carbon/distribution/carbon-home/registry/WSO2REGISTRY_DB/seg0/c10.dat
   trunk/carbon/distribution/carbon-home/registry/WSO2REGISTRY_DB/seg0/c180.dat
   trunk/carbon/distribution/carbon-home/registry/WSO2REGISTRY_DB/seg0/c1a1.dat
   trunk/carbon/distribution/carbon-home/registry/WSO2REGISTRY_DB/seg0/c1b1.dat
   trunk/carbon/distribution/carbon-home/registry/WSO2REGISTRY_DB/seg0/c230.dat
   trunk/carbon/distribution/carbon-home/registry/WSO2REGISTRY_DB/seg0/c241.dat
   trunk/carbon/distribution/carbon-home/registry/WSO2REGISTRY_DB/seg0/c380.dat
   trunk/carbon/distribution/carbon-home/registry/WSO2REGISTRY_DB/seg0/c391.dat
   trunk/carbon/distribution/carbon-home/registry/WSO2REGISTRY_DB/seg0/c3a1.dat
   trunk/carbon/distribution/carbon-home/registry/WSO2REGISTRY_DB/seg0/c3b1.dat
   trunk/carbon/distribution/carbon-home/registry/WSO2REGISTRY_DB/seg0/cf0.dat
   trunk/carbon/distribution/carbon-home/registry/WSO2REGISTRY_DB/service.properties

Modified: trunk/carbon/core/src/org/wso2/carbon/RegistryResources.java
==============================================================================
--- trunk/carbon/core/src/org/wso2/carbon/RegistryResources.java	(original)
+++ trunk/carbon/core/src/org/wso2/carbon/RegistryResources.java	Thu Apr  3 05:05:02 2008
@@ -36,7 +36,7 @@
 
     public static final class ServiceProperties {
         public static final String OPERATIONS = "/operations/";
-        
+
         public static final String DOCUMENTATION = "service.documentation";
         public static final String ACTIVE = "service.active";
         public static final String POLICY_TYPE = "policy.type";
@@ -55,4 +55,9 @@
         public static final String POLICY_TYPE = "policy.type";
         public static final String POLICY_UUID = "policy.uuid";
     }
+
+    public static final class Associations {
+        public static final String ENGAGED_MODULES = "engaged.modules";
+        public static final String EXPOSED_TRANSPORTS = "exposed.transports";
+    }
 }

Modified: trunk/carbon/core/src/org/wso2/carbon/deployment/DeploymentInterceptor.java
==============================================================================
--- trunk/carbon/core/src/org/wso2/carbon/deployment/DeploymentInterceptor.java	(original)
+++ trunk/carbon/core/src/org/wso2/carbon/deployment/DeploymentInterceptor.java	Thu Apr  3 05:05:02 2008
@@ -73,7 +73,6 @@
 
                 // Check whether the artifact has been updated, if so we need to purge all
                 // database entries and treat this as a new service group addition
-                //TODO: AZEEZ
                 if (! new Long(serviceGroup.getProperty(RegistryResources.ServiceGroupProperties.LAST_UPDATED)).
                         equals(CarbonUtils.lastUpdatedTime(axisServiceGroup))) {
 
@@ -111,8 +110,8 @@
     private void deleteServiceGroup(AxisServiceGroup axisServiceGroup) {
         try {
             persistenceMgr.deleteServiceGroup(axisServiceGroup);
-        } catch (ServiceGroupNotFoundException e) {
-            log.error("Service group not found", e);
+        } catch (RegistryException e) {
+            log.error("Could not delete service group " + axisServiceGroup.getServiceGroupName(), e);
         }
     }
 

Modified: trunk/carbon/core/src/org/wso2/carbon/persistence/PersistenceManager.java
==============================================================================
--- trunk/carbon/core/src/org/wso2/carbon/persistence/PersistenceManager.java	(original)
+++ trunk/carbon/core/src/org/wso2/carbon/persistence/PersistenceManager.java	Thu Apr  3 05:05:02 2008
@@ -33,13 +33,10 @@
 import org.apache.neethi.PolicyEngine;
 import org.apache.neethi.PolicyReference;
 import org.apache.neethi.PolicyRegistry;
-import org.hibernate.Session;
-import org.hibernate.Transaction;
 import org.wso2.carbon.RegistryResources;
 import org.wso2.carbon.ServerManager;
 import org.wso2.carbon.persistence.dao.BaseDAO;
 import org.wso2.carbon.persistence.dao.KeyStoreDAO;
-import org.wso2.carbon.persistence.dao.MessageDAO;
 import org.wso2.carbon.persistence.dao.ModuleDAO;
 import org.wso2.carbon.persistence.dao.OperationDAO;
 import org.wso2.carbon.persistence.dao.ServiceDAO;
@@ -49,7 +46,6 @@
 import org.wso2.carbon.persistence.dao.UserRoleDAO;
 import org.wso2.carbon.persistence.dataobject.AbstractDataObject;
 import org.wso2.carbon.persistence.dataobject.KeyStoreDO;
-import org.wso2.carbon.persistence.dataobject.MessageDO;
 import org.wso2.carbon.persistence.dataobject.ModuleDO;
 import org.wso2.carbon.persistence.dataobject.ModuleIdentifierDO;
 import org.wso2.carbon.persistence.dataobject.ModuleParameterDO;
@@ -83,6 +79,7 @@
 import org.wso2.registry.Registry;
 import org.wso2.registry.RegistryException;
 import org.wso2.registry.Resource;
+import org.wso2.registry.Association;
 import org.wso2.registry.exceptions.ResourceNotFoundException;
 
 import javax.xml.namespace.QName;
@@ -162,8 +159,8 @@
                 RegistryResources.SERVICE_GROUPS +
                 axisService.getAxisServiceGroup().getServiceGroupName() +
                 RegistryResources.SERVICES + axisService.getName();
-        if(registry.resourceExists(serviceResourcePath)){
-           return registry.get(serviceResourcePath);
+        if (registry.resourceExists(serviceResourcePath)) {
+            return registry.get(serviceResourcePath);
         }
         return null;
     }
@@ -311,13 +308,12 @@
         }
     }
 
-    public void deleteServiceGroup(AxisServiceGroup serviceGroup)
-            throws ServiceGroupNotFoundException {
+    public void deleteServiceGroup(AxisServiceGroup serviceGroup) throws RegistryException {
         Iterator services = serviceGroup.getServices();
         if (services.hasNext() && ((AxisService) services.next()).isClientSide()) {
             return;
         }
-        new ServiceGroupDAO(hbConfig).deleteServiceGroup(serviceGroup.getServiceGroupName());
+        registry.delete(RegistryResources.SERVICE_GROUPS + serviceGroup.getServiceGroupName() );
     }
 
     public ServiceUserDO[] getUsersForService(String serviceId,
@@ -525,102 +521,95 @@
             return;
         }
 
-        Collection service = registry.newCollection();
-        service.setProperty(RegistryResources.ServiceProperties.DOCUMENTATION,
-                            axisService.getDocumentation());
-        service.setProperty(RegistryResources.ServiceProperties.EXPOSED_ON_ALL_TANSPORTS,
-                            String.valueOf(axisService.isEnableAllTransports()));
-        String serviceResourcePath =
-                RegistryResources.SERVICE_GROUPS +
-                axisService.getAxisServiceGroup().getServiceGroupName() +
-                RegistryResources.SERVICES + axisService.getName();
-        registry.put(serviceResourcePath, service);
+        try {
+            registry.beginTransaction();
+            Collection service = registry.newCollection();
+            service.setProperty(RegistryResources.ServiceProperties.DOCUMENTATION,
+                                axisService.getDocumentation());
+            service.setProperty(RegistryResources.ServiceProperties.EXPOSED_ON_ALL_TANSPORTS,
+                                String.valueOf(axisService.isEnableAllTransports()));
+            String serviceResourcePath =
+                    RegistryResources.SERVICE_GROUPS +
+                    axisService.getAxisServiceGroup().getServiceGroupName() +
+                    RegistryResources.SERVICES + axisService.getName();
+            registry.put(serviceResourcePath, service);
+
+            // Add the Service Policies
+            List<Resource> servicePolicies = getServicePolicies(axisService);
+            for (Resource servicePolicy : servicePolicies) {
+                registry.put(serviceResourcePath + RegistryResources.POLICIES +
+                             servicePolicy.getProperty(RegistryResources.ModuleProperties.POLICY_UUID),
+                             servicePolicy);
+            }
 
-        // Add the Service Policies
-        List<Resource> servicePolicies = getServicePolicies(axisService);
-        for (Resource servicePolicy : servicePolicies) {
-            registry.put(serviceResourcePath + RegistryResources.POLICIES +
-                         servicePolicy.getProperty(RegistryResources.ModuleProperties.POLICY_UUID),
-                         servicePolicy);
-        }
-
-        // Add the Service Operations
-        for (Iterator iter = axisService.getOperations(); iter.hasNext();) {
-            AxisOperation axisOperation = (AxisOperation) iter.next();
-            Resource operation = registry.newResource();
-            operation.setContent(axisOperation.getName());
-            String doc = axisOperation.getDocumentation();
-            if (doc != null) {
-                operation.setProperty(RegistryResources.ServiceProperties.DOCUMENTATION, doc);
+            // Add the Service Operations
+            for (Iterator iter = axisService.getOperations(); iter.hasNext();) {
+                AxisOperation axisOperation = (AxisOperation) iter.next();
+                Resource operation = registry.newResource();
+                operation.setContent(axisOperation.getName());
+                String doc = axisOperation.getDocumentation();
+                if (doc != null) {
+                    operation.setProperty(RegistryResources.ServiceProperties.DOCUMENTATION, doc);
+                }
+                operation.setProperty(RegistryResources.NAME, axisOperation.getName().getLocalPart());
+                registry.put(serviceResourcePath + RegistryResources.ServiceProperties.OPERATIONS +
+                             axisOperation.getName().getLocalPart(),
+                             operation);
             }
-            operation.setProperty(RegistryResources.NAME, axisOperation.getName().getLocalPart());
-            registry.put(serviceResourcePath + RegistryResources.ServiceProperties.OPERATIONS +
-                         axisOperation.getName().getLocalPart(),
-                         operation);
-        }
 
-        // If the service scope='soapsession' we need to engage addressing if not already
-        // engaged.
-        if (axisService.getScope().equals(Constants.SCOPE_SOAP_SESSION)) {
-            if (!axisService.isEngaged("addressing")) {
-                axisService.engageModule(axisService.getAxisConfiguration().getModule("addressing"));
+            // If the service scope='soapsession' we need to engage addressing if not already
+            // engaged.
+            if (axisService.getScope().equals(Constants.SCOPE_SOAP_SESSION)) {
+                if (!axisService.isEngaged("addressing")) {
+                    axisService.engageModule(axisService.getAxisConfiguration().getModule("addressing"));
+                }
             }
-        }
 
-        try {
             if (log.isDebugEnabled()) {
                 log.debug("Added new service - " + axisService.getName());
             }
 
             // Add the Modules Engaged to this service
-            //TODO AZEEZ
-            /*ModuleDAO modDAO = new ModuleDAO(hbConfig);
-            for (Iterator serviceModuleEngagementIter = axisService.getEngagedModules().iterator();
-                 serviceModuleEngagementIter.hasNext();) {
-                AxisModule axisModule = (AxisModule) serviceModuleEngagementIter.next();
+            for (Object o1 : axisService.getEngagedModules()) {
+                AxisModule axisModule = (AxisModule) o1;
                 String moduleName = axisModule.getName();
                 String moduleVersion = axisModule.getVersion();
                 if (moduleVersion == null) {
-                    moduleVersion = "";
+                    moduleVersion = "SNAPSHOT";
                 }
+
                 if (!axisService.getParent().isEngaged(axisModule.getName())) {
-                    ModuleDO moduleDO = modDAO.getModule(moduleName, moduleVersion, session);
-                    if (moduleDO != null && !moduleDO.getEngagedServices().contains(serviceDO)) {
-                        moduleDO.addService(serviceDO);
-                        session.update(moduleDO);
-                        session.update(serviceDO);
-                    }
+                    String moduleResourcePath =
+                            RegistryResources.MODULES + moduleName + "/" + moduleVersion;
+                    registry.addAssociation(RegistryResources.Associations.ENGAGED_MODULES,
+                                            serviceResourcePath,
+                                            moduleResourcePath);
                 }
-            }*/
+            }
 
             // Save the operation-module engagements
-            //TODO AZEEZ
-            /*OperationDAO opDAO = new OperationDAO(hbConfig);
             for (Iterator iter = axisService.getOperations(); iter.hasNext();) {
                 AxisOperation axisOperation = (AxisOperation) iter.next();
-                for (Iterator opModuleEngagementIter = axisOperation.getEngagedModules().iterator();
-                     opModuleEngagementIter.hasNext();) {
-                    AxisModule axisModule = (AxisModule) opModuleEngagementIter.next();
+                for (Object o : axisOperation.getEngagedModules()) {
+                    AxisModule axisModule = (AxisModule) o;
                     if (!axisService.isEngaged(axisModule.getName())) {
-                        OperationDO opDO = opDAO.getOperation(axisService.getName(),
-                                                              ServiceIdentifierDO.EMPTY_SERVICE_VERSION,
-                                                              axisOperation.getName().getLocalPart(),
-                                                              session);
                         String moduleName = axisModule.getName();
                         String moduleVersion = axisModule.getVersion();
                         if (moduleVersion == null) {
-                            moduleVersion = "";
-                        }
-                        ModuleDO moduleDO = modDAO.getModule(moduleName, moduleVersion, session);
-                        if (moduleDO != null &&
-                            !moduleDO.getEngagedOperations().contains(serviceDO)) {
-                            moduleDO.addOperation(opDO);
-                            session.update(moduleDO);
-                            session.update(opDO);
+                            moduleVersion = "SNAPSHOT";
                         }
+                        String moduleResourcePath =
+                                RegistryResources.MODULES + moduleName + "/" + moduleVersion;
+                        String opResourcePath =
+                                serviceResourcePath + "/" +
+                                RegistryResources.ServiceProperties.OPERATIONS +
+                                axisOperation.getName().getLocalPart();
+                        registry.addAssociation(RegistryResources.Associations.ENGAGED_MODULES,
+                                                opResourcePath,
+                                                moduleResourcePath);
                     }
                 }
-            }*/
+            }
 
             // add the service parameters
             for (Object o : axisService.getParameters()) {
@@ -648,21 +637,21 @@
                 }
             }
 
-            //TODO: AZEEZ add transport associations
-            /*if (!axisService.isEnableAllTransports()) {
+            // add transport associations
+            if (!axisService.isEnableAllTransports()) {
                 List exposedTransports = axisService.getExposedTransports();
-                TransportDAO transportDAO = new TransportDAO(hbConfig);
-                for (Iterator iterator = exposedTransports.iterator(); iterator.hasNext();) {
-                    TransportDO transportDO = transportDAO.getTransport((String) iterator.next(),
-                                                                        session);
-                    serviceDO.addTransport(transportDO);
+                for (Object exposedTransport : exposedTransports) {
+                    String transportResource =
+                            RegistryResources.TRANSPORTS + exposedTransport;
+                    registry.addAssociation(RegistryResources.Associations.EXPOSED_TRANSPORTS,
+                                            serviceResourcePath, transportResource);
                 }
-            }*/
+            }
 
-            //TODO registry.commit
+            registry.commitTransaction();
         } catch (Exception e) {
             log.error("Unable to handle new service addition", e);
-            //TODO registry.rollback();
+            registry.rollbackTransaction();
             throw e;
         }
     }
@@ -782,11 +771,8 @@
                                           AxisService axisService,
                                           AxisConfiguration axisConfig) throws Exception {
 
-        Session session = hbConfig.currentSession();
-        Transaction tx = session.beginTransaction();
-
         try {
-            serviceDO = (ServiceDO) session.load(ServiceDO.class, serviceDO.getId());
+            registry.beginTransaction();
 
             // Load policies from DB in AxisService object. All other policies contained within
             // axisService will be rendered invalid by this time
@@ -805,14 +791,7 @@
                 paramDO.getValue();
                 ByteArrayInputStream bais =
                         new ByteArrayInputStream(paramDO.getValue().getBytes());
-                StAXOMBuilder builder;
-                try {
-                    builder = new StAXOMBuilder(bais);
-                } catch (XMLStreamException e) {
-                    String msg = "Unable to set service parameter";
-                    log.error(msg, e);
-                    throw new AxisFault(msg, e);
-                }
+                StAXOMBuilder builder = new StAXOMBuilder(bais);
                 Parameter parameter = ParameterUtil.createParameter(builder.getDocumentElement());
                 Parameter p = axisService.getParameter(paramDO.getName());
                 if (p != null) {
@@ -911,13 +890,13 @@
 
             // Activate/Deactivate service
             axisService.setActive(serviceDO.getIsActive());
-            tx.commit();
+            registry.commitTransaction();
             if (log.isDebugEnabled()) {
                 log.debug("Initialized service - " + serviceDO.getServiceIdentifierDO().getServiceId());
             }
         } catch (Exception e) {
+            registry.rollbackTransaction();
             log.error("Unable to handle service initialization", e);
-            tx.rollback();
             throw e;
         }
     }
@@ -934,25 +913,19 @@
         return false;
     }
 
-    public void handleExistingServiceGroupInit(Resource sg,
+    public void handleExistingServiceGroupInit(Resource sgResource,
                                                AxisServiceGroup serviceGroup) throws Exception {
 
         try {
-            String paramResource = sg.getPath() + RegistryResources.PARAMETERS;
+            String paramResource = sgResource.getPath() + RegistryResources.PARAMETERS;
+            registry.beginTransaction();
 
             // Add the Service Group Parameters
             if (registry.resourceExists(paramResource)) {
                 Collection parameters = (Collection) registry.get(paramResource);
                 for (String param : parameters.getChildren()) {
                     Resource resource = registry.get(param);
-                    StAXOMBuilder builder;
-                    try {
-                        builder = new StAXOMBuilder(resource.getContentStream());
-                    } catch (XMLStreamException e) {
-                        String msg = "Unable to set service group parameter";
-                        log.error(msg, e);
-                        throw new AxisFault(msg, e);
-                    }
+                    StAXOMBuilder builder = new StAXOMBuilder(resource.getContentStream());
                     Parameter parameter = ParameterUtil.createParameter(builder.getDocumentElement());
                     Parameter p = serviceGroup.getParameter(resource.getProperty(RegistryResources.NAME));
                     if (p != null) {
@@ -971,20 +944,25 @@
             serviceGroup.getEngagedModules().clear();
 
             // Engage modules to service group
-            //TODO AZEEZ
-            /*for (Iterator iter = sg.getEngagedModules().iterator(); iter.hasNext();) {
-                ModuleDO moduleDO = (ModuleDO) iter.next();
-                ModuleIdentifierDO modID = moduleDO.getModuleIdentifierDO();
-                AxisModule axisModule = axisConfig.getModule(modID.getName(), modID.getVersion());
-                if (!isGloballyEngaged(modID.getName(), modID.getVersion(), session)) {
+            Association[] associations =
+                    registry.getAssociations(sgResource.getPath(), RegistryResources.Associations.ENGAGED_MODULES);
+            for (Association association : associations) {
+                String moduleResourcePath = association.getDestinationPath();
+                Resource moduleResource = registry.get(moduleResourcePath);
+                String moduleName = moduleResource.getProperty(RegistryResources.ModuleProperties.NAME);
+                String moduleVersion = moduleResource.getProperty(RegistryResources.ModuleProperties.VERSION);
+                AxisModule axisModule = axisConfig.getModule(moduleName, moduleVersion);
+                if (!isGloballyEngaged(moduleName, moduleVersion)) {
                     serviceGroup.disengageModule(axisModule);
                     serviceGroup.engageModule(axisModule);
                 }
-            }*/
+            }
+            registry.commitTransaction();
             if (log.isDebugEnabled()) {
                 log.debug("Initialized Service Group - " + serviceGroup.getServiceGroupName());
             }
         } catch (Exception e) {
+            registry.rollbackTransaction();
             log.error("Unable to handle service group init", e);
             throw e;
         }
@@ -995,64 +973,56 @@
         if (services.hasNext() && ((AxisService) services.next()).isClientSide()) {
             return;
         }
-        Resource sg = registry.newCollection();
-        sg.addProperty(RegistryResources.ServiceGroupProperties.LAST_UPDATED,
-                       CarbonUtils.lastUpdatedTime(serviceGroup).toString());
-        String sgName = serviceGroup.getServiceGroupName();
-        sg.setProperty(RegistryResources.NAME, sgName);
-        AxisConfiguration axisConfiguration = serviceGroup.getAxisConfiguration();
+
         try {
-//            ModuleDAO moduleDAO = new ModuleDAO(hbConfig);
+            registry.beginTransaction();
+            Resource sg = registry.newCollection();
+            sg.addProperty(RegistryResources.ServiceGroupProperties.LAST_UPDATED,
+                           CarbonUtils.lastUpdatedTime(serviceGroup).toString());
+            String sgName = serviceGroup.getServiceGroupName();
+            String sgResourcePath = RegistryResources.SERVICE_GROUPS + sgName;
+            registry.put(sgResourcePath, sg);
+            
+            AxisConfiguration axisConfiguration = serviceGroup.getAxisConfiguration();
 
             // Handle ServiceGroup-Module engagement
-            //TODO: AZEEZ handle this when the Registry impl is ready
-            /*for (Iterator iter = serviceGroup.getEngagedModules().iterator(); iter.hasNext();) {
-                AxisModule axisModule = (AxisModule) iter.next();
+            for (Object o : serviceGroup.getEngagedModules()) {
+                AxisModule axisModule = (AxisModule) o;
                 if (!axisConfiguration.isEngaged(axisModule.getName())) {
-
-                    Resource module = registry.get(RegistryResources.MODULES + axisModule.getName() + "/" + axisModule.getVersion());
-
-
-                    registry.addDependencies("", new String[]{});
-
-                    ModuleDO moduleDO =
-                            moduleDAO.getModule(axisModule.getName(),
-                                                axisModule.getVersion(),
-                                                session);
-                    if (moduleDO != null && moduleDO.getEngagedServiceGroups().contains(sg)) {
-                        sg.addModule(moduleDO);
-                    }
+                    String moduleResourcePath =
+                            RegistryResources.MODULES + axisModule.getName() + "/" + axisModule.getVersion();
+                    registry.addAssociation(RegistryResources.Associations.ENGAGED_MODULES,
+                                            sgResourcePath, moduleResourcePath);
                 }
-            }*/
+            }
 
             // Handle Service Group Parameters
-            //TODO: AZEEZ handle this when the Registry impl is ready
-            /*for (Iterator iter = serviceGroup.getParameters().iterator(); iter.hasNext();) {
-                Parameter parameter = (Parameter) iter.next();
+            for (Object o : serviceGroup.getParameters()) {
+                Parameter parameter = (Parameter) o;
                 if (parameter.getName() != null && parameter.getName().trim().length() != 0) {
-                    ServiceGroupParameterDO paramDO = new ServiceGroupParameterDO();
-                    paramDO.setName(parameter.getName());
+                    Resource param = registry.newResource();
                     if (parameter.getParameterElement() != null) {
-                        paramDO.setValue(parameter.getParameterElement().toString());
-                        paramDO.setServiceGroup(sg);
+                        param.setProperty(RegistryResources.NAME, parameter.getName());
+                        param.setContent(parameter.getParameterElement().toString());
                     }
                 }
-            }*/
-            registry.put(RegistryResources.SERVICE_GROUPS + sgName, sg);
+            }
+            registry.commitTransaction();
+            if (log.isDebugEnabled()) {
+                log.debug("Added new service group - " + sgName);
+            }
         } catch (Exception e) {
+            registry.rollbackTransaction();
             log.error("Unable to handle new service group addition", e);
             throw e;
         }
-        if (log.isDebugEnabled()) {
-            log.debug("Added new service group - " + sgName);
-        }
     }
 
     public void handleNewModuleAddition(AxisModule axisModule,
                                         String moduleName,
                                         String moduleVersion) throws Exception {
         try {
-//            registry.startTx //TODO
+            registry.beginTransaction();
             Resource module = registry.newCollection();
             module.addProperty(RegistryResources.ModuleProperties.NAME, moduleName);
             module.addProperty(RegistryResources.ModuleProperties.VERSION, moduleVersion);
@@ -1082,13 +1052,12 @@
                              modulePolicy.getProperty(RegistryResources.ModuleProperties.POLICY_UUID),
                              modulePolicy);
             }
-
-//            registry.commit  //TODO
+            registry.commitTransaction();
             if (log.isDebugEnabled()) {
                 log.debug("Added new module - " + axisModule.getName() + "-" + axisModule.getVersion());
             }
         } catch (Exception e) {
-//            registry.rollback // TODO
+            registry.rollbackTransaction();
             log.error("Unable to handle new module addition", e);
             markFaultyModule(axisModule);
             throw e;
@@ -1106,20 +1075,14 @@
                                          AxisModule axisModule) throws Exception {
         try {
             String paramResource = module.getPath() + RegistryResources.PARAMETERS;
+            registry.beginTransaction();
 
             // Add the Module Parameters
             if (registry.resourceExists(paramResource)) {
                 Collection parameters = (Collection) registry.get(paramResource);
                 for (String param : parameters.getChildren()) {
                     Resource resource = registry.get(param);
-                    StAXOMBuilder builder;
-                    try {
-                        builder = new StAXOMBuilder(resource.getContentStream());
-                    } catch (XMLStreamException e) {
-                        String msg = "Unable to set service parameter";
-                        log.error(msg, e);
-                        throw new AxisFault(msg, e);
-                    }
+                    StAXOMBuilder builder = new StAXOMBuilder(resource.getContentStream());
                     Parameter parameter = ParameterUtil.createParameter(builder.getDocumentElement());
                     Parameter p = axisModule.getParameter(resource.getProperty(RegistryResources.NAME));
                     if (p != null) {
@@ -1147,12 +1110,13 @@
                     policyInclude.addPolicyElement(Integer.parseInt(policyType), policy);
                 }
             }
-
+            registry.commitTransaction();
             if (log.isDebugEnabled()) {
                 log.debug("Initialized module - " + Utils.getModuleName(axisModule.getName(),
                                                                         axisModule.getVersion()));
             }
         } catch (Exception e) {
+            registry.rollbackTransaction();
             log.error("Unable to handle module init", e);
             markFaultyModule(axisModule);
             throw e;

Modified: trunk/carbon/distribution/carbon-home/registry/WSO2REGISTRY_DB/db.lck
==============================================================================
Binary files. No diff available.

Modified: trunk/carbon/distribution/carbon-home/registry/WSO2REGISTRY_DB/log/log1.dat
==============================================================================
Binary files. No diff available.

Modified: trunk/carbon/distribution/carbon-home/registry/WSO2REGISTRY_DB/seg0/c10.dat
==============================================================================
Binary files. No diff available.

Modified: trunk/carbon/distribution/carbon-home/registry/WSO2REGISTRY_DB/seg0/c180.dat
==============================================================================
Binary files. No diff available.

Modified: trunk/carbon/distribution/carbon-home/registry/WSO2REGISTRY_DB/seg0/c1a1.dat
==============================================================================
Binary files. No diff available.

Modified: trunk/carbon/distribution/carbon-home/registry/WSO2REGISTRY_DB/seg0/c1b1.dat
==============================================================================
Binary files. No diff available.

Modified: trunk/carbon/distribution/carbon-home/registry/WSO2REGISTRY_DB/seg0/c230.dat
==============================================================================
Binary files. No diff available.

Modified: trunk/carbon/distribution/carbon-home/registry/WSO2REGISTRY_DB/seg0/c241.dat
==============================================================================
Binary files. No diff available.

Modified: trunk/carbon/distribution/carbon-home/registry/WSO2REGISTRY_DB/seg0/c380.dat
==============================================================================
Binary files. No diff available.

Modified: trunk/carbon/distribution/carbon-home/registry/WSO2REGISTRY_DB/seg0/c391.dat
==============================================================================
Binary files. No diff available.

Modified: trunk/carbon/distribution/carbon-home/registry/WSO2REGISTRY_DB/seg0/c3a1.dat
==============================================================================
Binary files. No diff available.

Modified: trunk/carbon/distribution/carbon-home/registry/WSO2REGISTRY_DB/seg0/c3b1.dat
==============================================================================
Binary files. No diff available.

Modified: trunk/carbon/distribution/carbon-home/registry/WSO2REGISTRY_DB/seg0/cf0.dat
==============================================================================
Binary files. No diff available.

Modified: trunk/carbon/distribution/carbon-home/registry/WSO2REGISTRY_DB/service.properties
==============================================================================
--- trunk/carbon/distribution/carbon-home/registry/WSO2REGISTRY_DB/service.properties	(original)
+++ trunk/carbon/distribution/carbon-home/registry/WSO2REGISTRY_DB/service.properties	Thu Apr  3 05:05:02 2008
@@ -1,9 +1,9 @@
-#/home/azeez/Desktop/db-derby-10.3.2.1-bin/bin/WSO2REGISTRY_DB
+#/home/azeez/Desktop/db-derby-10.3.2.1-bin/WSO2REGISTRY_DB
 # ********************************************************************
 # ***                Please do NOT edit this file.                 ***
 # *** CHANGING THE CONTENT OF THIS FILE MAY CAUSE DATA CORRUPTION. ***
 # ********************************************************************
-#Mon Mar 31 14:52:46 LKT 2008
+#Thu Apr 03 17:27:39 LKT 2008
 SysschemasIndex2Identifier=225
 SyscolumnsIdentifier=144
 SysconglomeratesIndex1Identifier=49



More information about the Carbon-dev mailing list