You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by sa...@apache.org on 2014/01/04 18:01:35 UTC

[1/3] git commit: Fixing wrong import packages

Updated Branches:
  refs/heads/carbon-4.2.0-upgrade a3ce7d16e -> cd87dbcc0


Fixing wrong import packages


Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/37c56e72
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/37c56e72
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/37c56e72

Branch: refs/heads/carbon-4.2.0-upgrade
Commit: 37c56e722f0b466cfc716770656a18f439b8366b
Parents: a3ce7d1
Author: Sajith Kariyawasam <sa...@wso2.com>
Authored: Sat Jan 4 22:21:09 2014 +0530
Committer: Sajith Kariyawasam <sa...@wso2.com>
Committed: Sat Jan 4 22:21:09 2014 +0530

----------------------------------------------------------------------
 .../apache/stratos/adc/mgt/retriever/DataRetrievalManager.java   | 4 ++--
 .../stratos/cloud/controller/util/CloudControllerUtil.java       | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/37c56e72/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/retriever/DataRetrievalManager.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/retriever/DataRetrievalManager.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/retriever/DataRetrievalManager.java
index 27022c5..7faab1f 100644
--- a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/retriever/DataRetrievalManager.java
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/retriever/DataRetrievalManager.java
@@ -26,8 +26,8 @@ import org.apache.stratos.adc.mgt.lookup.LookupDataHolder;
 import org.apache.stratos.adc.mgt.lookup.SubscriptionAliasToCartridgeSubscriptionMap;
 import org.apache.stratos.adc.mgt.persistence.PersistenceManager;
 import org.apache.stratos.adc.mgt.subscription.CartridgeSubscription;
-import org.jgroups.logging.Log;
-import org.jgroups.logging.LogFactory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 import java.util.ArrayList;
 import java.util.Collection;

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/37c56e72/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java
index dc708da..80b07f6 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java
@@ -35,7 +35,7 @@ import org.apache.stratos.cloud.controller.runtime.FasterLookUpDataHolder;
 import org.apache.stratos.messaging.domain.topology.Topology;
 import org.wso2.carbon.registry.core.exceptions.RegistryException;
 
-import edu.emory.mathcs.backport.java.util.Arrays;
+import java.util.Arrays;
 
 import java.util.ArrayList;
 import java.util.Iterator;


[2/3] git commit: Fixing for multitenant subscription to LB cartridge

Posted by sa...@apache.org.
Fixing for multitenant subscription to LB cartridge


Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/1ba43d81
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/1ba43d81
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/1ba43d81

Branch: refs/heads/carbon-4.2.0-upgrade
Commit: 1ba43d813d7b3ae7549ceff0ace1f85d2d87bd0e
Parents: 37c56e7
Author: Sajith Kariyawasam <sa...@wso2.com>
Authored: Sat Jan 4 22:24:51 2014 +0530
Committer: Sajith Kariyawasam <sa...@wso2.com>
Committed: Sat Jan 4 22:24:51 2014 +0530

----------------------------------------------------------------------
 .../service/ServiceDeploymentManager.java       | 218 ++++++++++++++++++-
 .../manager/CartridgeSubscriptionManager.java   |   2 +
 .../rest/endpoint/services/ServiceUtils.java    |   4 +-
 .../rest/endpoint/services/StratosAdmin.java    |   2 +-
 4 files changed, 221 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/1ba43d81/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/deploy/service/ServiceDeploymentManager.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/deploy/service/ServiceDeploymentManager.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/deploy/service/ServiceDeploymentManager.java
index 8a03a14..4bc25d9 100644
--- a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/deploy/service/ServiceDeploymentManager.java
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/deploy/service/ServiceDeploymentManager.java
@@ -19,26 +19,39 @@
 
 package org.apache.stratos.adc.mgt.deploy.service;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.adc.mgt.client.AutoscalerServiceClient;
 import org.apache.stratos.adc.mgt.client.CloudControllerServiceClient;
 import org.apache.stratos.adc.mgt.deploy.service.multitenant.MultiTenantService;
 import org.apache.stratos.adc.mgt.exception.ADCException;
 import org.apache.stratos.adc.mgt.exception.UnregisteredCartridgeException;
+import org.apache.stratos.adc.mgt.manager.CartridgeSubscriptionManager;
 import org.apache.stratos.adc.mgt.payload.BasicPayloadData;
 import org.apache.stratos.adc.mgt.payload.PayloadData;
 import org.apache.stratos.adc.mgt.payload.PayloadFactory;
+import org.apache.stratos.adc.mgt.subscription.CartridgeSubscription;
 import org.apache.stratos.adc.mgt.subscription.utils.CartridgeSubscriptionUtils;
 import org.apache.stratos.adc.mgt.utils.CartridgeConstants;
 import org.apache.stratos.adc.mgt.utils.PersistenceManager;
+import org.apache.stratos.autoscaler.deployment.policy.DeploymentPolicy;
 import org.apache.stratos.cloud.controller.pojo.CartridgeInfo;
+import org.apache.stratos.cloud.controller.pojo.LoadbalancerConfig;
+import org.apache.stratos.cloud.controller.pojo.Properties;
 import org.apache.stratos.cloud.controller.pojo.Property;
