Author: tyrell
Date: Mon Jan 21 23:52:23 2008
New Revision: 12671

Log:

Changing the quartz based function schedular to be globally available to all 
services. The services will keep track of the jobs scheduled and these will be 
removed from the scheduler during undeployment.

Modified:
   trunk/mashup/java/modules/core/src/org/wso2/mashup/MashupConstants.java
   
trunk/mashup/java/modules/core/src/org/wso2/mashup/transport/MashupServerInitializer.java
   
trunk/mashup/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/system/SystemHostObject.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     
Mon Jan 21 23:52:23 2008
@@ -42,6 +42,7 @@
     public static String REMEMBER_ME_PERIOD = "RememberMePeriod";
     
     public static String QUARTZ_FUNCTION_SCHEDULER = "FunctionScheduler";
+    public static String QUARTZ_FUNCTION_SCHEDULER_JOB_IDS = 
"FunctionSchedulerJobIds";
 
     public static final String EMAIL_RELAY_HOST = "email_relay_host";
     public static final String REG_VALIDATION_URL = 
"registration_validation_url";

Modified: 
trunk/mashup/java/modules/core/src/org/wso2/mashup/transport/MashupServerInitializer.java
==============================================================================
--- 
trunk/mashup/java/modules/core/src/org/wso2/mashup/transport/MashupServerInitializer.java
   (original)
+++ 
trunk/mashup/java/modules/core/src/org/wso2/mashup/transport/MashupServerInitializer.java
   Mon Jan 21 23:52:23 2008
@@ -20,6 +20,7 @@
 import org.apache.axis2.deployment.DeploymentEngine;
 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.apache.log4j.Logger;
 import org.wso2.mashup.MashupConstants;
@@ -42,6 +43,10 @@
 import org.wso2.wsas.persistence.dataobject.ServiceIdentifierDO;
 import org.wso2.wsas.persistence.exception.ServiceGroupNotFoundException;
 import org.wso2.wsas.util.WsasUtils;
+import org.quartz.SchedulerFactory;
+import org.quartz.Scheduler;
+import org.quartz.SchedulerException;
+import org.quartz.impl.StdSchedulerFactory;
 
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -89,15 +94,19 @@
             KeyStoreDO[] storeDOs = persistenceMgr.getKeyStores();
             String keyStoreName = storeDOs[0].getKeyStoreName();
 
-            
admin.assignUsersAndRolesAndKeyStores(MashupConstants.MASHUP_LOGIN_SERVICEUT, 
null, "scenario21",
-                    new String [] {keyStoreName}, keyStoreName,
-                                      new String[] { },
-                                      new String[] { 
MashupConstants.MASHUP_USER_ROLE });
-
-            
admin.assignUsersAndRolesAndKeyStores(MashupConstants.MASHUP_LOGIN_SERVICEIC, 
null, "scenario22",
-                    new String [] {keyStoreName}, keyStoreName,
-                                      new String[] { },
-                                      new String[] { 
MashupConstants.MASHUP_USER_ROLE });
+            
admin.assignUsersAndRolesAndKeyStores(MashupConstants.MASHUP_LOGIN_SERVICEUT, 
null,
+                                                  "scenario21",
+                                                  new String[] { keyStoreName 
}, keyStoreName,
+                                                  new String[] { },
+                                                  new String[] {
+                                                          
MashupConstants.MASHUP_USER_ROLE });
+
+            
admin.assignUsersAndRolesAndKeyStores(MashupConstants.MASHUP_LOGIN_SERVICEIC, 
null,
+                                                  "scenario22",
+                                                  new String[] { keyStoreName 
}, keyStoreName,
+                                                  new String[] { },
+                                                  new String[] {
+                                                          
MashupConstants.MASHUP_USER_ROLE });
 
             // Delete wsas-created 'admin' user, as a primary user is 
explicitly created.
             UserStoreAdmin userStoreAdmin = realm.getUserStoreAdmin();
