Author: tyrell
Date: Sat Dec  8 08:08:40 2007
New Revision: 10722

Log:

Adding service removal from registry at undeployment time.

Modified:
   trunk/mashup/java/modules/core/src/org/wso2/mashup/MashupConstants.java
   
trunk/mashup/java/modules/javascriptdeployer/src/org/wso2/mashup/deployer/JSDeployer.java

Modified: 
trunk/mashup/java/modules/core/src/org/wso2/mashup/MashupConstants.java
==============================================================================
--- trunk/mashup/java/modules/core/src/org/wso2/mashup/MashupConstants.java     
(original)
+++ trunk/mashup/java/modules/core/src/org/wso2/mashup/MashupConstants.java     
Sat Dec  8 08:08:40 2007
@@ -47,6 +47,7 @@
     public static final String MASHUP_MEDIA_TYPE = "wso2_mashup";
     public static final String EVERYONE_ROLE = "everyone";
 
+    public static final String REGISTRY_MASHUP_PATH = "registryMashupPath";
     public static final String PROFILE_PATH = "profilePath";
     public static final String ALL_MASHUPS_PATH = "/mashups";
     public static final String QUERYSTORE_QUERY_PATH = "/querystore";

Modified: 
trunk/mashup/java/modules/javascriptdeployer/src/org/wso2/mashup/deployer/JSDeployer.java
==============================================================================
--- 
trunk/mashup/java/modules/javascriptdeployer/src/org/wso2/mashup/deployer/JSDeployer.java
   (original)
+++ 
trunk/mashup/java/modules/javascriptdeployer/src/org/wso2/mashup/deployer/JSDeployer.java
   Sat Dec  8 08:08:40 2007
@@ -216,6 +216,14 @@
                     Scheduler functionScheduler = (Scheduler) 
shedulerParam.getValue();
                     functionScheduler.shutdown();
                 }
+
+                //Removing the service from registry
+                Parameter myRegistryPath = 
service.getParameter(MashupConstants.REGISTRY_MASHUP_PATH);
+                if (myRegistryPath != null && myRegistryPath.getValue() 
instanceof String) {                       
+                    JDBCRegistry registry = (JDBCRegistry) 
configCtx.getAxisConfiguration().getParameterValue(
+                    RegistryConstants.REGISTRY);
+                    registry.delete((String)myRegistryPath.getValue());
+                }
             }
 
             // There exist only one servicegroup for the JavaScript services 
deployed from this deployer
@@ -226,6 +234,8 @@
             throw new DeploymentException(axisFault);
         } catch (SchedulerException e) {
             throw new DeploymentException(e);
+        } catch (RegistryException e) {
+            throw new DeploymentException(e);
         }
     }
 
@@ -418,6 +428,12 @@
             // store it in a non existence path
             String path1 = "/mashups/" + axisService.getName();
             registry.put(path1, resource1);
+
+            //Storing the registry path as a service parameter, to be used at 
undeployment time
+            //to remove the service from registry
+            Parameter myRegistryPath = new 
Parameter(MashupConstants.REGISTRY_MASHUP_PATH, path1);
+            axisService.addParameter(myRegistryPath);            
+
             AccessControlAdmin ac = realm.getAccessControlAdmin();
             ac.authorizeUser(RegistryConstants.ADMIN_USER, path1, 
UserManagerConstants.EDIT);
             ac.authorizeUser(RegistryConstants.ADMIN_USER, path1, 
UserManagerConstants.DELETE);

_______________________________________________
Mashup-dev mailing list
[email protected]
http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev

Reply via email to