+import org.apache.stratos.messaging.util.Constants;
 
 public class ServiceDeploymentManager {
 
     private static Log log = LogFactory.getLog(ServiceDeploymentManager.class);
-
-    public Service deployService (String type, String autoscalingPolicyName, String deploymentPolicyName, int tenantId, String tenantRange)
+    private CartridgeSubscriptionManager cartridgeSubsciptionManager = new CartridgeSubscriptionManager();
+    
+    public Service deployService (String type, String autoscalingPolicyName, String deploymentPolicyName, int tenantId, String tenantRange,
+    		String tenantDomain, String userName)
         throws ADCException, UnregisteredCartridgeException {
 
         //get deployed Cartridge Definition information
@@ -63,6 +76,174 @@ public class ServiceDeploymentManager {
             throw new ADCException(errorMsg);
         }
 
+        
+        // TODO - LB cartridge.... ??
+
+        List<Property> lbRefProp = new ArrayList<Property>();
+
+        // get lb config reference
+        LoadbalancerConfig lbConfig = cartridgeInfo.getLbConfig();
+
+        if (lbConfig == null || lbConfig.getProperties() == null) {
+            if (log.isDebugEnabled()) {
+                log.debug("This Service does not require a load balancer. " + "[Service Name] " +
+                          type);
+            }
+        } else {
+
+            CartridgeInfo lbCartridgeInfo;
+            String lbCartridgeType = lbConfig.getType();
+            try {
+                // retrieve lb Cartridge info
+                lbCartridgeInfo = CloudControllerServiceClient.getServiceClient().getCartridgeInfo(lbCartridgeType);
+            } catch (Exception e) {
+                String msg = "Cannot get cartridge info: " + type;
+                log.error(msg, e);
+                throw new ADCException(msg, e);
+            }
+
+            Properties lbReferenceProperties = lbConfig.getProperties();
+
+            Property property = new Property();
+            property.setName(org.apache.stratos.messaging.util.Constants.LOAD_BALANCER_REF);
+
+            for (org.apache.stratos.cloud.controller.pojo.Property prop : lbReferenceProperties.getProperties()) {
+
+                String name = prop.getName();
+                String value = prop.getValue();
+
+                // TODO make following a chain of responsibility pattern
+                if (Constants.NO_LOAD_BALANCER.equals(name)) {
+                    if ("true".equals(value)) {
+                        if (log.isDebugEnabled()) {
+                            log.debug("This cartridge does not require a load balancer. " +
+                                      "[Type] " + type);
+                        }
+                        property.setValue(name);
+                        lbRefProp.add(property);
+                        break;
+                    }
+                } else if (Constants.EXISTING_LOAD_BALANCERS.equals(name)) {
+                    String clusterIdsVal = value;
+                    if (log.isDebugEnabled()) {
+                        log.debug("This cartridge refers to existing load balancers. " + "[Type] " +
+                                  type + "[Referenced Cluster Ids] " + clusterIdsVal);
+                    }
+
+                    String[] clusterIds = clusterIdsVal.split(",");
+
+                    for (String clusterId : clusterIds) {
+                        
+                            try {
+                            	AutoscalerServiceClient.getServiceClient().checkLBExistenceAgainstPolicy(clusterId,
+                            			deploymentPolicyName);
+                            } catch (Exception ex) {
+                                // we don't need to throw the error here.
+                                log.error(ex.getMessage(), ex);
+                            }
+                        
+                    }
+
+                    property.setValue(name);
+                    lbRefProp.add(property);
+                    break;
+
+                } else if (Constants.DEFAULT_LOAD_BALANCER.equals(name)) {
+                    if ("true".equals(value)) {
+                        property.setValue(name);
+                        if (log.isDebugEnabled()) {
+                            log.debug("This cartridge uses default load balancer. " + "[Type] " +
+                                      type);
+                        }
+                        
+                            try {
+                                // get the valid policies for lb cartridge
+                                DeploymentPolicy[] lbCartridgeDepPolicies =
+                                	AutoscalerServiceClient.getServiceClient().getDeploymentPolicies(lbCartridgeType);
+                                // traverse deployment policies of lb cartridge
+                                for (DeploymentPolicy policy : lbCartridgeDepPolicies) {
+                                    // check existence of the subscribed policy
+                                    if (deploymentPolicyName.equals(policy.getId())) {
+
+                                        if (!AutoscalerServiceClient.getServiceClient().checkDefaultLBExistenceAgainstPolicy(deploymentPolicyName)) {
+
+                                            // if lb cluster doesn't exist
+                                            String lbAlias = "lb" + new Random().nextInt();
+                                            lbCartridgeInfo.addProperties(property);
+                                            subscribeToLb(lbCartridgeType,
+                                                          lbAlias,
+                                                          lbCartridgeInfo.getDefaultAutoscalingPolicy(),
+                                                          deploymentPolicyName, tenantId,
+                                                          userName,
+                                                          tenantDomain,
+                                                          lbCartridgeInfo.getProperties());
+                                        }
+                                    }
+                                }
+
+                            } catch (Exception ex) {
+                                // we don't need to throw the error here.
+                                log.error(ex.getMessage(), ex);
+                            }
+                        
+
+                        lbRefProp.add(property);
+                        break;
+                    } else if (Constants.SERVICE_AWARE_LOAD_BALANCER.equals(name)) {
+                        if ("true".equals(value)) {
+                            property.setValue(name);
+                            if (log.isDebugEnabled()) {
+                                log.debug("This cartridge uses a service aware load balancer. " +
+                                          "[Type] " + type);
+                            }
+                            
+                                try {
+
+                                    // get the valid policies for lb cartridge
+                                    DeploymentPolicy[] lbCartridgeDepPolicies =
+                                    	AutoscalerServiceClient.getServiceClient().getDeploymentPolicies(lbCartridgeType);
+                                    // traverse deployment policies of lb cartridge
+                                    for (DeploymentPolicy policy : lbCartridgeDepPolicies) {
+                                        // check existence of the subscribed policy
+                                        if (deploymentPolicyName.equals(policy.getId())) {
+
+                                            if (!AutoscalerServiceClient.getServiceClient().checkServiceLBExistenceAgainstPolicy(type,
+                                                                                                              deploymentPolicyName)) {
+
+                                                // if lb cluster doesn't exist
+                                                String lbAlias =
+                                                                 "lb" + type +
+                                                                         new Random().nextInt();
+                                                lbCartridgeInfo.addProperties(property);
+                                                subscribeToLb(lbCartridgeType,
+                                                              lbAlias,
+                                                              lbCartridgeInfo.getDefaultAutoscalingPolicy(),
+                                                              deploymentPolicyName,
+                                                              tenantId, 
+                                                              userName,
+                                                              tenantDomain,
+                                                              lbCartridgeInfo.getProperties());
+                                            }
+                                        }
+                                    }
+
+                                } catch (Exception ex) {
+                                    // we don't need to throw the error here.
+                                    log.error(ex.getMessage(), ex);
+                                }
+                           
+
+                            lbRefProp.add(property);
+                            break;
+                        }
+                    }
+                }
+            }
+        }
+        
+        
+        
+        
         Service service = new MultiTenantService(type, autoscalingPolicyName, deploymentPolicyName, tenantId, cartridgeInfo, tenantRange);
 
         //generate the cluster ID (domain)for the service
@@ -113,4 +294,37 @@ public class ServiceDeploymentManager {
 
         //TODO:
     }
+    
+  private void configureLBDeployment() {
+    	
+    	
+    	
+    }
+    
+    private void subscribeToLb(String cartridgeType, String lbAlias,
+            String defaultAutoscalingPolicy, String deploymentPolicy,
+            int tenantId, String userName, String tenantDomain, Property[] props) throws ADCException {
+            
+            try {
+                if(log.isDebugEnabled()) {
+                    log.debug("Subscribing to a load balancer [cartridge] "+cartridgeType+" [alias] "+lbAlias);
+                }
+                CartridgeSubscription cartridgeSubscription = 
+                        cartridgeSubsciptionManager.subscribeToCartridgeWithProperties(cartridgeType, lbAlias.trim(), defaultAutoscalingPolicy, 
+                                                                         deploymentPolicy,
+                                                                         tenantDomain, 
+                                                                         tenantId,
+                                                                         userName, "git", null, false, null, null, props);
+                
+                cartridgeSubsciptionManager.registerCartridgeSubscription(cartridgeSubscription);
+                
+                if(log.isDebugEnabled()) {
+                    log.debug("Successfully subscribed to a load balancer [cartridge] "+cartridgeType+" [alias] "+lbAlias);
+                }
+            } catch (Exception e) {
+                String msg = "Error while subscribing to load balancer cartridge [type] "+cartridgeType;
+                log.error(msg, e);
+                throw new ADCException(msg, e);
+            }
+        }
 }

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/1ba43d81/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/manager/CartridgeSubscriptionManager.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/manager/CartridgeSubscriptionManager.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/manager/CartridgeSubscriptionManager.java
index 92b5dd4..2a22c82 100644
--- a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/manager/CartridgeSubscriptionManager.java
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/manager/CartridgeSubscriptionManager.java
@@ -222,6 +222,8 @@ public class CartridgeSubscriptionManager {
         
         if(cartridgeInfo.getMultiTenant()) {
         	log.info(" Multitenant --> Publishing Artifact update event -- ");
+        	log.info(" Values :  cluster id - " + cartridgeSubscription.getClusterDomain() + "  tenant - " + 
+        			cartridgeSubscription.getSubscriber().getTenantId());
             ArtifactUpdatePublisher publisher = new ArtifactUpdatePublisher(cartridgeSubscription.getRepository(),
             		cartridgeSubscription.getClusterDomain(), // clusterId 
             		String.valueOf(cartridgeSubscription.getSubscriber().getTenantId()));

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/1ba43d81/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java
index acde631..816caad 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java
@@ -910,10 +910,10 @@ public class ServiceUtils {
      * 
      */
     static void deployService (String cartridgeType, String alias, String autoscalingPolicy, String deploymentPolicy, 
-    		String tenantDomain, int tenantId, String clusterDomain, String clusterSubdomain, String tenantRange) {
+    		String tenantDomain, String tenantUsername, int tenantId, String clusterDomain, String clusterSubdomain, String tenantRange) {
     	log.info("Deploying service..");
     	try {
-    		serviceDeploymentManager.deployService(cartridgeType, autoscalingPolicy, deploymentPolicy, tenantId, tenantRange);
+    		serviceDeploymentManager.deployService(cartridgeType, autoscalingPolicy, deploymentPolicy, tenantId, tenantRange, tenantDomain, tenantUsername);
 		} catch (Exception e) {
 			e.printStackTrace();
 		}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/1ba43d81/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/StratosAdmin.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/StratosAdmin.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/StratosAdmin.java
index bdc7c00..0cc4ca8 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/StratosAdmin.java
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/StratosAdmin.java
@@ -684,7 +684,7 @@ public class StratosAdmin extends AbstractAdmin {
     	// super tenant Deploying service (MT) 
     	// here an alias is generated
        ServiceUtils.deployService(serviceDefinitionBean.getCartridgeType(), UUID.randomUUID().toString(), serviceDefinitionBean.getAutoscalingPolicyName(),
-    		   serviceDefinitionBean.getDeploymentPolicyName(), getTenantDomain(), getTenantId(),
+    		   serviceDefinitionBean.getDeploymentPolicyName(), getTenantDomain(), getUsername(), getTenantId(),
     		   serviceDefinitionBean.getClusterDomain(), serviceDefinitionBean.getClusterSubDomain(),
     		   serviceDefinitionBean.getTenantRange());
     }


[3/3] git commit: Fixing to comply with carbon 4.2.0 version

Posted by sa...@apache.org.
Fixing to comply with carbon 4.2.0 version


Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/cd87dbcc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/cd87dbcc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/cd87dbcc

Branch: refs/heads/carbon-4.2.0-upgrade
Commit: cd87dbcc07e260a9a2155e25ec21ab37ab0a177b
Parents: 1ba43d8
Author: Sajith Kariyawasam <sa...@wso2.com>
Authored: Sat Jan 4 22:26:52 2014 +0530
Committer: Sajith Kariyawasam <sa...@wso2.com>
Committed: Sat Jan 4 22:26:52 2014 +0530

----------------------------------------------------------------------
 components/org.apache.stratos.adc.mgt/pom.xml   |   2 +-
 .../common/util/StratosConfiguration.java       |   1 -
 .../org.apache.stratos.tenant.mgt.core/pom.xml  |   5 +
 .../tenant/mgt/core/DefaultTenantPersistor.java | 343 ------------------
 .../tenant/mgt/core/TenantPersistor.java        | 347 +++++++++++++++++++
 .../internal/TenantMgtCoreServiceComponent.java |   5 -
 .../mgt/internal/TenantMgtServiceComponent.java |  35 +-
 .../services/GAppTenantRegistrationService.java |   4 +-
 .../mgt/services/TenantMgtAdminService.java     |  90 +++--
 .../services/TenantSelfRegistrationService.java |   6 +-
 .../stratos/tenant/mgt/util/TenantMgtUtil.java  |   4 +
 .../src/main/resources/META-INF/services.xml    |   4 +
 .../src/main/resources/p2.inf                   |   6 +-
 .../src/main/resources/p2.inf                   |  16 +-
 .../pom.xml                                     |   2 +-
 .../src/main/resources/p2.inf                   |  10 +-
 .../cloud-controller/modules/p2-profile/pom.xml |  24 +-
 .../distribution/src/main/assembly/bin.xml      |   6 +-
 .../ui/clients/CloudManagerServiceClient.java   |   9 +-
 .../modules/distribution/src/assembly/bin.xml   |   4 +-
 .../modules/p2-profile-gen/pom.xml              |  50 +--
 21 files changed, 507 insertions(+), 466 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/cd87dbcc/components/org.apache.stratos.adc.mgt/pom.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/pom.xml b/components/org.apache.stratos.adc.mgt/pom.xml
index 83fb1b9..c1de77a 100644
--- a/components/org.apache.stratos.adc.mgt/pom.xml
+++ b/components/org.apache.stratos.adc.mgt/pom.xml
@@ -137,7 +137,7 @@
 							org.apache.stratos.adc.mgt.*
                         			</Export-Package>
 						<Import-Package>
-							org.apache.axis2.*; version="1.6.1.wso2v6",
+							org.apache.axis2.*; version="1.6.1-wso2v10",
 							org.apache.axiom.*; version="${axiom.osgi.version.range}",
 							org.apache.neethi.*;
 							version="2.0.4.wso2v4",

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/cd87dbcc/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/util/StratosConfiguration.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/util/StratosConfiguration.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/util/StratosConfiguration.java
index 2226593..370932c 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/util/StratosConfiguration.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/util/StratosConfiguration.java
@@ -18,7 +18,6 @@
  */
 package org.apache.stratos.common.util;
 
-import java.lang.String;
 import java.util.HashMap;
 import java.util.Map;
 

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/cd87dbcc/components/org.apache.stratos.tenant.mgt.core/pom.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt.core/pom.xml b/components/org.apache.stratos.tenant.mgt.core/pom.xml
index 5836c6d..53f60c5 100644
--- a/components/org.apache.stratos.tenant.mgt.core/pom.xml
+++ b/components/org.apache.stratos.tenant.mgt.core/pom.xml
@@ -71,6 +71,11 @@
     <dependencies>
         <dependency>
             <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.core</artifactId>
+	    <version>${wso2carbon.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.wso2.carbon</groupId>
             <artifactId>org.wso2.carbon.registry.core</artifactId>
 	    <version>${wso2carbon.version}</version>
         </dependency>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/cd87dbcc/components/org.apache.stratos.tenant.mgt.core/src/main/java/org/apache/stratos/tenant/mgt/core/DefaultTenantPersistor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt.core/src/main/java/org/apache/stratos/tenant/mgt/core/DefaultTenantPersistor.java b/components/org.apache.stratos.tenant.mgt.core/src/main/java/org/apache/stratos/tenant/mgt/core/DefaultTenantPersistor.java
deleted file mode 100644
index 259d30f..0000000
--- a/components/org.apache.stratos.tenant.mgt.core/src/main/java/org/apache/stratos/tenant/mgt/core/DefaultTenantPersistor.java
+++ /dev/null
@@ -1,343 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one 
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.apache.stratos.tenant.mgt.core;
-
-import org.apache.stratos.tenant.mgt.core.internal.TenantMgtCoreServiceComponent;
-import org.wso2.carbon.CarbonConstants;
-import org.wso2.carbon.core.multitenancy.persistence.TenantPersistor;
-import org.wso2.carbon.registry.core.RegistryConstants;
-import org.wso2.carbon.registry.core.Resource;
-import org.wso2.carbon.registry.core.exceptions.RegistryException;
-import org.wso2.carbon.registry.core.session.UserRegistry;
-import org.apache.stratos.common.config.CloudServiceConfigParser;
-import org.apache.stratos.common.config.CloudServicesDescConfig;
-import org.apache.stratos.common.constants.StratosConstants;
-import org.apache.stratos.common.util.CloudServicesUtil;
-import org.apache.stratos.common.util.CommonUtil;
-import org.apache.stratos.tenant.mgt.core.util.TenantCoreUtil;
-import org.wso2.carbon.user.api.RealmConfiguration;
-import org.wso2.carbon.user.api.TenantMgtConfiguration;
-import org.wso2.carbon.user.core.AuthorizationManager;
-import org.wso2.carbon.user.core.UserCoreConstants;
-import org.wso2.carbon.user.core.UserRealm;
-import org.wso2.carbon.user.core.UserStoreException;
-import org.wso2.carbon.user.core.UserStoreManager;
-import org.wso2.carbon.user.core.config.multitenancy.MultiTenantRealmConfigBuilder;
-import org.wso2.carbon.user.core.service.RealmService;
-import org.wso2.carbon.user.core.tenant.Tenant;
-import org.wso2.carbon.user.core.tenant.TenantManager;
-import org.wso2.carbon.user.mgt.UserMgtConstants;
-import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * TenantPersistenceManager - Methods related to persisting the tenant.
- */
-public class DefaultTenantPersistor implements TenantPersistor {
-
-    private static final Log log = LogFactory.getLog(DefaultTenantPersistor.class);
-    private static final String ILLEGAL_CHARACTERS_FOR_PATH = ".*[~!#$;%^*()+={}\\[\\]\\|\\\\<>].*";
-
-    private static CloudServicesDescConfig cloudServicesDesc = null;
-        
-
-    /**
-     * Persists the given tenant
-     * @param tenant - tenant to be persisted
-     * @param checkDomainValidation - true, if domain is validated.
-     * @param successKey - successKey
-     * @param originatedService - The Service that the tenant registration was originated.
-     * @return tenant Id - the tenant id
-     * @throws Exception, if persisting tenant failed.
-     */
-    public int persistTenant(Tenant tenant, boolean checkDomainValidation, String successKey,
-                             String originatedService) throws Exception {
-        int tenantId;
-        validateAdminUserName(tenant);
-        String tenantDomain = tenant.getDomain();
-
-        boolean isDomainAvailable = CommonUtil.isDomainNameAvailable(tenantDomain);
-        if (!isDomainAvailable) {
-            throw new Exception("Domain is not available to register");
-        }
-
-        RealmService realmService = TenantMgtCoreServiceComponent.getRealmService();
-        RealmConfiguration realmConfig = realmService.getBootstrapRealmConfiguration();
-        TenantMgtConfiguration tenantMgtConfiguration = realmService.getTenantMgtConfiguration();
-        MultiTenantRealmConfigBuilder builder = TenantMgtCoreServiceComponent.
-                getRealmService().getMultiTenantRealmConfigBuilder();
-        RealmConfiguration realmConfigToPersist =
-                builder.getRealmConfigForTenantToPersist(realmConfig, tenantMgtConfiguration,
-                                                         tenant, -1);
-        tenant.setRealmConfig(realmConfigToPersist);
-        tenantId = addTenant(tenant);
-        tenant.setId(tenantId);
-
-        if (checkDomainValidation) { 
-            if (successKey != null) {
-                if (CommonUtil.validateDomainFromSuccessKey(TenantMgtCoreServiceComponent.
-                        getGovernanceSystemRegistry(MultitenantConstants.SUPER_TENANT_ID),
-                                                            tenant.getDomain(), successKey)) {
-                    storeDomainValidationFlagToRegistry(tenant);
-                } else {
-                    String msg = "Failed to validate domain";
-                    throw new Exception(msg);
-                }
-            }
-        } else {
-            storeDomainValidationFlagToRegistry(tenant);
-        }
-        
-        try {
-            doPostTenantCreationActions(tenant, originatedService);
-        } catch (Exception e) {
-            String msg = "Error performing post tenant creation actions";
-            throw new Exception(msg, e);
-        }
-
-        return tenantId;
-    }
-
-    private void doPostTenantCreationActions(Tenant tenant,
-                                             String originatedService) throws Exception {
-        RealmService realmService = TenantMgtCoreServiceComponent.getRealmService();
-        UserRealm userRealm;
-        try {
-            userRealm = (UserRealm) realmService.getTenantUserRealm(tenant.getId());
-        } catch (UserStoreException e) {
-            String msg = "Error in creating Realm for tenant: " + tenant.getDomain();
-            throw new Exception(msg, e);
-        }
-
-        updateTenantAdminPassword(userRealm, tenant);
-        TenantMgtCoreServiceComponent.getRegistryLoader().loadTenantRegistry(tenant.getId());
-        copyUIPermissions(tenant.getId());
-
-        TenantCoreUtil.setOriginatedService(tenant.getId(), originatedService);
-        setActivationFlags(tenant.getId(), originatedService);
-
-        TenantCoreUtil.initializeRegistry(tenant.getId());
-
-    }
-
-    /**
-     * Store the domain validation flag in the registry if the domain has been
-     * validated.
-     * 
-     * @param tenant - the tenant
-     * @throws RegistryException, if storing the domain validation flag failed.
-     */
-    private void storeDomainValidationFlagToRegistry(Tenant tenant) throws RegistryException {
-
-        try {
-            String domainValidationPath = StratosConstants.TENANT_DOMAIN_VERIFICATION_FLAG_PATH +
-                                                  RegistryConstants.PATH_SEPARATOR + tenant.getId();
-            UserRegistry superTenantRegistry = TenantMgtCoreServiceComponent.
-                    getGovernanceSystemRegistry(MultitenantConstants.SUPER_TENANT_ID);
-            Resource validationFlagR = superTenantRegistry.newResource();
-            validationFlagR.setProperty(tenant.getDomain(), "true");
-            superTenantRegistry.put(domainValidationPath, validationFlagR);
-
-        } catch (RegistryException e) {
-            String msg = "Error in storing the domain validation flag to the registry";
-            log.error(msg, e);
-            throw new RegistryException(msg, e);
-        }
-        if (log.isDebugEnabled()) {
-            log.debug("Domain Validation Flag is stored to the registry.");
-        }
-    }
-
-    /**
-     * Adds a tenant to the tenant manager
-     * 
-     * @param tenant - the tenant
-     * @return tenantId - the tenant id
-     * @throws Exception - UserStoreException
-     */
-    private int addTenant(Tenant tenant) throws Exception {
-        int tenantId;
-        TenantManager tenantManager = TenantMgtCoreServiceComponent.getTenantManager();
-        try {
-            tenantId = tenantManager.addTenant(tenant);
-            if (log.isDebugEnabled()) {
-                log.debug("Tenant is successfully added: " + tenant.getDomain());
-            }
-        } catch (UserStoreException e) {
-            String msg = "Error in adding tenant with domain: " + tenant.getDomain();
-            log.error(msg, e);
-            throw new Exception(msg, e);
-        }
-        return tenantId;
-    }
-
-    /**
-     * Sets the password for the tenant
-     * 
-     * @param tenant - the tenant
-     * @param userRealm - user realm
-     * @throws Exception - UserStoreException
-     */
-    private void updateTenantAdminPassword(UserRealm userRealm, Tenant tenant) throws Exception {
-        try {
-            UserStoreManager userStoreManager = userRealm.getUserStoreManager();
-            if (!userStoreManager.isReadOnly()) {
-                userStoreManager.updateCredentialByAdmin(tenant.getAdminName(),
-                                                         tenant.getAdminPassword());
-                if (log.isDebugEnabled()) {
-                    log.debug("Successfully set the password for the tenant.");
-                }
-            }
-        } catch (UserStoreException e) {
-            String msg = "Error in changing the tenant admin password for tenant domain: " +
-                                 tenant.getDomain() + ".";
-            log.error(msg, e);
-            throw new Exception(msg, e);
-        }
-    }
-
-    /**
-     * Authorize the role
-     *
-     * @param tenantId - tenant id
-     * @throws Exception - UserStoreException
-     */
-    private void copyUIPermissions(int tenantId) throws Exception {
-        try {
-            UserRealm realm = (UserRealm) TenantMgtCoreServiceComponent.
-                    getRealmService().getTenantUserRealm(tenantId);
-            String adminRole = realm.getRealmConfiguration().getAdminRoleName();
-            AuthorizationManager authMan = realm.getAuthorizationManager();
-            // Authorize the admin role, if not authorized yet.
-            if (!authMan.isRoleAuthorized(adminRole,
-                                          CarbonConstants.UI_ADMIN_PERMISSION_COLLECTION,
-                                          UserMgtConstants.EXECUTE_ACTION)) {
-                authMan.authorizeRole(adminRole, CarbonConstants.UI_ADMIN_PERMISSION_COLLECTION,
-                                      UserMgtConstants.EXECUTE_ACTION);
-            }
-        } catch (UserStoreException e) {
-            String msg = "Error in authorizing the admin role.";
-            log.error(msg, e);
-            throw new Exception(msg, e);
-        }
-        if (log.isDebugEnabled()) {
-            log.debug("Role has successfully been authorized.");
-        }
-    }
-    
-    private void setActivationFlags(int tenantId, String originalService) throws Exception {
-
-        boolean useDefaultConfig = true;
-        try {
-            
-            if(cloudServicesDesc == null ) { 
-                cloudServicesDesc = CloudServiceConfigParser.loadCloudServicesConfiguration();
-            }
-
-            if (originalService != null &&
-                !originalService.equals(StratosConstants.CLOUD_MANAGER_SERVICE) ) {
-                CloudServicesUtil.activateOriginalAndCompulsoryServices(cloudServicesDesc,
-                                                                        originalService, tenantId);
-                useDefaultConfig = false;
-            }
-
-            if (useDefaultConfig) {
-                CloudServicesUtil.activateAllServices(cloudServicesDesc, tenantId);
-            }
-        } catch (Exception e) {
-            log.error("Error registering the originated service", e);
-            throw e;
-        }
-        
-    }
-
-    /**
-     * Validates that the chosen AdminUserName is valid.
-     * 
-     * @param tenant
-     *            tenant information
-     * @throws Exception
-     *             UserStoreException
-     */
-    private void validateAdminUserName(Tenant tenant) throws Exception {
-        UserRealm superTenantUserRealm =
-                                        TenantMgtCoreServiceComponent.getRealmService().
-                                                                      getBootstrapRealm();
-        RealmConfiguration realmConfig = TenantMgtCoreServiceComponent.
-                getBootstrapRealmConfiguration();
-        String uniqueAcrossTenants = realmConfig.getUserStoreProperty(
-                UserCoreConstants.RealmConfig.PROPERTY_USERNAME_UNIQUE);
-        if ("true".equals(uniqueAcrossTenants)) {
-            try {
-                if (superTenantUserRealm.getUserStoreManager().isExistingUser(
-                        tenant.getAdminName())) {
-                    throw new Exception("User name : " + tenant.getAdminName() +
-                                        " exists in the system. " +
-                                        "Please pick another user name for tenant Administrator.");
-                }
-            } catch (UserStoreException e) {
-                String msg = "Error in checking whether the user already exists in the system";
-                log.error(msg, e);
-                throw new Exception(msg, e);
-            }
-        }
-        if (tenant.getAdminName().matches(DefaultTenantPersistor.ILLEGAL_CHARACTERS_FOR_PATH)) {
-            String msg = "The tenant admin ' " + tenant.getAdminName() +
-                                 " ' contains one or more illegal characters" +
-                                 " (~!@#$;%^*()+={}[]|\\<>)";
-            log.error(msg);
-            throw new Exception(msg);
-        }
-        if (log.isDebugEnabled()) {
-            log.debug("Admin User Name has been validated.");
-        }
-    }
-
-    /**
-     * Persists the given tenant
-     * @param tenant - tenant to be persisted
-     * @return tenant Id
-     * @throws Exception, if persisting tenant failed.
-     */
-    public int persistTenant(Tenant tenant) throws Exception {
-        String tenantDomain = tenant.getDomain();
-        int tenantId;
-        validateAdminUserName(tenant);
-        boolean isDomainAvailable = CommonUtil.isDomainNameAvailable(tenantDomain);
-        if (!isDomainAvailable) {
-            throw new Exception("Domain is not available to register");
-        }
-
-        tenantId = addTenant(tenant);
-        tenant.setId(tenantId);
-
-        try {
-            doPostTenantCreationActions(tenant, null);
-        } catch (Exception e) {
-            String msg = "Error performing post tenant creation actions";
-            if(log.isDebugEnabled()) {
-                log.debug(msg, e);
-            }
-            throw new Exception(msg);
-        }
-        return tenantId;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/cd87dbcc/components/org.apache.stratos.tenant.mgt.core/src/main/java/org/apache/stratos/tenant/mgt/core/TenantPersistor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt.core/src/main/java/org/apache/stratos/tenant/mgt/core/TenantPersistor.java b/components/org.apache.stratos.tenant.mgt.core/src/main/java/org/apache/stratos/tenant/mgt/core/TenantPersistor.java
new file mode 100644
index 0000000..86d7e41
--- /dev/null
+++ b/components/org.apache.stratos.tenant.mgt.core/src/main/java/org/apache/stratos/tenant/mgt/core/TenantPersistor.java
@@ -0,0 +1,347 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one 
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.stratos.tenant.mgt.core;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.wso2.carbon.CarbonConstants;
+import org.wso2.carbon.registry.core.RegistryConstants;
+import org.wso2.carbon.registry.core.Resource;
+import org.wso2.carbon.registry.core.exceptions.RegistryException;
+import org.wso2.carbon.registry.core.session.UserRegistry;
+import org.apache.stratos.common.config.CloudServiceConfigParser;
+import org.apache.stratos.common.config.CloudServicesDescConfig;
+import org.apache.stratos.common.constants.StratosConstants;
+import org.apache.stratos.common.util.CloudServicesUtil;
+import org.apache.stratos.common.util.CommonUtil;
+import org.apache.stratos.tenant.mgt.core.internal.TenantMgtCoreServiceComponent;
+import org.apache.stratos.tenant.mgt.core.util.TenantCoreUtil;
+import org.wso2.carbon.user.api.RealmConfiguration;
+import org.wso2.carbon.user.api.TenantMgtConfiguration;
+import org.wso2.carbon.user.core.*;
+import org.wso2.carbon.user.core.config.multitenancy.MultiTenantRealmConfigBuilder;
+import org.wso2.carbon.user.core.service.RealmService;
+import org.wso2.carbon.user.core.tenant.Tenant;
+import org.wso2.carbon.user.core.tenant.TenantManager;
+import org.wso2.carbon.user.mgt.UserMgtConstants;
+import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
+
+/**
+ * TenantPersistenceManager - Methods related to persisting the tenant.
+ */
+public class TenantPersistor {
+
+    private static final Log log = LogFactory.getLog(TenantPersistor.class);
+    private static final String ILLEGAL_CHARACTERS_FOR_PATH = ".*[~!#$;%^*()+={}\\[\\]\\|\\\\<>].*";
+
+    private static CloudServicesDescConfig cloudServicesDesc = null;
+        
+
+    /**
+     * Persists the given tenant
+     * @param tenant - tenant to be persisted
+     * @param checkDomainValidation - true, if domain is validated.
+     * @param successKey - successKey
+     * @param originatedService - The Service that the tenant registration was originated.
+     * @return tenant Id - the tenant id
+     * @throws Exception, if persisting tenant failed.
+     */
+    public int persistTenant(Tenant tenant, boolean checkDomainValidation, String successKey,
+                             String originatedService,boolean isSkeleton) throws Exception {
+        int tenantId = 0;
+        if(!isSkeleton){
+           tenantId=persistTenantInUserStore(tenant,checkDomainValidation,successKey);
+        }else {
+           tenantId=tenant.getId();
+        }
+        
+        try {
+            doPostTenantCreationActions(tenant, originatedService);
+        } catch (Exception e) {
+            String msg = "Error performing post tenant creation actions";
+            throw new Exception(msg, e);
+        }
+
+        return tenantId;
+    }
+
+    private int persistTenantInUserStore(Tenant tenant, boolean checkDomainValidation, String successKey) throws Exception {
+        int tenantId;
+        validateAdminUserName(tenant);
+        String tenantDomain = tenant.getDomain();
+
+        boolean isDomainAvailable = CommonUtil.isDomainNameAvailable(tenantDomain);
+        if (!isDomainAvailable) {
+            throw new Exception("Domain is not available to register");
+        }
+
+        RealmService realmService = TenantMgtCoreServiceComponent.getRealmService();
+        RealmConfiguration realmConfig = realmService.getBootstrapRealmConfiguration();
+        TenantMgtConfiguration tenantMgtConfiguration = realmService.getTenantMgtConfiguration();
+        MultiTenantRealmConfigBuilder builder = TenantMgtCoreServiceComponent.
+                getRealmService().getMultiTenantRealmConfigBuilder();
+        RealmConfiguration realmConfigToPersist =
+                builder.getRealmConfigForTenantToPersist(realmConfig, tenantMgtConfiguration,
+                        tenant, -1);
+        tenant.setRealmConfig(realmConfigToPersist);
+        tenantId = addTenant(tenant);
+        tenant.setId(tenantId);
+
+        if (checkDomainValidation) {
+            if (successKey != null) {
+                if (CommonUtil.validateDomainFromSuccessKey(TenantMgtCoreServiceComponent.
+                        getGovernanceSystemRegistry(MultitenantConstants.SUPER_TENANT_ID),
+                        tenant.getDomain(), successKey)) {
+                    storeDomainValidationFlagToRegistry(tenant);
+                } else {
+                    String msg = "Failed to validate domain";
+                    throw new Exception(msg);
+                }
+            }
+        } else {
+            storeDomainValidationFlagToRegistry(tenant);
+        }
+
+        updateTenantAdminPassword(tenant);
+        return tenantId;
+    }
+
+    private void doPostTenantCreationActions(Tenant tenant,
+                                             String originatedService) throws Exception {
+
+        TenantMgtCoreServiceComponent.getRegistryLoader().loadTenantRegistry(tenant.getId());
+        copyUIPermissions(tenant.getId());
+
+        TenantCoreUtil.setOriginatedService(tenant.getId(), originatedService);
+        setActivationFlags(tenant.getId(), originatedService);
+
+        TenantCoreUtil.initializeRegistry(tenant.getId());
+
+    }
+
+    /**
+     * Store the domain validation flag in the registry if the domain has been
+     * validated.
+     * 
+     * @param tenant - the tenant
+     * @throws RegistryException, if storing the domain validation flag failed.
+     */
+    protected void storeDomainValidationFlagToRegistry(Tenant tenant) throws RegistryException {
+
+        try {
+            String domainValidationPath = StratosConstants.TENANT_DOMAIN_VERIFICATION_FLAG_PATH +
+                                                  RegistryConstants.PATH_SEPARATOR + tenant.getId();
+            UserRegistry superTenantRegistry = TenantMgtCoreServiceComponent.
+                    getGovernanceSystemRegistry(MultitenantConstants.SUPER_TENANT_ID);
+            Resource validationFlagR = superTenantRegistry.newResource();
+            validationFlagR.setProperty(tenant.getDomain(), "true");
+            superTenantRegistry.put(domainValidationPath, validationFlagR);
+
+        } catch (RegistryException e) {
+            String msg = "Error in storing the domain validation flag to the registry";
+            log.error(msg, e);
+            throw new RegistryException(msg, e);
+        }
+        if (log.isDebugEnabled()) {
+            log.debug("Domain Validation Flag is stored to the registry.");
+        }
+    }
+
+    /**
+     * Adds a tenant to the tenant manager
+     * 
+     * @param tenant - the tenant
+     * @return tenantId - the tenant id
+     * @throws Exception - UserStoreException
+     */
+    private int addTenant(Tenant tenant) throws Exception {
+        int tenantId;
+        TenantManager tenantManager = TenantMgtCoreServiceComponent.getTenantManager();
+        try {
+            tenantId = tenantManager.addTenant(tenant);
+            if (log.isDebugEnabled()) {
+                log.debug("Tenant is successfully added: " + tenant.getDomain());
+            }
+        } catch (UserStoreException e) {
+            String msg = "Error in adding tenant with domain: " + tenant.getDomain();
+            log.error(msg, e);
+            throw new Exception(msg, e);
+        }
+        return tenantId;
+    }
+
+    /**
+     * Sets the password for the tenant
+     * 
+     * @param tenant - the tenant
+     * @throws Exception - UserStoreException
+     */
+    private void updateTenantAdminPassword(Tenant tenant) throws Exception {
+        RealmService realmService = TenantMgtCoreServiceComponent.getRealmService();
+        UserRealm userRealm;
+        try {
+            userRealm = (UserRealm) realmService.getTenantUserRealm(tenant.getId());
+        } catch (UserStoreException e) {
+            String msg = "Error in creating Realm for tenant: " + tenant.getDomain();
+            throw new Exception(msg, e);
+        }
+        try {
+            UserStoreManager userStoreManager = userRealm.getUserStoreManager();
+            if (!userStoreManager.isReadOnly()) {
+                userStoreManager.updateCredentialByAdmin(tenant.getAdminName(),
+                                                         tenant.getAdminPassword());
+                if (log.isDebugEnabled()) {
+                    log.debug("Successfully set the password for the tenant.");
+                }
+            }
+        } catch (UserStoreException e) {
+            String msg = "Error in changing the tenant admin password for tenant domain: " +
+                                 tenant.getDomain() + ".";
+            log.error(msg, e);
+            throw new Exception(msg, e);
+        }
+    }
+
+    /**
+     * Authorize the role
+     *
+     * @param tenantId - tenant id
+     * @throws Exception - UserStoreException
+     */
+    protected void copyUIPermissions(int tenantId) throws Exception {
+        try {
+            UserRealm realm = (UserRealm) TenantMgtCoreServiceComponent.
+                    getRealmService().getTenantUserRealm(tenantId);
+            String adminRole = realm.getRealmConfiguration().getAdminRoleName();
+            AuthorizationManager authMan = realm.getAuthorizationManager();
+            // Authorize the admin role, if not authorized yet.
+            if (!authMan.isRoleAuthorized(adminRole,
+                                          CarbonConstants.UI_ADMIN_PERMISSION_COLLECTION,
+                                          UserMgtConstants.EXECUTE_ACTION)) {
+                authMan.authorizeRole(adminRole, CarbonConstants.UI_ADMIN_PERMISSION_COLLECTION,
+                                      UserMgtConstants.EXECUTE_ACTION);
+            }
+        } catch (UserStoreException e) {
+            String msg = "Error in authorizing the admin role.";
+            log.error(msg, e);
+            throw new Exception(msg, e);
+        }
+        if (log.isDebugEnabled()) {
+            log.debug("Role has successfully been authorized.");
+        }
+    }
+    
+    protected void setActivationFlags(int tenantId, String originalService) throws Exception {
+
+        boolean useDefaultConfig = true;
+        try {
+            
+            if(cloudServicesDesc == null ) { 
+                cloudServicesDesc = CloudServiceConfigParser.loadCloudServicesConfiguration();
+            }
+
+            if (originalService != null &&
+                !originalService.equals(StratosConstants.CLOUD_MANAGER_SERVICE) ) {
+                CloudServicesUtil.activateOriginalAndCompulsoryServices(cloudServicesDesc,
+                                                                        originalService, tenantId);
+                useDefaultConfig = false;
+            }
+
+            if (useDefaultConfig) {
+                CloudServicesUtil.activateAllServices(cloudServicesDesc, tenantId);
+            }
+        } catch (Exception e) {
+            log.error("Error registering the originated service", e);
+            throw e;
+        }
+        
+    }
+
+    /**
+     * Validates that the chosen AdminUserName is valid.
+     * 
+     * @param tenant
+     *            tenant information
+     * @throws Exception
+     *             UserStoreException
+     */
+    private void validateAdminUserName(Tenant tenant) throws Exception {
+        UserRealm superTenantUserRealm =
+                                        TenantMgtCoreServiceComponent.getRealmService().
+                                                                      getBootstrapRealm();
+        RealmConfiguration realmConfig = TenantMgtCoreServiceComponent.
+                getBootstrapRealmConfiguration();
+        String uniqueAcrossTenants = realmConfig.getUserStoreProperty(
+                UserCoreConstants.RealmConfig.PROPERTY_USERNAME_UNIQUE);
+        if ("true".equals(uniqueAcrossTenants)) {
+            try {
+                if (superTenantUserRealm.getUserStoreManager().isExistingUser(
+                        tenant.getAdminName())) {
+                    throw new Exception("User name : " + tenant.getAdminName() +
+                                        " exists in the system. " +
+                                        "Please pick another user name for tenant Administrator.");
+                }
+            } catch (UserStoreException e) {
+                String msg = "Error in checking whether the user already exists in the system";
+                log.error(msg, e);
+                throw new Exception(msg, e);
+            }
+        }
+        if (tenant.getAdminName().matches(TenantPersistor.ILLEGAL_CHARACTERS_FOR_PATH)) {
+            String msg = "The tenant admin ' " + tenant.getAdminName() +
+                                 " ' contains one or more illegal characters" +
+                                 " (~!@#$;%^*()+={}[]|\\<>)";
+            log.error(msg);
+            throw new Exception(msg);
+        }
+        if (log.isDebugEnabled()) {
+            log.debug("Admin User Name has been validated.");
+        }
+    }
+
+    /**
+     * Persists the given tenant
+     * @param tenant - tenant to be persisted
+     * @return tenant Id
+     * @throws Exception, if persisting tenant failed.
+     */
+    public int persistTenant(Tenant tenant) throws Exception {
+        String tenantDomain = tenant.getDomain();
+        int tenantId;
+        validateAdminUserName(tenant);
+        boolean isDomainAvailable = CommonUtil.isDomainNameAvailable(tenantDomain);
+        if (!isDomainAvailable) {
+            throw new Exception("Domain is not available to register");
+        }
+
+        tenantId = addTenant(tenant);
+        tenant.setId(tenantId);
+
+        try {
+            doPostTenantCreationActions(tenant, null);
+        } catch (Exception e) {
+            String msg = "Error performing post tenant creation actions";
+            if(log.isDebugEnabled()) {
+                log.debug(msg, e);
+            }
+            throw new Exception(msg);
+        }
+        return tenantId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/cd87dbcc/components/org.apache.stratos.tenant.mgt.core/src/main/java/org/apache/stratos/tenant/mgt/core/internal/TenantMgtCoreServiceComponent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt.core/src/main/java/org/apache/stratos/tenant/mgt/core/internal/TenantMgtCoreServiceComponent.java b/components/org.apache.stratos.tenant.mgt.core/src/main/java/org/apache/stratos/tenant/mgt/core/internal/TenantMgtCoreServiceComponent.java
index 22a8a50..8ab917d 100644
--- a/components/org.apache.stratos.tenant.mgt.core/src/main/java/org/apache/stratos/tenant/mgt/core/internal/TenantMgtCoreServiceComponent.java
+++ b/components/org.apache.stratos.tenant.mgt.core/src/main/java/org/apache/stratos/tenant/mgt/core/internal/TenantMgtCoreServiceComponent.java
@@ -22,7 +22,6 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.osgi.framework.BundleContext;
 import org.osgi.service.component.ComponentContext;
-import org.wso2.carbon.core.multitenancy.persistence.TenantPersistor;
 import org.wso2.carbon.registry.core.exceptions.RegistryException;
 import org.wso2.carbon.registry.core.service.RegistryService;
 import org.wso2.carbon.registry.core.service.TenantRegistryLoader;
@@ -30,7 +29,6 @@ import org.wso2.carbon.registry.core.session.UserRegistry;
 import org.wso2.carbon.user.api.RealmConfiguration;
 import org.wso2.carbon.user.core.service.RealmService;
 import org.wso2.carbon.user.core.tenant.TenantManager;
-import org.apache.stratos.tenant.mgt.core.DefaultTenantPersistor;
 
 /**
  * @scr.component name="org.apache.stratos.tenant.mgt.core" immediate="true"
@@ -53,14 +51,11 @@ public class TenantMgtCoreServiceComponent {
     private static BundleContext bundleContext;
     private static RealmService realmService;
     private static RegistryService registryService;
-    private static TenantPersistor tenantPersistor;
     private static TenantRegistryLoader registryLoader;
     
     protected void activate(ComponentContext context) {
         try {
-            tenantPersistor = new DefaultTenantPersistor();
             bundleContext = context.getBundleContext();
-            bundleContext.registerService(TenantPersistor.class.getName(), tenantPersistor, null);
             log.debug("******* Tenant Core bundle is activated ******* ");
         } catch (Exception e) {
             log.error("Error occurred while activating tenant.mgt.core bundle. " + e);

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/cd87dbcc/components/org.apache.stratos.tenant.mgt/src/main/java/org/apache/stratos/tenant/mgt/internal/TenantMgtServiceComponent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt/src/main/java/org/apache/stratos/tenant/mgt/internal/TenantMgtServiceComponent.java b/components/org.apache.stratos.tenant.mgt/src/main/java/org/apache/stratos/tenant/mgt/internal/TenantMgtServiceComponent.java
index ec85f5f..d9822cb 100644
--- a/components/org.apache.stratos.tenant.mgt/src/main/java/org/apache/stratos/tenant/mgt/internal/TenantMgtServiceComponent.java
+++ b/components/org.apache.stratos.tenant.mgt/src/main/java/org/apache/stratos/tenant/mgt/internal/TenantMgtServiceComponent.java
@@ -18,7 +18,13 @@
  */
 package org.apache.stratos.tenant.mgt.internal;
 
-import org.wso2.carbon.core.multitenancy.persistence.TenantPersistor;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.neethi.Policy;
+import org.osgi.service.component.ComponentContext;
 import org.wso2.carbon.registry.core.exceptions.RegistryException;
 import org.wso2.carbon.registry.core.service.RegistryService;
 import org.wso2.carbon.registry.core.session.UserRegistry;
@@ -32,20 +38,11 @@ import org.wso2.carbon.user.core.service.RealmService;
 import org.wso2.carbon.user.core.tenant.TenantManager;
 import org.wso2.carbon.utils.ConfigurationContextService;
 
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.neethi.Policy;
-
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
 
-import org.osgi.service.component.ComponentContext;
-
 /**
  * @scr.component name="org.apache.stratos.tenant.mgt" immediate="true"
  * @scr.reference name="registry.service"
@@ -71,11 +68,6 @@ import org.osgi.service.component.ComponentContext;
  *                cardinality="0..1" policy="dynamic"
  *                bind="setTenantBillingService"
  *                unbind="unsetTenantBillingService"
- * @scr.reference name="default.tenant.persistor"
- *                interface="org.wso2.carbon.core.multitenancy.persistence.TenantPersistor"
- *                cardinality="1..1" policy="dynamic"
- *                bind="setTenantPersistor"
- *                unbind="unsetTenantPersistor"
  */
 public class TenantMgtServiceComponent {
     private static Log log = LogFactory.getLog(TenantMgtServiceComponent.class);
@@ -88,7 +80,6 @@ public class TenantMgtServiceComponent {
     private static ConfigurationContextService configurationContextService;
     
     private static List<TenantMgtListener> tenantMgtListeners = new ArrayList<TenantMgtListener>();
-    private static TenantPersistor tenantPersistor = null;
     private static TenantBillingService billingService = null;
 
     protected void activate(ComponentContext context) {
@@ -212,18 +203,6 @@ public class TenantMgtServiceComponent {
         return registryService.getConfigSystemRegistry(tenantId);
     }
 
-    public static TenantPersistor getTenantPersistor() {
-        return tenantPersistor;
-    }
-
-    protected void setTenantPersistor(TenantPersistor defaultTenantPersistor) {
-        tenantPersistor = defaultTenantPersistor;
-    }
-
-    public void unsetTenantPersistor(TenantPersistor defaultTenantPersistor) {
-        tenantPersistor = null;
-    }
-
     
    /** Updates RelyingPartyService with Crypto information
     *

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/cd87dbcc/components/org.apache.stratos.tenant.mgt/src/main/java/org/apache/stratos/tenant/mgt/services/GAppTenantRegistrationService.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt/src/main/java/org/apache/stratos/tenant/mgt/services/GAppTenantRegistrationService.java b/components/org.apache.stratos.tenant.mgt/src/main/java/org/apache/stratos/tenant/mgt/services/GAppTenantRegistrationService.java
index cfd284d..7fd5f81 100644
--- a/components/org.apache.stratos.tenant.mgt/src/main/java/org/apache/stratos/tenant/mgt/services/GAppTenantRegistrationService.java
+++ b/components/org.apache.stratos.tenant.mgt/src/main/java/org/apache/stratos/tenant/mgt/services/GAppTenantRegistrationService.java
@@ -24,7 +24,6 @@ package org.apache.stratos.tenant.mgt.services;
 import org.apache.stratos.tenant.mgt.exception.TenantManagementException;
 import org.apache.stratos.tenant.mgt.internal.TenantMgtServiceComponent;
 import org.apache.stratos.tenant.mgt.util.TenantMgtUtil;
-import org.wso2.carbon.core.multitenancy.persistence.TenantPersistor;
 import org.apache.stratos.common.beans.TenantInfoBean;
 import org.apache.stratos.common.exception.StratosException;
 import org.wso2.carbon.user.api.RealmConfiguration;
@@ -34,6 +33,7 @@ import org.wso2.carbon.user.core.UserCoreConstants;
 import org.wso2.carbon.user.core.config.multitenancy.MultiTenantRealmConfigBuilder;
 import org.wso2.carbon.user.core.tenant.Tenant;
 import org.wso2.carbon.user.core.tenant.TenantManager;
+import org.apache.stratos.tenant.mgt.core.TenantPersistor;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -84,7 +84,7 @@ public class GAppTenantRegistrationService {
         try {
             int tenantId = -1;
             Tenant tenant = TenantMgtUtil.initializeTenant(tenantInfoBean);
-            TenantPersistor tenantPersistor = TenantMgtServiceComponent.getTenantPersistor();
+            TenantPersistor tenantPersistor = new TenantPersistor();
 
             MultiTenantRealmConfigBuilder builder =
                     TenantMgtServiceComponent.getRealmService().getMultiTenantRealmConfigBuilder();

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/cd87dbcc/components/org.apache.stratos.tenant.mgt/src/main/java/org/apache/stratos/tenant/mgt/services/TenantMgtAdminService.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt/src/main/java/org/apache/stratos/tenant/mgt/services/TenantMgtAdminService.java b/components/org.apache.stratos.tenant.mgt/src/main/java/org/apache/stratos/tenant/mgt/services/TenantMgtAdminService.java
index 4f159f5..730796c 100644
--- a/components/org.apache.stratos.tenant.mgt/src/main/java/org/apache/stratos/tenant/mgt/services/TenantMgtAdminService.java
+++ b/components/org.apache.stratos.tenant.mgt/src/main/java/org/apache/stratos/tenant/mgt/services/TenantMgtAdminService.java
@@ -19,7 +19,6 @@
 package org.apache.stratos.tenant.mgt.services;
 
 import org.wso2.carbon.core.AbstractAdmin;
-import org.wso2.carbon.core.multitenancy.persistence.TenantPersistor;
 import org.wso2.carbon.registry.core.session.UserRegistry;
 import org.apache.stratos.common.beans.TenantInfoBean;
 import org.apache.stratos.common.exception.StratosException;
@@ -36,6 +35,7 @@ import org.wso2.carbon.user.core.tenant.Tenant;
 import org.wso2.carbon.user.core.tenant.TenantManager;
 import org.wso2.carbon.utils.DataPaginator;
 import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
+import org.apache.stratos.tenant.mgt.core.TenantPersistor;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -68,34 +68,17 @@ public class TenantMgtAdminService extends AbstractAdmin {
         }
         String tenantDomain = tenantInfoBean.getTenantDomain();
         TenantMgtUtil.validateDomain(tenantDomain);
-        UserRegistry userRegistry = (UserRegistry) getGovernanceRegistry();
-        if (userRegistry == null) {
-            log.error("Security Alert! User registry is null. A user is trying create a tenant "
-                      + " without an authenticated session.");
-            throw new Exception("Invalid data."); // obscure error message.
-        }
-
-        if (userRegistry.getTenantId() != MultitenantConstants.SUPER_TENANT_ID) {
-            log.error("Security Alert! Non super tenant trying to create a tenant.");
-            throw new Exception("Invalid data."); // obscure error message.
-        }
+        checkIsSuperTenantInvoking();
         Tenant tenant = TenantMgtUtil.initializeTenant(tenantInfoBean);
-        TenantPersistor persistor = TenantMgtServiceComponent.getTenantPersistor();
+        TenantPersistor persistor = new TenantPersistor();
         // not validating the domain ownership, since created by super tenant
         int tenantId = persistor.persistTenant(tenant, false, tenantInfoBean.getSuccessKey(),
-                                tenantInfoBean.getOriginatedService());
+                                tenantInfoBean.getOriginatedService(),false);
         tenantInfoBean.setTenantId(tenantId);
         
         TenantMgtUtil.addClaimsToUserStoreManager(tenant);
         
-        //Notify tenant addition
-        try {
-            TenantMgtUtil.triggerAddTenant(tenantInfoBean);
-        } catch (StratosException e) {
-            String msg = "Error in notifying tenant addition.";
-            log.error(msg, e);
-            throw new Exception(msg, e);
-        }
+        notifyTenantAddition(tenantInfoBean);
         //adding the subscription entry
         /*try {
             if (TenantMgtServiceComponent.getBillingService() != null) {
@@ -117,6 +100,69 @@ public class TenantMgtAdminService extends AbstractAdmin {
         return TenantMgtUtil.prepareStringToShowThemeMgtPage(tenant.getId());
     }
 
+
+
+    private void notifyTenantAddition(TenantInfoBean tenantInfoBean) throws Exception {
+        //Notify tenant addition
+        try {
+            TenantMgtUtil.triggerAddTenant(tenantInfoBean);
+        } catch (StratosException e) {
+            String msg = "Error in notifying tenant addition.";
+            log.error(msg, e);
+            throw new Exception(msg, e);
+        }
+    }
+
+    private void checkIsSuperTenantInvoking() throws Exception {
+        UserRegistry userRegistry = (UserRegistry) getGovernanceRegistry();
+        if (userRegistry == null) {
+            log.error("Security Alert! User registry is null. A user is trying create a tenant "
+                    + " without an authenticated session.");
+            throw new Exception("Invalid data."); // obscure error message.
+        }
+
+        if (userRegistry.getTenantId() != MultitenantConstants.SUPER_TENANT_ID) {
+            log.error("Security Alert! Non super tenant trying to create a tenant.");
+            throw new Exception("Invalid data."); // obscure error message.
+        }
+    }
+
+    /**
+     * Super admin add tenant.This method will be used whenever the user store is shared between two deployment.
+     * This method will persist tenant not in user store level but will do other post tenant creation actions.
+     *
+     * @param tenantInfoBean
+     * @return
+     * @throws Exception
+     */
+    public String addSkeletonTenant(TenantInfoBean tenantInfoBean) throws Exception {
+        int tenantId;
+        checkIsSuperTenantInvoking();
+        try {
+            tenantId=TenantMgtServiceComponent.getTenantManager().getTenantId(tenantInfoBean.getTenantDomain());
+        } catch (org.wso2.carbon.user.api.UserStoreException e) {
+            String msg = "Error in getting tenant id";
+            log.error(msg, e);
+            throw new Exception(msg, e);
+        }
+        if(tenantId<0){
+            String msg = "Tenant is not added in user store "+tenantInfoBean.getTenantDomain();
+            log.error(msg);
+            throw new Exception(msg);
+        }
+        Tenant tenant = TenantMgtUtil.initializeTenant(tenantInfoBean);
+        tenant.setId(tenantId);
+        TenantPersistor persistor = new TenantPersistor();
+        // not validating the domain ownership, since created by super tenant
+        persistor.persistTenant(tenant, false, tenantInfoBean.getSuccessKey(),
+                tenantInfoBean.getOriginatedService(), true);
+        tenantInfoBean.setTenantId(tenantId);
+        notifyTenantAddition(tenantInfoBean);
+        return TenantMgtUtil.prepareStringToShowThemeMgtPage(tenantId);
+    }
+
+
+
     /**
      * Get the list of the tenants
      *

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/cd87dbcc/components/org.apache.stratos.tenant.mgt/src/main/java/org/apache/stratos/tenant/mgt/services/TenantSelfRegistrationService.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt/src/main/java/org/apache/stratos/tenant/mgt/services/TenantSelfRegistrationService.java b/components/org.apache.stratos.tenant.mgt/src/main/java/org/apache/stratos/tenant/mgt/services/TenantSelfRegistrationService.java
index abdd203..5b791db 100644
--- a/components/org.apache.stratos.tenant.mgt/src/main/java/org/apache/stratos/tenant/mgt/services/TenantSelfRegistrationService.java
+++ b/components/org.apache.stratos.tenant.mgt/src/main/java/org/apache/stratos/tenant/mgt/services/TenantSelfRegistrationService.java
@@ -21,7 +21,6 @@ package org.apache.stratos.tenant.mgt.services;
 import org.wso2.carbon.captcha.mgt.beans.CaptchaInfoBean;
 import org.wso2.carbon.captcha.mgt.constants.CaptchaMgtConstants;
 import org.wso2.carbon.captcha.mgt.util.CaptchaUtil;
-import org.wso2.carbon.core.multitenancy.persistence.TenantPersistor;
 import org.apache.stratos.common.beans.TenantInfoBean;
 import org.apache.stratos.common.exception.StratosException;
 import org.apache.stratos.common.util.CommonUtil;
@@ -30,6 +29,7 @@ import org.apache.stratos.tenant.mgt.util.TenantMgtUtil;
 import org.wso2.carbon.user.core.tenant.Tenant;
 import org.wso2.carbon.user.core.tenant.TenantManager;
 import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
+import org.apache.stratos.tenant.mgt.core.TenantPersistor;
 
 import org.apache.axis2.AxisFault;
 import org.apache.commons.logging.Log;
@@ -101,9 +101,9 @@ public class TenantSelfRegistrationService {
         }
         // persists the tenant.
         Tenant tenant = TenantMgtUtil.initializeTenant(tenantInfoBean);
-        TenantPersistor persistor = TenantMgtServiceComponent.getTenantPersistor();
+        TenantPersistor persistor = new TenantPersistor();
         int tenantId = persistor.persistTenant(tenant, true, tenantInfoBean.getSuccessKey(), 
-                tenantInfoBean.getOriginatedService());
+                tenantInfoBean.getOriginatedService(),false);
         tenantInfoBean.setTenantId(tenantId);
         TenantMgtUtil.addClaimsToUserStoreManager(tenant);
         

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/cd87dbcc/components/org.apache.stratos.tenant.mgt/src/main/java/org/apache/stratos/tenant/mgt/util/TenantMgtUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt/src/main/java/org/apache/stratos/tenant/mgt/util/TenantMgtUtil.java b/components/org.apache.stratos.tenant.mgt/src/main/java/org/apache/stratos/tenant/mgt/util/TenantMgtUtil.java
index ec3edd0..ddca5a1 100644
--- a/components/org.apache.stratos.tenant.mgt/src/main/java/org/apache/stratos/tenant/mgt/util/TenantMgtUtil.java
+++ b/components/org.apache.stratos.tenant.mgt/src/main/java/org/apache/stratos/tenant/mgt/util/TenantMgtUtil.java
@@ -237,6 +237,10 @@ public class TenantMgtUtil {
         tenant.setEmail(tenantInfoBean.getEmail());
         tenant.setAdminName(tenantInfoBean.getAdmin());
 
+        // set tenantId given in tenantInfoBean, if it is set,
+        // underline tenant manager will try to create the tenant with given tenant Id.
+        tenant.setId(tenantInfoBean.getTenantId());
+
         // we are duplicating the params stored in the claims here as well; they
         // are in Tenant class
         // to make it work with LDAP; but they do not make it to the databases.

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/cd87dbcc/components/org.apache.stratos.tenant.mgt/src/main/resources/META-INF/services.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt/src/main/resources/META-INF/services.xml b/components/org.apache.stratos.tenant.mgt/src/main/resources/META-INF/services.xml
index 9e7ded2..512f002 100644
--- a/components/org.apache.stratos.tenant.mgt/src/main/resources/META-INF/services.xml
+++ b/components/org.apache.stratos.tenant.mgt/src/main/resources/META-INF/services.xml
@@ -47,6 +47,10 @@
             <parameter name="superTenantService" locked="true">true</parameter>
             <parameter name="AuthorizationAction" locked="true">/permission/protected/manage/monitor/tenants</parameter>
         </operation>
+        <operation name="addSkeletonTenant">
+            <parameter name="superTenantService" locked="true">true</parameter>
+            <parameter name="AuthorizationAction" locked="true">/permission/protected/manage/monitor/tenants</parameter>
+        </operation>
         <operation name="retrieveTenants">
             <parameter name="superTenantService" locked="true">true</parameter>
             <parameter name="AuthorizationAction" locked="true">/permission/protected/manage/monitor/tenants</parameter>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/cd87dbcc/features/adc/org.apache.stratos.adc.mgt.server.feature/src/main/resources/p2.inf
----------------------------------------------------------------------
diff --git a/features/adc/org.apache.stratos.adc.mgt.server.feature/src/main/resources/p2.inf b/features/adc/org.apache.stratos.adc.mgt.server.feature/src/main/resources/p2.inf
index 0660c79..d654766 100644
--- a/features/adc/org.apache.stratos.adc.mgt.server.feature/src/main/resources/p2.inf
+++ b/features/adc/org.apache.stratos.adc.mgt.server.feature/src/main/resources/p2.inf
@@ -16,7 +16,7 @@
 # under the License.
 
 instructions.configure = \
-org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/features/org.apache.stratos.adc.mgt.server_${feature.version}/conf/cartridge-config.properties,target:${installFolder}/../conf/cartridge-config.properties,overwrite:true);\
-org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/features/org.apache.stratos.adc.mgt.server_${feature.version}/conf/policies.xml,target:${installFolder}/../conf/policies.xml,overwrite:true);\
-org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/features/org.apache.stratos.adc.mgt.server_${feature.version}/conf/etc/policies.xsd,target:${installFolder}/../conf/etc/policies.xsd,overwrite:true);\
+org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.apache.stratos.adc.mgt.server_${feature.version}/conf/cartridge-config.properties,target:${installFolder}/../../conf/cartridge-config.properties,overwrite:true);\
+org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.apache.stratos.adc.mgt.server_${feature.version}/conf/policies.xml,target:${installFolder}/../../conf/policies.xml,overwrite:true);\
+org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.apache.stratos.adc.mgt.server_${feature.version}/conf/etc/policies.xsd,target:${installFolder}/../../conf/etc/policies.xsd,overwrite:true);\
 

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/cd87dbcc/features/manager/common/org.apache.stratos.common.server.feature/src/main/resources/p2.inf
----------------------------------------------------------------------
diff --git a/features/manager/common/org.apache.stratos.common.server.feature/src/main/resources/p2.inf b/features/manager/common/org.apache.stratos.common.server.feature/src/main/resources/p2.inf
index 3f6f4f6..c5f8223 100644
--- a/features/manager/common/org.apache.stratos.common.server.feature/src/main/resources/p2.inf
+++ b/features/manager/common/org.apache.stratos.common.server.feature/src/main/resources/p2.inf
@@ -16,12 +16,12 @@
 # under the License.
 
 instructions.configure = \
-org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/features/org.apache.stratos.common.server_${feature.version}/conf/cloud-services-desc.xml,target:${installFolder}/../conf/multitenancy/cloud-services-desc.xml,overwrite:true);\
-org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/features/org.apache.stratos.common.server_${feature.version}/conf/stratos.xml,target:${installFolder}/../conf/multitenancy/stratos.xml,overwrite:true);\
-org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/features/org.apache.stratos.common.server_${feature.version}/conf/identity.xml,target:${installFolder}/../conf/identity.xml,overwrite:true);\
-org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/features/org.apache.stratos.common.server_${feature.version}/conf/tenant-mgt.xml,target:${installFolder}/../conf/multitenancy/tenant-mgt.xml,overwrite:true);\
-org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/features/org.apache.stratos.common.server_${feature.version}/conf/multitenancy-packages.xml,target:${installFolder}/../conf/multitenancy/multitenancy-packages.xml,overwrite:true);\
-org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/features/org.apache.stratos.common.server_${feature.version}/conf/usage-throttling-agent-config.xml,target:${installFolder}/../conf/multitenancy/usage-throttling-agent-config.xml,overwrite:true);\
-org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/features/org.apache.stratos.common.server_${feature.version}/conf/eula.xml,target:${installFolder}/../conf/multitenancy/eula.xml,overwrite:true);\
-org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/features/org.apache.stratos.common.server_${feature.version}/conf);
+org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.apache.stratos.common.server_${feature.version}/conf/cloud-services-desc.xml,target:${installFolder}/../../conf/multitenancy/cloud-services-desc.xml,overwrite:true);\
+org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.apache.stratos.common.server_${feature.version}/conf/stratos.xml,target:${installFolder}/../../conf/multitenancy/stratos.xml,overwrite:true);\
+org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.apache.stratos.common.server_${feature.version}/conf/identity.xml,target:${installFolder}/../../conf/identity.xml,overwrite:true);\
+org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.apache.stratos.common.server_${feature.version}/conf/tenant-mgt.xml,target:${installFolder}/../../conf/multitenancy/tenant-mgt.xml,overwrite:true);\
+org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.apache.stratos.common.server_${feature.version}/conf/multitenancy-packages.xml,target:${installFolder}/../../conf/multitenancy/multitenancy-packages.xml,overwrite:true);\
+org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.apache.stratos.common.server_${feature.version}/conf/usage-throttling-agent-config.xml,target:${installFolder}/../../conf/multitenancy/usage-throttling-agent-config.xml,overwrite:true);\
+org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.apache.stratos.common.server_${feature.version}/conf/eula.xml,target:${installFolder}/../../conf/multitenancy/eula.xml,overwrite:true);\
+org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../features/org.apache.stratos.common.server_${feature.version}/conf);
 

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/cd87dbcc/features/manager/logging-mgt/org.apache.stratos.logging.mgt.feature/pom.xml
----------------------------------------------------------------------
diff --git a/features/manager/logging-mgt/org.apache.stratos.logging.mgt.feature/pom.xml b/features/manager/logging-mgt/org.apache.stratos.logging.mgt.feature/pom.xml
index 1dd3b52..45fd8f1 100644
--- a/features/manager/logging-mgt/org.apache.stratos.logging.mgt.feature/pom.xml
+++ b/features/manager/logging-mgt/org.apache.stratos.logging.mgt.feature/pom.xml
@@ -96,7 +96,7 @@
                                 <importFeatureDef>org.wso2.carbon.core.ui:${wso2carbon.version}</importFeatureDef>
                             </importFeatures>
                             <includedFeatures>
-                                <includedFeatureDef>org.wso2.carbon:org.wso2.carbon.logging.mgt.server.feature:${carbon.platform.patch.version.4.1.1}</includedFeatureDef>
+                                <includedFeatureDef>org.wso2.carbon:org.wso2.carbon.logging.mgt.server.feature:4.2.1</includedFeatureDef>
 			    </includedFeatures>
                         </configuration>
                     </execution>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/cd87dbcc/features/manager/rest-endpoint/org.apache.stratos.rest.endpoint.feature/src/main/resources/p2.inf
----------------------------------------------------------------------
diff --git a/features/manager/rest-endpoint/org.apache.stratos.rest.endpoint.feature/src/main/resources/p2.inf b/features/manager/rest-endpoint/org.apache.stratos.rest.endpoint.feature/src/main/resources/p2.inf
index 9bbe4d9..fc828ae 100644
--- a/features/manager/rest-endpoint/org.apache.stratos.rest.endpoint.feature/src/main/resources/p2.inf
+++ b/features/manager/rest-endpoint/org.apache.stratos.rest.endpoint.feature/src/main/resources/p2.inf
@@ -1,6 +1,6 @@
 instructions.configure = \
-org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/features/org.apache.stratos.rest.endpoint_${feature.version}/cxf,target:${installFolder}/../../lib/runtimes/cxf,overwrite:true);\
-org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/features/org.apache.stratos.rest.endpoint_${feature.version}/web-app/stratos.war,target:${installFolder}/../deployment/server/webapps/stratos.war,overwrite:true);\
-org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/features/org.apache.stratos.rest.endpoint_${feature.version}/tomcat/webapp-classloading.xml,target:${installFolder}/../conf/tomcat/webapp-classloading.xml,overwrite:true);\
-org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/features/org.apache.stratos.rest.endpoint_${feature.version}/tomcat/webapp-classloading-environments.xml,target:${installFolder}/../conf/tomcat/webapp-classloading-environments.xml,overwrite:true);\
-org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/features/org.apache.stratos.rest.endpoint_${feature.version}/tomcat/context.xml,target:${installFolder}/../conf/tomcat/context.xml,overwrite:true);\
+org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.apache.stratos.rest.endpoint_${feature.version}/cxf,target:${installFolder}/../../../lib/runtimes/cxf,overwrite:true);\
+org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.apache.stratos.rest.endpoint_${feature.version}/web-app/stratos.war,target:${installFolder}/../../deployment/server/webapps/stratos.war,overwrite:true);\
+org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.apache.stratos.rest.endpoint_${feature.version}/tomcat/webapp-classloading.xml,target:${installFolder}/../../conf/tomcat/webapp-classloading.xml,overwrite:true);\
+org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.apache.stratos.rest.endpoint_${feature.version}/tomcat/webapp-classloading-environments.xml,target:${installFolder}/../../conf/tomcat/webapp-classloading-environments.xml,overwrite:true);\
+org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.apache.stratos.rest.endpoint_${feature.version}/tomcat/context.xml,target:${installFolder}/../../conf/tomcat/context.xml,overwrite:true);\

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/cd87dbcc/products/cloud-controller/modules/p2-profile/pom.xml
----------------------------------------------------------------------
diff --git a/products/cloud-controller/modules/p2-profile/pom.xml b/products/cloud-controller/modules/p2-profile/pom.xml
index 08dbd74..64695b7 100644
--- a/products/cloud-controller/modules/p2-profile/pom.xml
+++ b/products/cloud-controller/modules/p2-profile/pom.xml
@@ -164,9 +164,9 @@
                                     org.wso2.carbon:org.wso2.carbon.task.server.feature:${carbon.version}
                                 </featureArtifactDef>
 
-                                <featureArtifactDef>
+                                <!--                                <featureArtifactDef>
                                     org.wso2.carbon:org.wso2.carbon.mediation.initializer.feature:${carbon.version}
-                                </featureArtifactDef>
+                                </featureArtifactDef> -->
 
                                <featureArtifactDef>
                                     org.wso2.carbon:org.wso2.carbon.logging.mgt.feature:${carbon.version}
@@ -176,13 +176,13 @@
                                     org.wso2.carbon:org.wso2.carbon.endpoint.server.feature:${carbon.version}
                                 </featureArtifactDef>
 
-                                <featureArtifactDef>
+                                <!--                                <featureArtifactDef>
                                     org.wso2.carbon:org.wso2.carbon.sequences.server.feature:${carbon.version}
-                                </featureArtifactDef>
+                                </featureArtifactDef> -->
 
-                                <featureArtifactDef>
+<!--                                <featureArtifactDef>
                                     org.wso2.carbon:org.wso2.carbon.mediators.server.feature:${carbon.version}
-                                </featureArtifactDef>
+                                </featureArtifactDef> -->
 
                                 <featureArtifactDef>
                                     org.wso2.carbon:org.wso2.carbon.relay.server.feature:${carbon.version}
@@ -263,10 +263,10 @@
                                     <id>org.wso2.carbon.datasource.server.feature.group</id>
                                     <version>${carbon.version}</version>
                                 </feature>
-                                <feature>
+                                <!--                                <feature>
                                     <id>org.wso2.carbon.mediation.initializer.feature.group</id>
                                     <version>${carbon.version}</version>
-                                </feature>
+                                </feature> -->
                                 <feature>
                                     <id>org.wso2.carbon.service.mgt.server.feature.group</id>
                                     <version>${carbon.version}</version>
@@ -283,14 +283,14 @@
                                     <id>org.wso2.carbon.endpoint.server.feature.group</id>
                                     <version>${carbon.version}</version>
                                 </feature>
-                                <feature>
+                                <!--                                <feature>
                                     <id>org.wso2.carbon.sequences.server.feature.group</id>
                                     <version>${carbon.version}</version>
-                                </feature>
-                                <feature>
+                                </feature> -->
+<!--                                <feature>
                                     <id>org.wso2.carbon.mediators.server.feature.group</id>
                                     <version>${carbon.version}</version>
-                                </feature>
+                                </feature> -->
                                 <feature>
                                     <id>org.wso2.carbon.relay.server.feature.group</id>
                                     <version>${carbon.version}</version>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/cd87dbcc/products/load-balancer/modules/distribution/src/main/assembly/bin.xml
----------------------------------------------------------------------
diff --git a/products/load-balancer/modules/distribution/src/main/assembly/bin.xml b/products/load-balancer/modules/distribution/src/main/assembly/bin.xml
index 5b80b0c..0940d0d 100755
--- a/products/load-balancer/modules/distribution/src/main/assembly/bin.xml
+++ b/products/load-balancer/modules/distribution/src/main/assembly/bin.xml
@@ -58,7 +58,7 @@
                 <exclude>**/axis2/tenant-axis2.xml</exclude>
                 <exclude>**/authenticators.xml</exclude>
                 <exclude>**/embedded-ldap.xml</exclude>
-                <exclude>**/user-mgt.xml</exclude>
+                <!--<exclude>**/user-mgt.xml</exclude> -->
                 <exclude>**/*.aar</exclude>
                 <exclude>**/webapp-mode/**</exclude>
                 <exclude>**/repository/components/**</exclude>
@@ -193,11 +193,11 @@
             <source>../p2-profile/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/etc/coordination-client-config.xml</source>
             <outputDirectory>apache-stratos-load-balancer-${pom.version}/repository/conf/etc</outputDirectory>
         </file-->
-        <file>
+        <!--<file>
             <source>src/main/conf/user-mgt.xml</source>
             <outputDirectory>apache-stratos-load-balancer-${pom.version}/repository/conf</outputDirectory>
             <destName>user-mgt.xml</destName>
-        </file>
+        </file> -->
         <file>
             <source>src/main/conf/embedded-ldap.xml</source>
             <outputDirectory>apache-stratos-load-balancer-${pom.version}/repository/conf</outputDirectory>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/cd87dbcc/products/stratos-controller/modules/dashboard/src/main/java/org/apache/stratos/manager/dashboard/ui/clients/CloudManagerServiceClient.java
----------------------------------------------------------------------
diff --git a/products/stratos-controller/modules/dashboard/src/main/java/org/apache/stratos/manager/dashboard/ui/clients/CloudManagerServiceClient.java b/products/stratos-controller/modules/dashboard/src/main/java/org/apache/stratos/manager/dashboard/ui/clients/CloudManagerServiceClient.java
index 5359afa..cdd9b16 100644
--- a/products/stratos-controller/modules/dashboard/src/main/java/org/apache/stratos/manager/dashboard/ui/clients/CloudManagerServiceClient.java
+++ b/products/stratos-controller/modules/dashboard/src/main/java/org/apache/stratos/manager/dashboard/ui/clients/CloudManagerServiceClient.java
@@ -89,7 +89,7 @@ public class CloudManagerServiceClient {
     }
 
     public CloudService[] retrieveCloudServiceInfo() throws Exception {
-        try {
+        /*try {
             if (CarbonContext.getCurrentContext().getCache(null).containsKey(CLOUD_SERVICE)) {
                 return (CloudService[]) CarbonContext.getCurrentContext()
                         .getCache(null).get(CLOUD_SERVICE);
@@ -100,12 +100,13 @@ public class CloudManagerServiceClient {
         }
         CloudService[] cloudServices = stub.retrieveCloudServiceInfo();
         CarbonContext.getCurrentContext().getCache(null).put(CLOUD_SERVICE, cloudServices);
-        return cloudServices;
+        return cloudServices;*/
+    	return null;
     }
 
 
     public void saveCloudServicesActivity(String[] activeServiceNames) throws Exception {
-        CloudService[] cloudServices =
+       /* CloudService[] cloudServices =
                 (CloudService[]) CarbonContext.getCurrentContext().getCache(null).get(CLOUD_SERVICE);
 
         for (CloudService cloudService : cloudServices) {
@@ -119,6 +120,6 @@ public class CloudManagerServiceClient {
             }
         }
 
-        stub.saveCloudServicesActivity(activeServiceNames);
+        stub.saveCloudServicesActivity(activeServiceNames);*/
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/cd87dbcc/products/stratos-controller/modules/distribution/src/assembly/bin.xml
----------------------------------------------------------------------
diff --git a/products/stratos-controller/modules/distribution/src/assembly/bin.xml b/products/stratos-controller/modules/distribution/src/assembly/bin.xml
index 6e590b9..60aff65 100755
--- a/products/stratos-controller/modules/distribution/src/assembly/bin.xml
+++ b/products/stratos-controller/modules/distribution/src/assembly/bin.xml
@@ -610,10 +610,10 @@
         </file-->
 
 	<!-- Including coordination-client-config.xml file -->
-        <file>
+    <!--<file>
             <source>../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/etc/coordination-client-config.xml</source>
             <outputDirectory>${pom.artifactId}-${pom.version}/repository/conf/etc</outputDirectory>
-        </file>
+        </file> -->
 	<!-- Ntask config file -->
 	<file>
             <source>../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/etc/tasks-config.xml</source>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/cd87dbcc/products/stratos-controller/modules/p2-profile-gen/pom.xml
----------------------------------------------------------------------
diff --git a/products/stratos-controller/modules/p2-profile-gen/pom.xml b/products/stratos-controller/modules/p2-profile-gen/pom.xml
index 915e130..14ddce2 100644
--- a/products/stratos-controller/modules/p2-profile-gen/pom.xml
+++ b/products/stratos-controller/modules/p2-profile-gen/pom.xml
@@ -84,7 +84,7 @@
             <plugin>
                 <groupId>org.wso2.maven</groupId>
                 <artifactId>carbon-p2-plugin</artifactId>
-                <version>${carbon.p2.plugin.version}</version>
+                <version>1.5.3</version>
                 <executions>
                     <execution>
                         <id>2-p2-repo-generation</id>
@@ -102,7 +102,7 @@
 				<!--**************************************************Manager features start*********************************************-->
 				    <featureArtifactDef>org.wso2.carbon:org.wso2.carbon.databridge.datapublisher.feature:${carbon.version}</featureArtifactDef>
 				    <featureArtifactDef>org.wso2.carbon:org.wso2.carbon.ntask.feature:${carbon.version}</featureArtifactDef>
-				    <featureArtifactDef>org.wso2.carbon:org.wso2.carbon.coordination.core.feature:${carbon.version}</featureArtifactDef>
+                    <!--				    <featureArtifactDef>org.wso2.carbon:org.wso2.carbon.coordination.core.feature:${carbon.version}</featureArtifactDef> -->
 				    <!-- registry related features-->
 				    <featureArtifactDef>org.wso2.carbon:org.wso2.carbon.registry.core.feature:${carbon.version}</featureArtifactDef>
 				    <featureArtifactDef>org.wso2.carbon:org.wso2.carbon.registry.resource.properties.feature:${carbon.version}</featureArtifactDef>
@@ -125,9 +125,12 @@
 				    <!--featureArtifactDef>
 					org.apache.stratos:org.apache.stratos.throttling.manager.feature:${project.version}
 				    </featureArtifactDef-->
-				    <featureArtifactDef>
+<!--				    <featureArtifactDef>
 					org.apache.stratos:org.apache.stratos.throttling.agent.feature:${project.version}
-				    </featureArtifactDef>
+                    </featureArtifactDef> -->
+                    <featureArtifactDef>
+                          org.wso2.carbon:org.wso2.carbon.throttle.server.feature:${carbon.version}
+                    </featureArtifactDef>
 				    <!--featureArtifactDef>
 					org.wso2.carbon:org.wso2.carbon.billing.server.feature:2.1.3
 				    </featureArtifactDef-->
@@ -147,15 +150,15 @@
 				    <featureArtifactDef>
 					org.wso2.carbon:org.wso2.carbon.webapp.mgt.server.feature:${carbon.version}
 				    </featureArtifactDef>
-				    <featureArtifactDef>org.wso2.carbon:org.wso2.carbon.admin.mgt.server.feature:${carbon.version}</featureArtifactDef>
-				    <featureArtifactDef>org.wso2.carbon:org.wso2.carbon.admin.mgt.ui.feature:${carbon.version}</featureArtifactDef>
+                    <!--				    <featureArtifactDef>org.wso2.carbon:org.wso2.carbon.admin.mgt.server.feature:${carbon.version}</featureArtifactDef> -->
+                    <!--				    <featureArtifactDef>org.wso2.carbon:org.wso2.carbon.admin.mgt.ui.feature:${carbon.version}</featureArtifactDef> -->
 				    <featureArtifactDef>org.wso2.carbon:org.wso2.carbon.captcha.mgt.server.feature:${carbon.version}</featureArtifactDef>
 				    <!-- start BAM feature -->
 				    <featureArtifactDef>org.wso2.carbon:org.apache.synapse.wso2.feature:2.1.1-wso2v4</featureArtifactDef>
 				    <featureArtifactDef>org.wso2.carbon:org.wso2.carbon.task.server.feature:${carbon.version}</featureArtifactDef>
 				    <featureArtifactDef>org.wso2.carbon:org.wso2.carbon.datasource.server.feature:${carbon.version}</featureArtifactDef>
 				    <featureArtifactDef>org.wso2.carbon:org.wso2.carbon.transaction.manager.feature:${carbon.version}</featureArtifactDef>
-				    <featureArtifactDef>org.wso2.carbon:org.wso2.carbon.service.mgt.server.feature:${carbon.version}</featureArtifactDef>
+				    <featureArtifactDef>org.wso2.carbon:org.wso2.carbon.service.mgt.server.feature:4.2.1</featureArtifactDef>
 				    <featureArtifactDef>org.wso2.carbon:org.wso2.carbon.transport.mgt.server.feature:${carbon.version}</featureArtifactDef>
 				    <featureArtifactDef>org.wso2.carbon:org.wso2.carbon.event.common.feature:${carbon.version}</featureArtifactDef>
 				    <featureArtifactDef>org.wso2.carbon:org.wso2.carbon.event.server.feature:${carbon.version}</featureArtifactDef>
@@ -177,16 +180,16 @@
 					org.wso2.carbon:org.wso2.carbon.identity.sso.saml.feature:${carbon.version}
 				    </featureArtifactDef>
 				    <featureArtifactDef>
-					org.wso2.carbon:org.wso2.stratos.identity.saml2.sso.mgt.feature:${stratos.component.version}
+					org.wso2.carbon:org.wso2.stratos.identity.saml2.sso.mgt.feature:2.2.0
 				    </featureArtifactDef>
 
 				    <featureArtifactDef>
 					org.wso2.carbon:org.wso2.carbon.registry.ui.menu.feature:${carbon.version}
 				    </featureArtifactDef>
 				    <featureArtifactDef>org.wso2.carbon:org.wso2.carbon.module.mgt.server.feature:${carbon.version}</featureArtifactDef>
-				    <featureArtifactDef>org.wso2.carbon:org.wso2.carbon.throttle.feature:${carbon.version}</featureArtifactDef>
+                    <!--				    <featureArtifactDef>org.wso2.carbon:org.wso2.carbon.throttle.feature:${carbon.version}</featureArtifactDef> -->
 				    <featureArtifactDef>org.wso2.carbon:org.wso2.carbon.caching.feature:${carbon.version}</featureArtifactDef>
-				    <featureArtifactDef>org.wso2.carbon:org.wso2.carbon.rm.server.feature:4.0.0</featureArtifactDef>
+				    <featureArtifactDef>org.wso2.carbon:org.wso2.carbon.rm.server.feature:4.2.0</featureArtifactDef>
 				    <featureArtifactDef>org.apache.stratos:org.apache.stratos.adc.mgt.feature:${project.version}</featureArtifactDef>
 				<featureArtifactDef>
                                     org.apache.stratos:org.apache.stratos.cartridge.mgt.ui.feature:${project.version}
@@ -200,6 +203,7 @@
                                 <featureArtifactDef>
                                     org.wso2.carbon:org.wso2.carbon.identity.authenticator.saml2.sso.ui.feature:${wso2carbon.version}
                                 </featureArtifactDef>
+                     <featureArtifactDef>org.wso2.carbon:org.wso2.carbon.identity.application.authentication.framework.server.feature:4.2.1</featureArtifactDef>
 				<!--**************************************************Manager features end*********************************************-->
 
 				
@@ -216,7 +220,7 @@
 			    <goal>p2-profile-gen</goal>
 			</goals>
 			<configuration>
-			    <profile>WSO2CarbonProfile</profile>
+			    <profile>default</profile>
 			    <p2AgentLocation>${basedir}/target/p2-agent</p2AgentLocation>
 			    <metadataRepository>file:${basedir}/target/p2-repo</metadataRepository>
 			    <artifactRepository>file:${basedir}/target/p2-repo</artifactRepository>
@@ -234,7 +238,7 @@
 				</feature>
 				<feature>
 				    <id>org.wso2.stratos.identity.saml2.sso.mgt.feature.group</id>
-				    <version>${stratos.component.version}</version>
+				    <version>2.2.0</version>
 				</feature>
 				<feature>
                                     <id>org.apache.stratos.logging.mgt.feature.group</id>
@@ -264,10 +268,10 @@
 				    <id>org.wso2.carbon.ntask.feature.group</id>
 				    <version>${carbon.version}</version>
 				</feature>
-				<feature>
+                <!--				<feature>
 				    <id>org.wso2.carbon.coordination.core.feature.group</id>
 				    <version>${carbon.version}</version>
-				</feature>
+                </feature>-->
 
 				<feature>
 				    <id>org.apache.stratos.feature.group</id>
@@ -282,10 +286,10 @@
 				    <id>org.apache.synapse.wso2.feature.group</id>
 				    <version>2.1.1-wso2v4</version>
 				</feature>
-				<feature>
+                <!--				<feature>
 				    <id>org.wso2.carbon.task.server.feature.group</id>
 				    <version>${carbon.version}</version>
-				</feature>
+                </feature> -->
 				<feature>
 				    <id>org.wso2.carbon.transaction.manager.feature.group</id>
 				    <version>${carbon.version}</version>
@@ -302,14 +306,14 @@
 				    <id>org.wso2.carbon.event.common.feature.group</id>
 				    <version>${carbon.version}</version>
 				</feature>
-				<feature>
+                <!--				<feature>
 				    <id>org.wso2.carbon.admin.mgt.server.feature.group</id>
 				    <version>${carbon.version}</version>
-				</feature>
-				<feature>
+                </feature> -->
+    			<!--            	<feature>
 				    <id>org.wso2.carbon.admin.mgt.ui.feature.group</id>
 				    <version>${carbon.version}</version>
-				</feature>
+                </feature> -->
 				<feature>
 				    <id>org.wso2.carbon.captcha.mgt.server.feature.group</id>
 				    <version>${carbon.version}</version>
@@ -344,10 +348,10 @@
 				    <id>org.apache.stratos.throttling.manager.feature.group</id>
 				    <version>${project.version}</version>
 				</feature-->
-				<feature>
+<!--				<feature>
 				    <id>org.apache.stratos.throttling.agent.feature.group</id>
-				    <version>${project.version}</version>
-				</feature>
+                    <version>${project.version}</version>
+                </feature>-->
 				<!--feature>
 				    <id>org.wso2.carbon.billing.server.feature.group</id>
 				    <version>2.1.3</version>