@@ -106,13 +115,24 @@
                 userStoreAdmin.deleteUser(RegistryConstants.ADMIN_USER);
             }
 
+            //Creating the function scheduler instance for this service
+            SchedulerFactory schedulerFactory = new StdSchedulerFactory();
+            Scheduler scheduler = schedulerFactory.getScheduler();
+            scheduler.start();
+
+            //Storing the scheduler as a parameter in the axis ocnfiguration
+            Parameter functionScheduler =
+                    new Parameter(MashupConstants.QUARTZ_FUNCTION_SCHEDULER, 
scheduler);
+            configuration.addParameter(functionScheduler);
+
             // Notify MBean that server is now running.
             MashupUtils.setServerRunning(true);
 
             // Applying a dummy tag so that searching works
             // https://wso2.org/jira/browse/REGISTRY-24
-            SecureRegistry secureRegistry = 
RegistryUtils.createSecureRegistry(MashupConstants.SYSTEM_USER, registry,
-                    realm);
+            SecureRegistry secureRegistry =
+                    
RegistryUtils.createSecureRegistry(MashupConstants.SYSTEM_USER, registry,
+                                                       realm);
             secureRegistry.applyTag("/mashups/system/version", "built-in");
             secureRegistry.applyTag("/mashups/system/version", "management");
             secureRegistry.applyTag("/mashups/system/version", "scraping");
@@ -163,6 +183,8 @@
         } catch (RegistryException e) {
             // https://wso2.org/jira/browse/REGISTRY-24
             // Exception jumps due to a Registry Bug
+        } catch (SchedulerException e) {
+            log.error("Error starting quartz scheduler", e);
         }
     }
 
@@ -171,7 +193,8 @@
         // 1. we need this service hidden
         // 2. We need to apply a policy on this service
         // WSAS does not persist hidden services
-        AxisServiceGroup axisServiceGroup = 
configuration.getServiceGroup(MashupConstants.MASHUP_ADMIN_SERVICEGROUP);
+        AxisServiceGroup axisServiceGroup =
+                
configuration.getServiceGroup(MashupConstants.MASHUP_ADMIN_SERVICEGROUP);
 
         ServiceGroupDO sgDO =
                 
persistenceMgr.getServiceGroup(axisServiceGroup.getServiceGroupName());
@@ -233,7 +256,7 @@
             persistenceMgr.handleNewServiceGroupAddition(axisServiceGroup);
         } catch (Exception e) {
             String msg = "Could not handle initialization of new service group 
[" +
-                         axisServiceGroup.getServiceGroupName() + "]";
+                    axisServiceGroup.getServiceGroupName() + "]";
             log.error(msg, e);
         }
     }

Modified: 
trunk/mashup/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/system/SystemHostObject.java
==============================================================================
--- 
trunk/mashup/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/system/SystemHostObject.java
  (original)
+++ 
trunk/mashup/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/system/SystemHostObject.java
  Mon Jan 21 23:52:23 2008
@@ -20,6 +20,7 @@
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.Parameter;
+import org.apache.axis2.engine.AxisConfiguration;
 import org.mozilla.javascript.Context;
 import org.mozilla.javascript.EvaluatorException;
 import org.mozilla.javascript.Function;
@@ -32,6 +33,7 @@
 import org.quartz.SimpleTrigger;
 import org.wso2.javascript.rhino.JavaScriptEngine;
 import org.wso2.javascript.rhino.JavaScriptEngineConstants;
+import org.wso2.mashup.MashupConstants;
 import org.wso2.mashup.MashupFault;
 import org.wso2.mashup.utils.MashupUtils;
 import org.wso2.utils.NetworkUtils;
@@ -49,6 +51,7 @@
 import java.net.URI;
 import java.util.ArrayList;
 import java.util.Date;
