You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ud...@apache.org on 2014/12/22 10:08:18 UTC

[1/4] stratos git commit: making oauth app name random

Repository: stratos
Updated Branches:
  refs/heads/master 7fa3c1701 -> bf721e83b


making oauth app name random


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

Branch: refs/heads/master
Commit: bf721e83b0794eb530db31722d636a7c384090a2
Parents: 74de671
Author: Udara Liyanage <ud...@wso2.com>
Authored: Mon Dec 22 14:37:11 2014 +0530
Committer: Udara Liyanage <ud...@wso2.com>
Committed: Mon Dec 22 14:37:54 2014 +0530

----------------------------------------------------------------------
 .../autoscaler/api/AutoScalerServiceImpl.java   | 16 ++++++
 .../parser/DefaultApplicationParser.java        | 54 ++++++++++----------
 .../applications/pojo/ApplicationContext.java   |  1 +
 ...ntityApplicationManagementServiceClient.java |  6 +++
 .../client/oAuthAdminServiceClient.java         |  7 +++
 .../controller/domain/InstanceMetadata.java     |  1 -
 6 files changed, 57 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/bf721e83/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/api/AutoScalerServiceImpl.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/api/AutoScalerServiceImpl.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/api/AutoScalerServiceImpl.java
index 1886073..4b2aaea 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/api/AutoScalerServiceImpl.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/api/AutoScalerServiceImpl.java
@@ -296,6 +296,22 @@ public class AutoScalerServiceImpl implements AutoScalerServiceInterface {
     @Override
     public void deleteApplication(String applicationId) {
         AutoscalerContext.getInstance().removeApplicationContext(applicationId);
+        //TODO oAuth application/service provider deletion is removed since app name is random. It should be equal to
+        // name of the composite application.
+        /*
+        try {
+            oAuthAdminServiceClient.getServiceClient().removeOauthApplication(applicationId);
+            IdentityApplicationManagementServiceClient.getServiceClient().removeApplication(applicationId);
+        } catch (RemoteException e) {
+           log.error(String.format("Error ocured while deleting oAuth application %s", applicationId), e);
+            throw new AutoScalerException(e);
+        } catch (OAuthAdminServiceException e) {
+            log.error(String.format("Error ocured while deleting oAuth application %s", applicationId), e);
+            throw new AutoScalerException(e);
+        } catch (IdentityApplicationManagementServiceIdentityApplicationManagementException e) {
+            e.printStackTrace();
+        }
+        */
         if(log.isInfoEnabled()) {
             log.info(String.format("Application deleted successfully: [application-id] ",
                     applicationId));

http://git-wip-us.apache.org/repos/asf/stratos/blob/bf721e83/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/parser/DefaultApplicationParser.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/parser/DefaultApplicationParser.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/parser/DefaultApplicationParser.java
index e3ae175..f377743 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/parser/DefaultApplicationParser.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/parser/DefaultApplicationParser.java
@@ -115,7 +115,7 @@ public class DefaultApplicationParser implements ApplicationParser {
         return applicationClusterContexts;
     }
 
-   
+
 	private Map<String, SubscribableInfoContext> getSubscribableInfo(GroupContext[] groupContexts) throws
     		ApplicationDefinitionException {
 		if(groupContexts != null) {
@@ -125,19 +125,19 @@ public class DefaultApplicationParser implements ApplicationParser {
 			} else {
 				CartridgeContext[] cartridgeContexts = groupContext.getCartridgeContexts();
 				for (CartridgeContext cartridgeContext : cartridgeContexts) {
-					
+
 					 if (StringUtils.isEmpty(cartridgeContext.getSubscribableInfoContext().getAlias()) ||
 		                        !ApplicationUtils.isAliasValid(cartridgeContext.getSubscribableInfoContext().getAlias())) {
-		                    handleError("Invalid alias specified for Subscribable Information Obj: [ " + 
+		                    handleError("Invalid alias specified for Subscribable Information Obj: [ " +
 		                        cartridgeContext.getSubscribableInfoContext().getAlias() + " ]");
 		                }
-	                
+
 					// check if a group is already defined under the same alias
 	                if(subscribableInformation.get(cartridgeContext.getSubscribableInfoContext().getAlias()) != null) {
 	                    // a group with same alias already exists, can't continue
 	                    handleError("A Subscribable Info obj with alias " + cartridgeContext.getSubscribableInfoContext().getAlias() + " already exists");
 	                }
-					subscribableInformation.put(cartridgeContext.getSubscribableInfoContext().getAlias(), 
+					subscribableInformation.put(cartridgeContext.getSubscribableInfoContext().getAlias(),
 							cartridgeContext.getSubscribableInfoContext());
 					if (log.isDebugEnabled()) {
 	                    log.debug("Added Subcribables Info obj [ " +
@@ -149,7 +149,7 @@ public class DefaultApplicationParser implements ApplicationParser {
 		}
 		return subscribableInformation;
 	}
-    
+
     /**
      * Extract Subscription Information from the Application Definition
      *
@@ -190,9 +190,9 @@ public class DefaultApplicationParser implements ApplicationParser {
 
         if (appCtxt.getComponents() != null) {
             // get top level Subscribables
-            if (appCtxt.getComponents().getCartridgeContexts() != null) {                
+            if (appCtxt.getComponents().getCartridgeContexts() != null) {
                 clusterDataMap = parseLeafLevelSubscriptions(appCtxt.getApplicationId(), appCtxt.getTenantId(),
-                        application.getKey(), null, Arrays.asList(appCtxt.getComponents().getCartridgeContexts()));                
+                        application.getKey(), null, Arrays.asList(appCtxt.getComponents().getCartridgeContexts()));
                 application.setClusterData(clusterDataMap);
             }
 
@@ -284,38 +284,38 @@ public class DefaultApplicationParser implements ApplicationParser {
         return application;
     }
 
-    
+
     /**
-     * 
+     *
      * Parse Subscription Information
-     * 
+     *
      * @param appId Application id
      * @param tenantId Tenant id of tenant which deployed the Application
      * @param key Generated key for the Application
      * @param groupName Group name (if relevant)
      * @param cartridgeContextList cartridgeContextList
      * @return Map [subscription alias -> ClusterDataHolder]
-     * 
+     *
      * @throws ApplicationDefinitionException
      */
     private Map<String, ClusterDataHolder> parseLeafLevelSubscriptions(
     		String appId, int tenantId, String key, String groupName,
             List<CartridgeContext> cartridgeContextList) throws ApplicationDefinitionException {
-    	
+
     	 Map<String, ClusterDataHolder> clusterDataMap = new HashMap<String, ClusterDataHolder>();
 
     	 for (CartridgeContext cartridgeContext : cartridgeContextList) {
-	        
+
     		 String cartridgeType = cartridgeContext.getType();
     		 String subscriptionAlias = cartridgeContext.getSubscribableInfoContext().getAlias();
-    		 
+
     		 // check if a cartridgeInfo with relevant type is already deployed. else, can't continue
              CartridgeInfo cartridgeInfo =  getCartridge(cartridgeType);
              if (cartridgeInfo == null) {
                  handleError("No deployed Cartridge found with type [ " + cartridgeType +
                          " ] for Composite Application");
              }
-    		 
+
     		// get hostname and cluster id
              ClusterInformation clusterInfo;
              assert cartridgeInfo != null;
@@ -331,8 +331,8 @@ public class DefaultApplicationParser implements ApplicationParser {
              // create and collect this cluster's information
              ApplicationClusterContext appClusterCtxt = createApplicationClusterContext(appId, groupName, cartridgeInfo,
                      key, tenantId, cartridgeContext.getSubscribableInfoContext().getRepoUrl(), subscriptionAlias,
-                     clusterId, hostname, cartridgeContext.getSubscribableInfoContext().getDeploymentPolicy(), false, 
-                     cartridgeContext.getSubscribableInfoContext().getDependencyAliases(), 
+                     clusterId, hostname, cartridgeContext.getSubscribableInfoContext().getDeploymentPolicy(), false,
+                     cartridgeContext.getSubscribableInfoContext().getDependencyAliases(),
                      cartridgeContext.getSubscribableInfoContext().getProperties());
 
              appClusterCtxt.setAutoscalePolicyName(cartridgeContext.getSubscribableInfoContext().getAutoscalingPolicy());
@@ -345,7 +345,7 @@ public class DefaultApplicationParser implements ApplicationParser {
              clusterDataHolder.setMaxInstances(cartridgeContext.getCartridgeMax());
              clusterDataMap.put(subscriptionAlias, clusterDataHolder);
         }
-    	 
+
 
          return clusterDataMap;
     }
@@ -386,7 +386,7 @@ public class DefaultApplicationParser implements ApplicationParser {
             throws ApplicationDefinitionException {
 
         Map<String, Group> groupAliasToGroup = new HashMap<String, Group>();
-        
+
         for (GroupContext groupCtxt : groupCtxts) {
         	ServiceGroup serviceGroup  = getServiceGroup(groupCtxt.getName());
             if(serviceGroup == null) {
@@ -496,7 +496,7 @@ public class DefaultApplicationParser implements ApplicationParser {
             Map<String, Group> nestedGroups = new HashMap<String, Group>();
             // check sub groups
             for (GroupContext subGroupCtxt : groupCtxt.getGroupContexts()) {
-                // get the complete Group Definition                
+                // get the complete Group Definition
 				if (subGroupCtxt != null) {
                     for(ServiceGroup nestedServiceGroup : serviceGroup.getGroups()) {
                         if(nestedServiceGroup.getName().equals(subGroupCtxt.getName())) {
@@ -531,7 +531,7 @@ public class DefaultApplicationParser implements ApplicationParser {
         if (nestedServiceGroup == null) {
             handleError("Service Group Definition not found for name " + serviceGroupName);
         }
-        
+
         if (log.isDebugEnabled()) {
         	log.debug("parsing application ... getStartupOrderForGroup: " + serviceGroupName);
         }
@@ -542,7 +542,7 @@ public class DefaultApplicationParser implements ApplicationParser {
             	log.debug("parsing application ... getStartupOrderForGroup: dependencies != null " );
             }
             if (nestedServiceGroup.getDependencies().getStartupOrders() != null) {
-            	
+
             	String [] startupOrders = nestedServiceGroup.getDependencies().getStartupOrders();
             	if (log.isDebugEnabled()) {
                 	log.debug("parsing application ... getStartupOrderForGroup: startupOrders != null # of: " +  startupOrders.length);
@@ -631,12 +631,12 @@ public class DefaultApplicationParser implements ApplicationParser {
         ServiceGroup nestedGroup = getNestedServiceGroup(serviceGroupName, serviceGroup);
 
         if (nestedGroup == null) {
-            handleError("Service Group Definition not found for name " + serviceGroupName);        	
+            handleError("Service Group Definition not found for name " + serviceGroupName);
         }
 
         return nestedGroup.isGroupscalingEnabled();
     }
-    
+
     private ServiceGroup getNestedServiceGroup (String serviceGroupName, ServiceGroup serviceGroup) {
     	if(serviceGroup.getName().equals(serviceGroupName)) {
     		return serviceGroup;
@@ -647,7 +647,7 @@ public class DefaultApplicationParser implements ApplicationParser {
             }
     	}
     	return null;
-    	
+
     }
 
     /**
@@ -669,7 +669,7 @@ public class DefaultApplicationParser implements ApplicationParser {
         }
     }
 
-    
+
     /**
      * Creates a ApplicationClusterContext object to keep information related to a Cluster in this Application
      *

http://git-wip-us.apache.org/repos/asf/stratos/blob/bf721e83/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/pojo/ApplicationContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/pojo/ApplicationContext.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/pojo/ApplicationContext.java
index 5937f94..be6cb2c 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/pojo/ApplicationContext.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/pojo/ApplicationContext.java
@@ -124,4 +124,5 @@ public class ApplicationContext implements Serializable {
     public void setDescription(String description) {
         this.description = description;
     }
+
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/bf721e83/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/IdentityApplicationManagementServiceClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/IdentityApplicationManagementServiceClient.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/IdentityApplicationManagementServiceClient.java
index deccaf3..d9a562b 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/IdentityApplicationManagementServiceClient.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/IdentityApplicationManagementServiceClient.java
@@ -176,6 +176,12 @@ public class IdentityApplicationManagementServiceClient {
         return accessToken;
     }
 
+    public void removeApplication(String appName) throws RemoteException, IdentityApplicationManagementServiceIdentityApplicationManagementException {
+        if(log.isDebugEnabled()){
+            log.debug(String.format("Removing application %s", appName));
+        }
+        stub.deleteApplication(appName);
+    }
 
     private String getIdToken(String compositeAppId, String consumerKey, String consumerSecret) throws OAuthSystemException, OAuthProblemException {
         XMLConfiguration conf = ConfUtil.getInstance(null).getConfiguration();

http://git-wip-us.apache.org/repos/asf/stratos/blob/bf721e83/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/oAuthAdminServiceClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/oAuthAdminServiceClient.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/oAuthAdminServiceClient.java
index 8913c42..7e2a6ca 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/oAuthAdminServiceClient.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/oAuthAdminServiceClient.java
@@ -101,4 +101,11 @@ public class oAuthAdminServiceClient {
         return stub.getOAuthApplicationDataByAppName(name);
     }
 
+    public void removeOauthApplication(String appName) throws RemoteException, OAuthAdminServiceException {
+        if(log.isDebugEnabled()){
+            log.debug(String.format("Removing oAuth application %s", appName));
+        }
+        stub.removeOAuthApplicationData(appName);
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/bf721e83/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/InstanceMetadata.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/InstanceMetadata.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/InstanceMetadata.java
index 4c0895b..2971128 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/InstanceMetadata.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/InstanceMetadata.java
@@ -27,7 +27,6 @@ import java.io.Serializable;
 public class InstanceMetadata implements Serializable {
 
     private static final long serialVersionUID = 2121193151475197625L;
-
     private String hostname;
     private String hypervisor;
     private int ram;


[3/4] stratos git commit: rename metadata serice to metadata/api

Posted by ud...@apache.org.
rename metadata serice to metadata/api


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

Branch: refs/heads/master
Commit: 74de671ccc4c32acc4381920b5ad46d59ce75db8
Parents: 46b5402
Author: Udara Liyanage <ud...@wso2.com>
Authored: Fri Dec 19 19:06:13 2014 +0530
Committer: Udara Liyanage <ud...@wso2.com>
Committed: Mon Dec 22 14:37:54 2014 +0530

----------------------------------------------------------------------
 .../org.apache.stratos.metadataservice/pom.xml  |  9 +--
 .../META-INF/webapp-classloading.xml            | 35 +++++++++
 .../metadata-test/WEB-INF/cxf-servlet.xml       | 46 +++++++++++
 .../main/webapp/metadata-test/WEB-INF/web.xml   | 40 ++++++++++
 .../metadata/META-INF/webapp-classloading.xml   | 35 +++++++++
 .../webapp/metadata/WEB-INF/cxf-servlet.xml     | 81 ++++++++++++++++++++
 .../src/main/webapp/metadata/WEB-INF/web.xml    | 39 ++++++++++
 .../META-INF/webapp-classloading.xml            | 35 ---------
 .../WEB-INF/cxf-servlet.xml                     | 46 -----------
 .../stratosmetadataservice-test/WEB-INF/web.xml | 40 ----------
 .../META-INF/webapp-classloading.xml            | 35 ---------
 .../WEB-INF/cxf-servlet.xml                     | 81 --------------------
 .../stratosmetadataservice/WEB-INF/web.xml      | 39 ----------
 13 files changed, 279 insertions(+), 282 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/74de671c/components/org.apache.stratos.metadataservice/pom.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.metadataservice/pom.xml b/components/org.apache.stratos.metadataservice/pom.xml
index 37eb828..281c702 100644
--- a/components/org.apache.stratos.metadataservice/pom.xml
+++ b/components/org.apache.stratos.metadataservice/pom.xml
@@ -38,7 +38,7 @@
                 </property>
             </activation>
             <properties>
-                <appName>stratosmetadataservice-test</appName>
+                <appName>metadata-test</appName>
             </properties>
         </profile>
         <profile>
@@ -47,7 +47,7 @@
                 <activeByDefault>true</activeByDefault>
             </activation>
             <properties>
-                <appName>stratosmetadataservice</appName>
+                <appName>metadata</appName>
             </properties>
         </profile>
     </profiles>
@@ -73,10 +73,7 @@
                             <directory>src/main/webapp/${appName}</directory>
                         </resource>
                       </webResources>
-                    <warName>metadataapi</warName>
-                            
-        			        
-                    
+                    <warName>metadata</warName>
                 </configuration>
             </plugin>
            

http://git-wip-us.apache.org/repos/asf/stratos/blob/74de671c/components/org.apache.stratos.metadataservice/src/main/webapp/metadata-test/META-INF/webapp-classloading.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.metadataservice/src/main/webapp/metadata-test/META-INF/webapp-classloading.xml b/components/org.apache.stratos.metadataservice/src/main/webapp/metadata-test/META-INF/webapp-classloading.xml
new file mode 100644
index 0000000..c62912d
--- /dev/null
+++ b/components/org.apache.stratos.metadataservice/src/main/webapp/metadata-test/META-INF/webapp-classloading.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+  #  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.
+  -->
+
+<!--
+    This file defines class loading policy of the whole container. But this behaviour can be overridden by individual webapps by putting this file into the META-INF/ directory.
+-->
+<Classloading xmlns="http://wso2.org/projects/as/classloading">
+
+    <!-- Parent-first or child-first. Default behaviour is child-first.-->
+    <ParentFirst>false</ParentFirst>
+
+    <!--
+	Default environments that contains provides to all the webapps. This can be overridden by individual webapps by specifing required environments
+	Tomcat environment is the default and every webapps gets it even if they didn't specify it.
+	e.g. If a webapps requires CXF, they will get both Tomcat and CXF.
+     -->
+    <Environments>CXF,Carbon</Environments>
+</Classloading>

http://git-wip-us.apache.org/repos/asf/stratos/blob/74de671c/components/org.apache.stratos.metadataservice/src/main/webapp/metadata-test/WEB-INF/cxf-servlet.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.metadataservice/src/main/webapp/metadata-test/WEB-INF/cxf-servlet.xml b/components/org.apache.stratos.metadataservice/src/main/webapp/metadata-test/WEB-INF/cxf-servlet.xml
new file mode 100644
index 0000000..f8b8750
--- /dev/null
+++ b/components/org.apache.stratos.metadataservice/src/main/webapp/metadata-test/WEB-INF/cxf-servlet.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  #  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.
+  -->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:jaxrs="http://cxf.apache.org/jaxrs"
+       xsi:schemaLocation="
+         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+         http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
+
+    <jaxrs:server id="stratosAdmin" address="/">
+        <jaxrs:serviceBeans>
+            <ref bean="stratosRestEndpointTestBean"/>
+        </jaxrs:serviceBeans>
+
+        <jaxrs:providers>
+			<ref bean="throwableExceptionHandler"/>
+            <bean class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
+                <property name="dropRootElement" value="true"/>
+                <property name="supportUnwrapped" value="true"/>
+            </bean>>
+            <ref bean="exceptionHandler"/>
+        </jaxrs:providers>
+    </jaxrs:server>
+
+    <bean id="stratosRestEndpointTestBean" class="org.apache.stratos.rest.endpoint.mock.StratosTestAdmin"/>
+    <bean id="exceptionHandler" class="org.apache.stratos.rest.endpoint.handlers.CustomExceptionMapper"/>
+    <bean id="throwableExceptionHandler" class="org.apache.stratos.rest.endpoint.handlers.CustomThrowableExceptionMapper"/>
+</beans>

http://git-wip-us.apache.org/repos/asf/stratos/blob/74de671c/components/org.apache.stratos.metadataservice/src/main/webapp/metadata-test/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.metadataservice/src/main/webapp/metadata-test/WEB-INF/web.xml b/components/org.apache.stratos.metadataservice/src/main/webapp/metadata-test/WEB-INF/web.xml
new file mode 100644
index 0000000..4a752f6
--- /dev/null
+++ b/components/org.apache.stratos.metadataservice/src/main/webapp/metadata-test/WEB-INF/web.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  #  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.
+  -->
+
+<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+         http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+
+    <display-name>S2 Meta Data Admin Endpoint</display-name>
+
+    <servlet>
+        <servlet-name>StratosAdminEndpoint</servlet-name>
+        <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+
+    <servlet-mapping>
+        <servlet-name>StratosAdminEndpoint</servlet-name>
+        <url-pattern>/*</url-pattern>
+    </servlet-mapping>
+
+</web-app>
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/74de671c/components/org.apache.stratos.metadataservice/src/main/webapp/metadata/META-INF/webapp-classloading.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.metadataservice/src/main/webapp/metadata/META-INF/webapp-classloading.xml b/components/org.apache.stratos.metadataservice/src/main/webapp/metadata/META-INF/webapp-classloading.xml
new file mode 100644
index 0000000..c62912d
--- /dev/null
+++ b/components/org.apache.stratos.metadataservice/src/main/webapp/metadata/META-INF/webapp-classloading.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+  #  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.
+  -->
+
+<!--
+    This file defines class loading policy of the whole container. But this behaviour can be overridden by individual webapps by putting this file into the META-INF/ directory.
+-->
+<Classloading xmlns="http://wso2.org/projects/as/classloading">
+
+    <!-- Parent-first or child-first. Default behaviour is child-first.-->
+    <ParentFirst>false</ParentFirst>
+
+    <!--
+	Default environments that contains provides to all the webapps. This can be overridden by individual webapps by specifing required environments
+	Tomcat environment is the default and every webapps gets it even if they didn't specify it.
+	e.g. If a webapps requires CXF, they will get both Tomcat and CXF.
+     -->
+    <Environments>CXF,Carbon</Environments>
+</Classloading>

http://git-wip-us.apache.org/repos/asf/stratos/blob/74de671c/components/org.apache.stratos.metadataservice/src/main/webapp/metadata/WEB-INF/cxf-servlet.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.metadataservice/src/main/webapp/metadata/WEB-INF/cxf-servlet.xml b/components/org.apache.stratos.metadataservice/src/main/webapp/metadata/WEB-INF/cxf-servlet.xml
new file mode 100644
index 0000000..3d001bf
--- /dev/null
+++ b/components/org.apache.stratos.metadataservice/src/main/webapp/metadata/WEB-INF/cxf-servlet.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  #  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.
+  -->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:jaxrs="http://cxf.apache.org/jaxrs"
+       xsi:schemaLocation="
+         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+         http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
+
+    <jaxrs:server id="stratosMetaDataAdmin" address="/api">
+        <jaxrs:serviceBeans>
+            <ref bean="stratosRestEndpointBean"/>
+        </jaxrs:serviceBeans>
+
+        <jaxrs:providers>
+            <ref bean="throwableExceptionHandler"/>
+			<ref bean="genericExceptionHandler"/>
+            <ref bean="jsonProvider"/>
+            <ref bean="exceptionHandler"/>
+	    <ref bean="OAuthFilter"/>
+            <ref bean="basicAuthenticationFilter"/>
+            <ref bean="sessionAuthenticationFilter"/>
+            <!--<ref bean="authorizationFilter"/>-->
+        </jaxrs:providers>
+    </jaxrs:server>
+
+    <bean id="stratosRestEndpointBean" class="org.apache.stratos.metadataservice.services.MetaDataAdmin"/>
+    <bean id="basicAuthenticationFilter" class="org.apache.stratos.metadataservice.handlers.StratosAuthenticationHandler"/>
+    <bean id="sessionAuthenticationFilter" class="org.apache.stratos.metadataservice.handlers.CookieBasedAuthenticationHandler"/>
+    <bean id="authorizationFilter" class="org.apache.stratos.metadataservice.handlers.StratosAuthorizingHandler">
+        <property name="securedObject" ref="stratosRestEndpointBean"/>
+    </bean>
+    <bean id="exceptionHandler" class="org.apache.stratos.metadataservice.handlers.CustomExceptionMapper"/>
+    <bean id="genericExceptionHandler" class="org.apache.stratos.metadataservice.handlers.GenericExceptionMapper"/>
+    <bean id="throwableExceptionHandler" class="org.apache.stratos.metadataservice.handlers.CustomThrowableExceptionMapper"/>
+    <!--The below config enables OAuth based authentication/authorization for REST API-->
+    <bean id="OAuthFilter" class="org.apache.stratos.metadataservice.handlers.OAuthHandler">
+        <property name="password" value="admin"/>
+        <property name="username" value="admin"/>
+        <property name="oauthValidationEndpoint" value="https://localhost:9443/services/"/>
+    </bean>
+    <bean id="jsonProvider" class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
+        <property name="supportUnwrapped" value="true"/>
+        <property name="serializeAsArray" value="true"/>
+	<property name="dropRootElement" value="true" />
+        <property name="arrayKeys">
+            <list>
+                <value>partitions</value>
+                <value>property</value>
+                <value>hostNames</value>
+                <value>memberMap</value>
+                <value>portMap</value>
+                <value>partitionGroup</value>
+                <value>partition</value>
+                <value>member</value>
+                <value>hostNames</value>
+                <value>portMappings</value>
+                <value>volumes</value>
+            </list>
+        </property>
+    </bean>
+
+</beans>

http://git-wip-us.apache.org/repos/asf/stratos/blob/74de671c/components/org.apache.stratos.metadataservice/src/main/webapp/metadata/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.metadataservice/src/main/webapp/metadata/WEB-INF/web.xml b/components/org.apache.stratos.metadataservice/src/main/webapp/metadata/WEB-INF/web.xml
new file mode 100644
index 0000000..a46ee34
--- /dev/null
+++ b/components/org.apache.stratos.metadataservice/src/main/webapp/metadata/WEB-INF/web.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  #  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.
+  -->
+
+<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+         http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+
+    <display-name>S2 Admin Endpoint</display-name>
+    <servlet>
+        <servlet-name>StratosAdminEndpoint</servlet-name>
+        <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+
+    <servlet-mapping>
+        <servlet-name>StratosAdminEndpoint</servlet-name>
+        <url-pattern>/*</url-pattern>
+    </servlet-mapping>
+
+</web-app>
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/74de671c/components/org.apache.stratos.metadataservice/src/main/webapp/stratosmetadataservice-test/META-INF/webapp-classloading.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.metadataservice/src/main/webapp/stratosmetadataservice-test/META-INF/webapp-classloading.xml b/components/org.apache.stratos.metadataservice/src/main/webapp/stratosmetadataservice-test/META-INF/webapp-classloading.xml
deleted file mode 100644
index c62912d..0000000
--- a/components/org.apache.stratos.metadataservice/src/main/webapp/stratosmetadataservice-test/META-INF/webapp-classloading.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-  #  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.
-  -->
-
-<!--
-    This file defines class loading policy of the whole container. But this behaviour can be overridden by individual webapps by putting this file into the META-INF/ directory.
--->
-<Classloading xmlns="http://wso2.org/projects/as/classloading">
-
-    <!-- Parent-first or child-first. Default behaviour is child-first.-->
-    <ParentFirst>false</ParentFirst>
-
-    <!--
-	Default environments that contains provides to all the webapps. This can be overridden by individual webapps by specifing required environments
-	Tomcat environment is the default and every webapps gets it even if they didn't specify it.
-	e.g. If a webapps requires CXF, they will get both Tomcat and CXF.
-     -->
-    <Environments>CXF,Carbon</Environments>
-</Classloading>

http://git-wip-us.apache.org/repos/asf/stratos/blob/74de671c/components/org.apache.stratos.metadataservice/src/main/webapp/stratosmetadataservice-test/WEB-INF/cxf-servlet.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.metadataservice/src/main/webapp/stratosmetadataservice-test/WEB-INF/cxf-servlet.xml b/components/org.apache.stratos.metadataservice/src/main/webapp/stratosmetadataservice-test/WEB-INF/cxf-servlet.xml
deleted file mode 100644
index f8b8750..0000000
--- a/components/org.apache.stratos.metadataservice/src/main/webapp/stratosmetadataservice-test/WEB-INF/cxf-servlet.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  #  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.
-  -->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xmlns:jaxrs="http://cxf.apache.org/jaxrs"
-       xsi:schemaLocation="
-         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
-         http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
-
-    <jaxrs:server id="stratosAdmin" address="/">
-        <jaxrs:serviceBeans>
-            <ref bean="stratosRestEndpointTestBean"/>
-        </jaxrs:serviceBeans>
-
-        <jaxrs:providers>
-			<ref bean="throwableExceptionHandler"/>
-            <bean class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
-                <property name="dropRootElement" value="true"/>
-                <property name="supportUnwrapped" value="true"/>
-            </bean>>
-            <ref bean="exceptionHandler"/>
-        </jaxrs:providers>
-    </jaxrs:server>
-
-    <bean id="stratosRestEndpointTestBean" class="org.apache.stratos.rest.endpoint.mock.StratosTestAdmin"/>
-    <bean id="exceptionHandler" class="org.apache.stratos.rest.endpoint.handlers.CustomExceptionMapper"/>
-    <bean id="throwableExceptionHandler" class="org.apache.stratos.rest.endpoint.handlers.CustomThrowableExceptionMapper"/>
-</beans>

http://git-wip-us.apache.org/repos/asf/stratos/blob/74de671c/components/org.apache.stratos.metadataservice/src/main/webapp/stratosmetadataservice-test/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.metadataservice/src/main/webapp/stratosmetadataservice-test/WEB-INF/web.xml b/components/org.apache.stratos.metadataservice/src/main/webapp/stratosmetadataservice-test/WEB-INF/web.xml
deleted file mode 100644
index 4a752f6..0000000
--- a/components/org.apache.stratos.metadataservice/src/main/webapp/stratosmetadataservice-test/WEB-INF/web.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  #  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.
-  -->
-
-<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
-         http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
-
-    <display-name>S2 Meta Data Admin Endpoint</display-name>
-
-    <servlet>
-        <servlet-name>StratosAdminEndpoint</servlet-name>
-        <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
-        <load-on-startup>1</load-on-startup>
-    </servlet>
-
-    <servlet-mapping>
-        <servlet-name>StratosAdminEndpoint</servlet-name>
-        <url-pattern>/*</url-pattern>
-    </servlet-mapping>
-
-</web-app>
-

http://git-wip-us.apache.org/repos/asf/stratos/blob/74de671c/components/org.apache.stratos.metadataservice/src/main/webapp/stratosmetadataservice/META-INF/webapp-classloading.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.metadataservice/src/main/webapp/stratosmetadataservice/META-INF/webapp-classloading.xml b/components/org.apache.stratos.metadataservice/src/main/webapp/stratosmetadataservice/META-INF/webapp-classloading.xml
deleted file mode 100644
index c62912d..0000000
--- a/components/org.apache.stratos.metadataservice/src/main/webapp/stratosmetadataservice/META-INF/webapp-classloading.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-  #  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.
-  -->
-
-<!--
-    This file defines class loading policy of the whole container. But this behaviour can be overridden by individual webapps by putting this file into the META-INF/ directory.
--->
-<Classloading xmlns="http://wso2.org/projects/as/classloading">
-
-    <!-- Parent-first or child-first. Default behaviour is child-first.-->
-    <ParentFirst>false</ParentFirst>
-
-    <!--
-	Default environments that contains provides to all the webapps. This can be overridden by individual webapps by specifing required environments
-	Tomcat environment is the default and every webapps gets it even if they didn't specify it.
-	e.g. If a webapps requires CXF, they will get both Tomcat and CXF.
-     -->
-    <Environments>CXF,Carbon</Environments>
-</Classloading>

http://git-wip-us.apache.org/repos/asf/stratos/blob/74de671c/components/org.apache.stratos.metadataservice/src/main/webapp/stratosmetadataservice/WEB-INF/cxf-servlet.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.metadataservice/src/main/webapp/stratosmetadataservice/WEB-INF/cxf-servlet.xml b/components/org.apache.stratos.metadataservice/src/main/webapp/stratosmetadataservice/WEB-INF/cxf-servlet.xml
deleted file mode 100644
index 25e97fb..0000000
--- a/components/org.apache.stratos.metadataservice/src/main/webapp/stratosmetadataservice/WEB-INF/cxf-servlet.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  #  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.
-  -->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xmlns:jaxrs="http://cxf.apache.org/jaxrs"
-       xsi:schemaLocation="
-         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
-         http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
-
-    <jaxrs:server id="stratosMetaDataAdmin" address="/">
-        <jaxrs:serviceBeans>
-            <ref bean="stratosRestEndpointBean"/>
-        </jaxrs:serviceBeans>
-
-        <jaxrs:providers>
-            <ref bean="throwableExceptionHandler"/>
-			<ref bean="genericExceptionHandler"/>
-            <ref bean="jsonProvider"/>
-            <ref bean="exceptionHandler"/>
-	    <ref bean="OAuthFilter"/>
-            <ref bean="basicAuthenticationFilter"/>
-            <ref bean="sessionAuthenticationFilter"/>
-            <!--<ref bean="authorizationFilter"/>-->
-        </jaxrs:providers>
-    </jaxrs:server>
-
-    <bean id="stratosRestEndpointBean" class="org.apache.stratos.metadataservice.services.MetaDataAdmin"/>
-    <bean id="basicAuthenticationFilter" class="org.apache.stratos.metadataservice.handlers.StratosAuthenticationHandler"/>
-    <bean id="sessionAuthenticationFilter" class="org.apache.stratos.metadataservice.handlers.CookieBasedAuthenticationHandler"/>
-    <bean id="authorizationFilter" class="org.apache.stratos.metadataservice.handlers.StratosAuthorizingHandler">
-        <property name="securedObject" ref="stratosRestEndpointBean"/>
-    </bean>
-    <bean id="exceptionHandler" class="org.apache.stratos.metadataservice.handlers.CustomExceptionMapper"/>
-    <bean id="genericExceptionHandler" class="org.apache.stratos.metadataservice.handlers.GenericExceptionMapper"/>
-    <bean id="throwableExceptionHandler" class="org.apache.stratos.metadataservice.handlers.CustomThrowableExceptionMapper"/>
-    <!--The below config enables OAuth based authentication/authorization for REST API-->
-    <bean id="OAuthFilter" class="org.apache.stratos.metadataservice.handlers.OAuthHandler">
-        <property name="password" value="admin"/>
-        <property name="username" value="admin"/>
-        <property name="oauthValidationEndpoint" value="https://localhost:9443/services/"/>
-    </bean>
-    <bean id="jsonProvider" class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
-        <property name="supportUnwrapped" value="true"/>
-        <property name="serializeAsArray" value="true"/>
-	<property name="dropRootElement" value="true" />
-        <property name="arrayKeys">
-            <list>
-                <value>partitions</value>
-                <value>property</value>
-                <value>hostNames</value>
-                <value>memberMap</value>
-                <value>portMap</value>
-                <value>partitionGroup</value>
-                <value>partition</value>
-                <value>member</value>
-                <value>hostNames</value>
-                <value>portMappings</value>
-                <value>volumes</value>
-            </list>
-        </property>
-    </bean>
-
-</beans>

http://git-wip-us.apache.org/repos/asf/stratos/blob/74de671c/components/org.apache.stratos.metadataservice/src/main/webapp/stratosmetadataservice/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.metadataservice/src/main/webapp/stratosmetadataservice/WEB-INF/web.xml b/components/org.apache.stratos.metadataservice/src/main/webapp/stratosmetadataservice/WEB-INF/web.xml
deleted file mode 100644
index a46ee34..0000000
--- a/components/org.apache.stratos.metadataservice/src/main/webapp/stratosmetadataservice/WEB-INF/web.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  #  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.
-  -->
-
-<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
-         http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
-
-    <display-name>S2 Admin Endpoint</display-name>
-    <servlet>
-        <servlet-name>StratosAdminEndpoint</servlet-name>
-        <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
-        <load-on-startup>1</load-on-startup>
-    </servlet>
-
-    <servlet-mapping>
-        <servlet-name>StratosAdminEndpoint</servlet-name>
-        <url-pattern>/*</url-pattern>
-    </servlet-mapping>
-
-</web-app>
-


[4/4] stratos git commit: creating token only once per an application

Posted by ud...@apache.org.
creating token only once per an application


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

Branch: refs/heads/master
Commit: de0c431c9926ff5bc6c64ffd70d73405915cf01a
Parents: 7fa3c17
Author: Udara Liyanage <ud...@wso2.com>
Authored: Fri Dec 19 18:37:07 2014 +0530
Committer: Udara Liyanage <ud...@wso2.com>
Committed: Mon Dec 22 14:37:54 2014 +0530

----------------------------------------------------------------------
 .../applications/parser/DefaultApplicationParser.java    | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/de0c431c/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/parser/DefaultApplicationParser.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/parser/DefaultApplicationParser.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/parser/DefaultApplicationParser.java
index f5a1f16..e3ae175 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/parser/DefaultApplicationParser.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/parser/DefaultApplicationParser.java
@@ -60,12 +60,12 @@ import java.util.*;
  */
 public class DefaultApplicationParser implements ApplicationParser {
 
-    public static final String TOKEN_PAYLOD_PARAM_NAME = "TOKEN";
     private static Log log = LogFactory.getLog(DefaultApplicationParser.class);
 
     private Set<ApplicationClusterContext> applicationClusterContexts;
     private Map<String, Properties> aliasToProperties;
  	private Map<String, SubscribableInfoContext> subscribableInformation = new HashMap<String, SubscribableInfoContext>();
+    private String oauthToken;
 
     public DefaultApplicationParser () {
         this.applicationClusterContexts = new HashSet<ApplicationClusterContext>();
@@ -106,6 +106,7 @@ public class DefaultApplicationParser implements ApplicationParser {
             handleError("Invalid Composite Application Definition, no Subscribable Information specified");
         }
 
+        oauthToken = createToken(applicationCtxt.getApplicationId());
         return buildCompositeAppStructure (applicationCtxt, subscribablesInfo);
     }
 
@@ -343,7 +344,6 @@ public class DefaultApplicationParser implements ApplicationParser {
              clusterDataHolder.setMinInstances(cartridgeContext.getCartridgeMin());
              clusterDataHolder.setMaxInstances(cartridgeContext.getCartridgeMax());
              clusterDataMap.put(subscriptionAlias, clusterDataHolder);
-    		 
         }
     	 
 
@@ -465,7 +465,7 @@ public class DefaultApplicationParser implements ApplicationParser {
             throws ApplicationDefinitionException {
 
         Group group = new Group(appId, groupCtxt.getName(), groupCtxt.getAlias());
-        group.setGroupScalingEnabled(isGroupScalingEnabled(groupCtxt.getName(),serviceGroup));
+        group.setGroupScalingEnabled(isGroupScalingEnabled(groupCtxt.getName(), serviceGroup));
         group.setGroupMinInstances(groupCtxt.getGroupMinInstances());
         group.setGroupMaxInstances(groupCtxt.getGroupMaxInstances());
         DependencyOrder dependencyOrder = new DependencyOrder();
@@ -696,10 +696,7 @@ public class DefaultApplicationParser implements ApplicationParser {
 
         // Create text payload
         PayloadData payloadData = ApplicationUtils.createPayload(appId, groupName, cartridgeInfo, subscriptionKey, tenantId, clusterId,
-                hostname, repoUrl, alias, null, dependencyAliases, properties);
-
-        String oAuth_token = createToken(appId);
-        payloadData.add(TOKEN_PAYLOD_PARAM_NAME, oAuth_token);
+                hostname, repoUrl, alias, null, dependencyAliases, properties, oauthToken);
 
         String textPayload = payloadData.toString();
 


[2/4] stratos git commit: refactor to use string utils

Posted by ud...@apache.org.
refactor to use string utils


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

Branch: refs/heads/master
Commit: 46b54027a75d3fcef319d49da3b892a949f44720
Parents: de0c431
Author: Udara Liyanage <ud...@wso2.com>
Authored: Fri Dec 19 18:37:54 2014 +0530
Committer: Udara Liyanage <ud...@wso2.com>
Committed: Mon Dec 22 14:37:54 2014 +0530

----------------------------------------------------------------------
 .../stratos/autoscaler/applications/ApplicationUtils.java   | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/46b54027/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/ApplicationUtils.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/ApplicationUtils.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/ApplicationUtils.java
index d0918e6..88b56fd 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/ApplicationUtils.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/ApplicationUtils.java
@@ -19,6 +19,7 @@
 
 package org.apache.stratos.autoscaler.applications;
 
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.stratos.autoscaler.applications.payload.BasicPayloadData;
@@ -36,6 +37,8 @@ import java.util.regex.Pattern;
 public class ApplicationUtils {
     private static final Log log = LogFactory.getLog(ApplicationUtils.class);
 
+    public static final String TOKEN_PAYLOD_PARAM_NAME = "TOKEN";
+
     public static boolean isAliasValid (String alias) {
 
         String patternString = "([a-z0-9]+([-][a-z0-9])*)+";
@@ -194,7 +197,7 @@ public class ApplicationUtils {
 
     public static PayloadData createPayload(String appId, String groupName, CartridgeInfo cartridgeInfo, String subscriptionKey, int tenantId, String clusterId,
                                             String hostName, String repoUrl, String alias, Map<String, String> customPayloadEntries, String[] dependencyAliases, 
-                                            org.apache.stratos.common.Properties properties)
+                                            org.apache.stratos.common.Properties properties, String oauthToken)
             throws ApplicationDefinitionException {
 
         //Create the payload
@@ -250,6 +253,10 @@ public class ApplicationUtils {
         if(!isDeploymentParam) {
             payloadData.add("DEPLOYMENT", "default");
         }
+
+        if(!StringUtils.isEmpty(oauthToken)){
+            payloadData.add(TOKEN_PAYLOD_PARAM_NAME, oauthToken);
+        }
         //check if there are any custom payload entries defined
         if (customPayloadEntries != null) {
             //add them to the payload