+import java.util.HashMap;
 
 /**
  * <p/>
@@ -339,9 +342,13 @@
             throw new MashupFault("Error obtaining the MessageContext.");
         }
 
-        //Get the scheduler instance stored in the AxisService.
-        Parameter parameter = axisService
-                .getParameter("FunctionScheduler");
+        //Get the scheduler instance stored in the Axis configuration context
+        ServerManager serverManager = ServerManager.getInstance();
+        ConfigurationContext configContext = serverManager.configContext;
+        AxisConfiguration configuration = configContext.getAxisConfiguration();
+
+        Parameter parameter = configuration
+                .getParameter(MashupConstants.QUARTZ_FUNCTION_SCHEDULER);
         Scheduler scheduler = (Scheduler) parameter.getValue();
 
         //Generating UUIDs for job and trigger
@@ -629,6 +636,11 @@
                 throw new AxisFault("Invalid number of parameters.");
         }
 
+        //Storing the Job ID in the Axis Service to be used during 
undeployment to unschedule it
+        HashMap jobIdList = (HashMap) axisService
+                
.getParameter(MashupConstants.QUARTZ_FUNCTION_SCHEDULER_JOB_IDS).getValue();
+        jobIdList.put("job_" + (jobIdList.size() + 1), jobId);
+
         return jobId;
     }
 
@@ -655,18 +667,13 @@
         if (arguments[0] instanceof String) {
             String jobId = (String) arguments[0];
 
-            // Getting the scheduler
-            Object object = 
cx.getThreadLocal(JavaScriptEngineConstants.AXIS2_SERVICE);
-            AxisService axisService;
-            if (object instanceof AxisService) {
-                axisService = (AxisService) object;
-            } else {
-                throw new MashupFault("Error obtaining the MessageContext.");
-            }
+            //Get the scheduler instance stored in the Axis configuration 
context
+            ServerManager serverManager = ServerManager.getInstance();
+            ConfigurationContext configContext = serverManager.configContext;
+            AxisConfiguration configuration = 
configContext.getAxisConfiguration();
 
-            //Get the scheduler instance stored in the AxisService.
-            Parameter parameter = axisService
-                    .getParameter("FunctionScheduler");
+            Parameter parameter = configuration
+                    .getParameter(MashupConstants.QUARTZ_FUNCTION_SCHEDULER);
             Scheduler scheduler = (Scheduler) parameter.getValue();
 
             try {

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
   Mon Jan 21 23:52:23 2008
@@ -34,10 +34,6 @@
 import org.apache.ws.commons.schema.XmlSchemaElement;
 import org.mozilla.javascript.Function;
 import org.mozilla.javascript.Scriptable;
-import org.quartz.Scheduler;
-import org.quartz.SchedulerException;
-import org.quartz.SchedulerFactory;
-import org.quartz.impl.StdSchedulerFactory;
 import org.wso2.javascript.rhino.JavaScriptEngine;
 import org.wso2.javascript.rhino.JavaScriptEngineConstants;
 import org.wso2.javascript.rhino.JavaScriptEngineUtils;
@@ -56,6 +52,8 @@
 import org.wso2.utils.ServerConfiguration;
 import org.wso2.wsas.ServerConstants;
 import org.wso2.wsas.admin.service.UserAdmin;
+import org.quartz.Scheduler;
+import org.quartz.SchedulerException;
 
 import javax.xml.namespace.QName;
 import java.io.*;
@@ -113,7 +111,7 @@
             AxisServiceGroup serviceGroup = new AxisServiceGroup(axisConfig);
             
serviceGroup.setServiceGroupClassLoader(deploymentFileData.getClassLoader());
             ArrayList serviceList = processService(deploymentFileData, 
serviceGroup,
-                                                   configCtx);                 
                                                          
+                                                   configCtx);
             if (serviceList != null) {
                 DeploymentEngine.addServiceGroup(serviceGroup, serviceList, 
deploymentFileData
                         .getFile().toURL(), deploymentFileData, axisConfig);
@@ -152,8 +150,10 @@
             if (serviceStatus.startsWith("Error:")) {
                 
axisConfig.getFaultyServices().put(deploymentFileData.getFile().getAbsolutePath(),
                                                    serviceStatus);
-                populateRegistry(deploymentFileData, "This Service is Faulty. 
Reason : " + serviceStatus,
-                        
DescriptionBuilder.getShortFileName(deploymentFileData.getName()), true);
+                populateRegistry(deploymentFileData,
+                                 "This Service is Faulty. Reason : " + 
serviceStatus,
+                                 
DescriptionBuilder.getShortFileName(deploymentFileData.getName()),
+                                 true);
 
             }
         }
@@ -172,7 +172,7 @@
             File file = new File(fileName);
             String shortFileName = file.getName();
             String username = file.getParentFile().getName();
-            //Stopping the javascript function scheduler
+
             String serviceGroupName = username + 
MashupConstants.SEPARATOR_CHAR +
                     shortFileName.substring(0, shortFileName.indexOf("."));
             AxisServiceGroup group =
@@ -187,11 +187,24 @@
                 return;
             }
             if (service != null) {
-                Parameter shedulerParam =
-                        
service.getParameter(MashupConstants.QUARTZ_FUNCTION_SCHEDULER);
-                if (shedulerParam != null && shedulerParam.getValue() 
instanceof Scheduler) {
-                    Scheduler functionScheduler = (Scheduler) 
shedulerParam.getValue();
-                    functionScheduler.shutdown();
+                //Unscheduling all the functions scheduled by this service
+                HashMap scheduledJobs = (HashMap) service
+                        
.getParameter(MashupConstants.QUARTZ_FUNCTION_SCHEDULER_JOB_IDS).getValue();
+                Iterator scheduledJobIds = scheduledJobs.values().iterator();
+                if (scheduledJobs.size() > 0) {
+                    Scheduler scheduler = (Scheduler) axisConfig
+                            
.getParameter(MashupConstants.QUARTZ_FUNCTION_SCHEDULER).getValue();
+                    String currentJobId = "";
+                    while (scheduledJobIds.hasNext()) {
+                        try {
+                            currentJobId = (String) scheduledJobIds.next();
+                            scheduler.unscheduleJob(currentJobId, null);
+                            log.info("Unscheduled the job with id " + 
currentJobId + ".");
+                        } catch (SchedulerException e) {
+                            log.error("Failed to unschedule the job with id " 
+ currentJobId +
+                                    ". Ignored and moving on.", e);
+                        }
+                    }
                 }
 
                 //Removing the service from registry
@@ -211,8 +224,6 @@
 
         } catch (AxisFault axisFault) {
             throw new DeploymentException(axisFault);
-        } catch (SchedulerException e) {
-            throw new DeploymentException(e);
         } catch (RegistryException e) {
             throw new DeploymentException(e);
         }
@@ -245,7 +256,7 @@
             // org.wso2.javascript.rhino.JavaScriptReceiver needs this to load 
the javascript file
             File file = currentFile.getFile();
             Parameter serviceJSParameter = new 
Parameter(JavaScriptEngineConstants.SERVICE_JS,
-                    file);
+                                                         file);
             axisService.addParameter(serviceJSParameter);
 
             // Mashup UI uses this information to differentiate services when 
listing them.
@@ -253,15 +264,10 @@
                                                   
MashupConstants.MASHUP_JS_SERVICE);
             axisService.addParameter(serviceType);
 
-            //Creating the function scheduler instance for this service
-            SchedulerFactory schedulerFactory = new StdSchedulerFactory();
-            Scheduler scheduler = schedulerFactory.getScheduler();
-            scheduler.start();
-
-            //Storing the scheduler as a parameter
-            Parameter functionScheduler =
-                    new Parameter(MashupConstants.QUARTZ_FUNCTION_SCHEDULER, 
scheduler);
-            axisService.addParameter(functionScheduler);
+            //Adding a parameter to store the job ID's of all the functions 
scheduled by this service
+            Parameter jobIds =
+                    new 
Parameter(MashupConstants.QUARTZ_FUNCTION_SCHEDULER_JOB_IDS, new HashMap());
+            axisService.addParameter(jobIds);
 
             // Creating the service.resources dir
             // For more details see 
http://www.wso2.org/wiki/display/mashup/scripts+folder+structure+and+deployment
@@ -398,7 +404,8 @@
 
             // We are putting the service into the registry here
 
-            String path = populateRegistry(currentFile, 
axisService.getDocumentation(), name, false);
+            String path =
+                    populateRegistry(currentFile, 
axisService.getDocumentation(), name, false);
             //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, path);
@@ -411,17 +418,16 @@
             throw new DeploymentException("JS Service File Not Found", e);
         } catch (IOException e) {
             throw new DeploymentException(e);
-        } catch (SchedulerException e) {
-            throw new DeploymentException("Failed to initiate the functin 
scheduler", e);
         }
     }
 
-    private String populateRegistry(DeploymentFileData currentFile, String 
documentation, String name, boolean faulty)
+    private String populateRegistry(DeploymentFileData currentFile, String 
documentation,
+                                    String name, boolean faulty)
             throws DeploymentException {
 
         try {
             Realm realm = (Realm) 
configCtx.getAxisConfiguration().getParameterValue(
-                        RegistryConstants.REGISTRY_REALM);
+                    RegistryConstants.REGISTRY_REALM);
             File file = currentFile.getFile();
             // Infer the username (The owner of this service)
             String username = inferUserName(file, realm, name);
@@ -430,7 +436,8 @@
             JDBCRegistry registry =
                     (JDBCRegistry) 
configCtx.getAxisConfiguration().getParameterValue(
                             RegistryConstants.REGISTRY);
-            SecureRegistry secureRegistry = 
RegistryUtils.createSecureRegistry(username, registry, realm);
+            SecureRegistry secureRegistry =
+                    RegistryUtils.createSecureRegistry(username, registry, 
realm);
 
             // create a content resource
             Resource resource1 = new Resource();
@@ -657,8 +664,8 @@
             UserAdmin admin = new UserAdmin();
             boolean hasMashupUserRole = false;
             String[] roleNames = admin.getRoleNames();
-            for (int i=0 ; i < roleNames.length; i++) {
-                if (MashupConstants.MASHUP_USER_ROLE.equals(roleNames[i])){
+            for (int i = 0; i < roleNames.length; i++) {
+                if (MashupConstants.MASHUP_USER_ROLE.equals(roleNames[i])) {
                     hasMashupUserRole = true;
                     break;
                 }
@@ -688,18 +695,22 @@
                 us.addUserToRole(MashupConstants.SYSTEM_USER, 
RegistryConstants.ADMIN_ROLE);
             }
 
-            createPrimary = 
Boolean.parseBoolean(serverConfig.getFirstProperty(MashupConstants.PRIMARY_USER_CONFIG
 + "." +
-                    MashupConstants.CREATE_PRIMARY_USER));
+            createPrimary = Boolean.parseBoolean(
+                    
serverConfig.getFirstProperty(MashupConstants.PRIMARY_USER_CONFIG + "." +
+                            MashupConstants.CREATE_PRIMARY_USER));
             if (createPrimary && !MashupUtils.isInitialSetupComplete()) {
-                primaryName = 
serverConfig.getFirstProperty(MashupConstants.PRIMARY_USER_CONFIG + "." +
-                    MashupConstants.PRIMARY_USER);
-                primaryPassword = 
serverConfig.getFirstProperty(MashupConstants.PRIMARY_USER_CONFIG + "." +
-                    MashupConstants.PRIMARY_PASSWORD);
+                primaryName =
+                        
serverConfig.getFirstProperty(MashupConstants.PRIMARY_USER_CONFIG + "." +
+                                MashupConstants.PRIMARY_USER);
+                primaryPassword =
+                        
serverConfig.getFirstProperty(MashupConstants.PRIMARY_USER_CONFIG + "." +
+                                MashupConstants.PRIMARY_PASSWORD);
                 us.addUser(primaryName, primaryPassword);
             }
 
             RegistryDataSource datasource = new 
RegistryDataSource(registryUrl, registryDriverClass,
-                                                          registryUsername, 
registryPassword);
+                                                                   
registryUsername,
+                                                                   
registryPassword);
             JDBCRegistry registry = new JDBCRegistry(datasource, realm);
 
             
configCtx.getAxisConfiguration().addParameter(RegistryConstants.REGISTRY, 
registry);
@@ -716,8 +727,9 @@
                 addQuery(
                         registry,
                         MashupConstants.ALL_MASHUPS_QUERY_PATH,
-                        "SELECT PATH FROM ARTIFACTS WHERE STATE=100 AND 
MEDIA_TYPE='" + MashupConstants
-                                .MASHUP_MEDIA_TYPE + "'",
+                        "SELECT PATH FROM ARTIFACTS WHERE STATE=100 AND 
MEDIA_TYPE='" +
+                                MashupConstants
+                                        .MASHUP_MEDIA_TYPE + "'",
                         RegistryConstants.RESOURCES_RESULT_TYPE
                 );
 
@@ -786,7 +798,7 @@
                         registry,
                         MashupConstants.CUSTOM_QUERY_PATH,
                         "SELECT DISTINCT A.PATH FROM ARTIFACTS A, TAGS T WHERE 
A.STATE=100 AND (A.PATH LIKE ? OR A.DESCRIPTION LIKE ? OR (T.TAG_NAME=? AND 
T.AID=A.AID)) AND A.MEDIA_TYPE='" +
-                                                        
MashupConstants.MASHUP_MEDIA_TYPE + "'",
+                                MashupConstants.MASHUP_MEDIA_TYPE + "'",
                         RegistryConstants.RESOURCES_RESULT_TYPE
                 );
 
@@ -802,21 +814,21 @@
 
                 // Query for comments
                 addQuery(
-                       registry,
-                       MashupConstants.COMMENTS_QUERY_PATH,
-                       "SELECT C.CM_ID FROM COMMENTS C, ARTIFACTS A WHERE 
C.COMMENT_TEXT LIKE ? AND C.AID=A.AID AND A.STATE=100 AND A.MEDIA_TYPE='" +
-                               MashupConstants.MASHUP_MEDIA_TYPE + "'",
-                       RegistryConstants.COMMENTS_RESULT_TYPE
-                 );
+                        registry,
+                        MashupConstants.COMMENTS_QUERY_PATH,
+                        "SELECT C.CM_ID FROM COMMENTS C, ARTIFACTS A WHERE 
C.COMMENT_TEXT LIKE ? AND C.AID=A.AID AND A.STATE=100 AND A.MEDIA_TYPE='" +
+                                MashupConstants.MASHUP_MEDIA_TYPE + "'",
+                        RegistryConstants.COMMENTS_RESULT_TYPE
+                );
 
                 // Query for comments by a particular user
                 addQuery(
-                       registry,
-                       MashupConstants.MY_COMMENTS_QUERY_PATH,
-                       "SELECT C.CM_ID FROM COMMENTS C, ARTIFACTS A WHERE 
C.COMMENT_TEXT LIKE ? AND C.USER_ID=? AND C.AID=A.AID AND A.STATE=100 AND 
A.MEDIA_TYPE='" +
-                               MashupConstants.MASHUP_MEDIA_TYPE + "'",
-                       RegistryConstants.COMMENTS_RESULT_TYPE
-                 );
+                        registry,
+                        MashupConstants.MY_COMMENTS_QUERY_PATH,
+                        "SELECT C.CM_ID FROM COMMENTS C, ARTIFACTS A WHERE 
C.COMMENT_TEXT LIKE ? AND C.USER_ID=? AND C.AID=A.AID AND A.STATE=100 AND 
A.MEDIA_TYPE='" +
+                                MashupConstants.MASHUP_MEDIA_TYPE + "'",
+                        RegistryConstants.COMMENTS_RESULT_TYPE
+                );
 
                 // add profile for the anonymous user.
                 AccessControlAdmin ac = realm.getAccessControlAdmin();
@@ -852,14 +864,19 @@
                                  UserManagerConstants.USER_PERMISSION_RESOURCE,
                                  UserManagerConstants.DELETE);
 
-                ac.authorizeRole(RegistryConstants.ADMIN_ROLE, 
RegistryConstants.ROOT_PATH, ActionConstants.GET);
-                ac.authorizeRole(RegistryConstants.ADMIN_ROLE, 
RegistryConstants.ROOT_PATH, ActionConstants.PUT);
-                ac.authorizeRole(RegistryConstants.ADMIN_ROLE, 
RegistryConstants.ROOT_PATH, ActionConstants.DELETE);
                 ac.authorizeRole(RegistryConstants.ADMIN_ROLE, 
RegistryConstants.ROOT_PATH,
-                                                 
UserManagerConstants.AUTHORIZE);
+                                 ActionConstants.GET);
+                ac.authorizeRole(RegistryConstants.ADMIN_ROLE, 
RegistryConstants.ROOT_PATH,
+                                 ActionConstants.PUT);
+                ac.authorizeRole(RegistryConstants.ADMIN_ROLE, 
RegistryConstants.ROOT_PATH,
+                                 ActionConstants.DELETE);
+                ac.authorizeRole(RegistryConstants.ADMIN_ROLE, 
RegistryConstants.ROOT_PATH,
+                                 UserManagerConstants.AUTHORIZE);
 
-                ac.authorizeRole(RegistryConstants.EVERYONE_ROLE, 
RegistryConstants.ROOT_PATH, ActionConstants.GET);
-                ac.authorizeRole(RegistryConstants.EVERYONE_ROLE, 
RegistryConstants.ROOT_PATH, ActionConstants.GET);
+                ac.authorizeRole(RegistryConstants.EVERYONE_ROLE, 
RegistryConstants.ROOT_PATH,
+                                 ActionConstants.GET);
+                ac.authorizeRole(RegistryConstants.EVERYONE_ROLE, 
RegistryConstants.ROOT_PATH,
+                                 ActionConstants.GET);
 
                 ac.authorizeRole(RegistryConstants.EVERYONE_ROLE,
                                  UserManagerConstants.USER_RESOURCE, 
UserManagerConstants.READ);
@@ -888,20 +905,21 @@
 
                 // Create the system user profile.
                 RegistryUtils.createUser(secureRegistry, realm, 
MashupConstants.SYSTEM_USER,
-                           "System", "none", "System User");
+                                         "System", "none", "System User");
 
                 // Create the 'Samples' user and profile.
                 RegistryUtils.createUser(secureRegistry, realm, 
MashupConstants.SAMPLES_USER,
-                           "Samples", "none", "Samples User");
+                                         "Samples", "none", "Samples User");
 
                 // Create the 'shared' user profile
                 RegistryUtils.createUser(secureRegistry, realm, 
MashupConstants.SHARED_USER,
-                           "Shared", "none", "Shared Mashups");
+                                         "Shared", "none", "Shared Mashups");
 
                 if (createPrimary && !MashupUtils.isInitialSetupComplete()) {
                     //Create the admin profile using information from a config 
file.
-                    RegistryUtils.createUser(secureRegistry, realm, 
primaryName, primaryName, "none",
-                                             "System Administrator");
+                    RegistryUtils
+                            .createUser(secureRegistry, realm, primaryName, 
primaryName, "none",
+                                        "System Administrator");
                     // Assign system user the 'admin' role and make primary.
                     us.addUserToRole(primaryName, 
RegistryConstants.ADMIN_ROLE);
                     RegistryUtils.makeUserPrimary(realm, primaryName);

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

Reply via email to