http://git-wip-us.apache.org/repos/asf/stratos/blob/958a3100/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/oauth2/ValidationServiceClient.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/oauth2/ValidationServiceClient.java
 
b/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/oauth2/ValidationServiceClient.java
new file mode 100644
index 0000000..d4810c6
--- /dev/null
+++ 
b/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/oauth2/ValidationServiceClient.java
@@ -0,0 +1,65 @@
+/*
+ * 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.metadata.service.oauth2;
+
+import java.rmi.RemoteException;
+
+import org.apache.axis2.AxisFault;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.cxf.rs.security.oauth2.utils.OAuthConstants;
+import org.wso2.carbon.utils.CarbonUtils;
+import org.wso2.carbon.identity.oauth2.stub.OAuth2TokenValidationServiceStub;
+import 
org.wso2.carbon.identity.oauth2.stub.dto.OAuth2TokenValidationRequestDTO;
+import 
org.wso2.carbon.identity.oauth2.stub.dto.OAuth2TokenValidationResponseDTO;
+
+/**
+ * Service class wrapper for OAuthTokenValidation endpoint.
+ */
+public class ValidationServiceClient {
+       private OAuth2TokenValidationServiceStub stub = null;
+       private static final Log log = 
LogFactory.getLog(OAuth2TokenValidationServiceStub.class);
+
+       public ValidationServiceClient(String backendServerURL, String 
username, String password)
+                                                                               
                 throws Exception {
+               String serviceURL = backendServerURL + 
"OAuth2TokenValidationService";
+               try {
+                       stub = new OAuth2TokenValidationServiceStub(serviceURL);
+                       CarbonUtils.setBasicAccessSecurityHeaders(username, 
password, true,
+                                                                 
stub._getServiceClient());
+               } catch (AxisFault e) {
+                       log.error("Error initializing OAuth2 Client");
+                       throw new Exception("Error initializing OAuth Client", 
e);
+               }
+       }
+
+       public OAuth2TokenValidationResponseDTO 
validateAuthenticationRequest(String accessToken)
+                                                                               
                 throws Exception {
+               OAuth2TokenValidationRequestDTO oauthReq = new 
OAuth2TokenValidationRequestDTO();
+               oauthReq.setAccessToken(accessToken);
+               oauthReq.setTokenType(OAuthConstants.BEARER_TOKEN_TYPE);
+               try {
+                       return stub.validate(oauthReq);
+               } catch (RemoteException e) {
+                       log.error("Error while validating OAuth2 request");
+                       throw new Exception("Error while validating OAuth2 
request", e);
+               }
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/958a3100/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/registry/CarbonRegistry.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/registry/CarbonRegistry.java
 
b/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/registry/CarbonRegistry.java
new file mode 100644
index 0000000..32fdc56
--- /dev/null
+++ 
b/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/registry/CarbonRegistry.java
@@ -0,0 +1,191 @@
+/*
+ * 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.metadata.service.registry;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.manager.internal.ServiceReferenceHolder;
+import org.apache.stratos.metadata.service.definition.NewProperty;
+import org.wso2.carbon.registry.api.Registry;
+import org.wso2.carbon.registry.api.RegistryException;
+import org.wso2.carbon.registry.api.Resource;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.core.Context;
+import java.util.*;
+
+
+/**
+ * Carbon registry implementation
+ *
+ */
+
+public class CarbonRegistry implements DataStore {
+
+    private static Log log = LogFactory.getLog(CarbonRegistry.class);
+    @Context
+    HttpServletRequest httpServletRequest;
+
+    private static final String mainResource = "/stratos/";
+
+    public CarbonRegistry() {
+    }
+
+
+    /**
+     * Get Properties of clustor
+     * @param applicationName
+     * @param clusterId
+     * @return
+     * @throws RegistryException
+     */
+    public List<NewProperty> getPropertiesOfCluster(String applicationName, 
String clusterId) throws RegistryException {
+        Registry tempRegistry = 
ServiceReferenceHolder.getRegistryService().getRegistry();
+        String resourcePath = mainResource + applicationName + "/" + clusterId;
+        if (!tempRegistry.resourceExists(resourcePath)) {
+            return null;
+            //throw new RegistryException("Cluster does not exist at " + 
resourcePath);
+        }
+        Resource regResource = tempRegistry.get(resourcePath);
+
+        ArrayList<NewProperty> newProperties = new ArrayList<NewProperty>();
+
+        Properties props = regResource.getProperties();
+        Enumeration<?> x = props.propertyNames();
+        while (x.hasMoreElements()) {
+            String key = (String) x.nextElement();
+            List<String> values = regResource.getPropertyValues(key);
+            NewProperty property = new NewProperty();
+            property.setKey(key);
+            String[] valueArr = new String[values.size()];
+            property.setValues(values.toArray(valueArr));
+
+            newProperties.add(property);
+        }
+
+        return newProperties;
+    }
+
+    /**
+     * Add property to cluster
+     * @param applicationId
+     * @param clusterId
+     * @param property
+     * @throws RegistryException
+     */
+    public void addPropertyToCluster(String applicationId, String clusterId, 
NewProperty property) throws RegistryException {
+        Registry tempRegistry = 
ServiceReferenceHolder.getRegistryService().getRegistry();
+        String resourcePath = mainResource + applicationId + "/" + clusterId;
+        Resource regResource = createOrGetResourceforCluster(tempRegistry, 
resourcePath);
+
+        regResource.setProperty(property.getKey(), 
Arrays.asList(property.getValues()));
+        tempRegistry.put(resourcePath, regResource);
+        log.info(String.format("Property %s is added to cluster %s of 
application %s", property.getKey(), clusterId, applicationId));
+
+    }
+
+    /**
+     * Delete the resource identified by the applicationId, if exist.
+     * @param applicationId ID of the application.
+     * @return True if resource exist and able to delete, else false.
+     * @throws RegistryException
+     */
+    public boolean deleteApplication(String applicationId) throws 
RegistryException {
+        if(StringUtils.isBlank(applicationId)){
+            throw new IllegalArgumentException("Application ID can not be 
null");
+        }
+        Registry tempRegistry = 
ServiceReferenceHolder.getRegistryService().getRegistry();
+        String resourcePath = mainResource + applicationId;
+
+        if(tempRegistry.resourceExists(resourcePath)){
+            tempRegistry.delete(resourcePath);
+            log.info(String.format("Application removed from registry %s", 
applicationId));
+            return true;
+        }
+
+        return false;
+    }
+
+    /**
+     * Add properties to cluster
+     * @param applicationName
+     * @param clusterId
+     * @param properties
+     * @throws RegistryException
+     */
+    public void addPropertiesToCluster(String applicationName, String 
clusterId, NewProperty[] properties) throws RegistryException {
+        Registry tempRegistry = 
ServiceReferenceHolder.getRegistryService().getRegistry();
+        String resourcePath = mainResource + applicationName + "/" + clusterId;
+        Resource regResource;
+        regResource = createOrGetResourceforCluster(tempRegistry, 
resourcePath);
+
+        for (NewProperty property : properties) {
+            regResource.setProperty(property.getKey(), 
(Arrays.asList(property.getValues())));
+
+        }
+        tempRegistry.put(resourcePath, regResource);
+        log.info(String.format("Properties  are added to cluster %s of 
application %s", clusterId, applicationName));
+    }
+
+    /**
+     * Create or get resource for application
+     * @param tempRegistry
+     * @param resourcePath
+     * @return
+     * @throws RegistryException
+     */
+    private Resource createOrGetResourceforApplication(Registry tempRegistry, 
String resourcePath) throws RegistryException {
+        Resource regResource;
+        if (tempRegistry.resourceExists(resourcePath)) {
+            regResource = tempRegistry.get(resourcePath);
+        } else {
+            regResource = tempRegistry.newCollection();
+            if (log.isDebugEnabled()) {
+                log.debug("Registry resource is create at path " + 
regResource.getPath() + " for application");
+            }
+        }
+        return regResource;
+    }
+
+    /**
+     * Create and get resources for Clustor
+     * @param tempRegistry
+     * @param resourcePath
+     * @return
+     * @throws RegistryException
+     */
+    private Resource createOrGetResourceforCluster(Registry tempRegistry, 
String resourcePath) throws RegistryException {
+
+        int index = resourcePath.lastIndexOf('/');
+        String applicationResourcePath = resourcePath.substring(0, index);
+        createOrGetResourceforApplication(tempRegistry, 
applicationResourcePath);
+        Resource regResource;
+        if (tempRegistry.resourceExists(resourcePath)) {
+            regResource = tempRegistry.get(resourcePath);
+        } else {
+            regResource = tempRegistry.newResource();
+            if (log.isDebugEnabled()) {
+                log.debug("Registry resource is create at path for cluster" + 
regResource.getPath() + " for cluster");
+            }
+        }
+        return regResource;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/958a3100/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/registry/DataRegistryFactory.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/registry/DataRegistryFactory.java
 
b/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/registry/DataRegistryFactory.java
new file mode 100644
index 0000000..981560c
--- /dev/null
+++ 
b/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/registry/DataRegistryFactory.java
@@ -0,0 +1,33 @@
+/*
+ * 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.metadata.service.registry;
+
+/*
+ * Factory for the Data Registry
+ */
+public class DataRegistryFactory {
+
+       public static DataStore getDataStore(String registryName) {
+               if (registryName.equals("carbon")) {
+                       return new CarbonRegistry();
+               } else {
+                       return null;
+               }
+       }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/958a3100/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/registry/DataStore.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/registry/DataStore.java
 
b/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/registry/DataStore.java
new file mode 100644
index 0000000..f9f42bb
--- /dev/null
+++ 
b/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/registry/DataStore.java
@@ -0,0 +1,41 @@
+/*
+ * 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.metadata.service.registry;
+
+
+import org.apache.stratos.metadata.service.definition.NewProperty;
+import org.wso2.carbon.registry.api.RegistryException;
+
+import java.util.List;
+
+/*
+ * Interface of the Data Store
+ */
+public interface DataStore {
+
+    public void addPropertiesToCluster(String applicationName, String 
clusterId, NewProperty[] properties)
+            throws RegistryException;
+
+    public List<NewProperty> getPropertiesOfCluster(String applicationName, 
String clusterId)
+            throws RegistryException;
+
+    public void addPropertyToCluster(String applicationId, String clusterId, 
NewProperty property) throws RegistryException;
+
+    public boolean deleteApplication(String applicationId) throws 
RegistryException;
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/958a3100/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/security/StratosPrincipal.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/security/StratosPrincipal.java
 
b/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/security/StratosPrincipal.java
new file mode 100644
index 0000000..9f0c835
--- /dev/null
+++ 
b/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/security/StratosPrincipal.java
@@ -0,0 +1,53 @@
+/*
+ * 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.metadata.service.security;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.security.Principal;
+
+/**
+ * {@link StratosSecurityContext} make use of principal instance. Here with 
Stratos
+ * authentication/authorization framework we only need username as the 
principal details
+ */
+public class StratosPrincipal implements Principal {
+    private Log log = LogFactory.getLog(StratosPrincipal.class);
+    private String userName;
+
+    public StratosPrincipal(String userName) {
+        this.userName = userName;
+    }
+
+    public boolean equals(Object another) {
+      return userName.equals((another));
+    }
+
+    public String toString() {
+        return userName.toString();
+    }
+
+    public int hashCode() {
+        return userName.hashCode();
+    }
+
+    public String getName() {
+        return userName;
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/958a3100/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/security/StratosSecurityContext.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/security/StratosSecurityContext.java
 
b/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/security/StratosSecurityContext.java
new file mode 100644
index 0000000..fbc4b1a
--- /dev/null
+++ 
b/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/security/StratosSecurityContext.java
@@ -0,0 +1,50 @@
+/*
+ * 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.metadata.service.security;
+
+import java.security.Principal;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.cxf.security.SecurityContext;
+
+/**
+ * {@link StratosSecurityContext} is what get passed between authentication
+ * handlers
+ * and the authorization handler.
+ */
+public class StratosSecurityContext implements SecurityContext {
+       private static Log log = 
LogFactory.getLog(StratosSecurityContext.class);
+       Principal principal;
+
+       public StratosSecurityContext(String user) {
+               this.principal = new StratosPrincipal(user);
+       }
+
+       @Override
+       public Principal getUserPrincipal() {
+               return principal;
+       }
+
+       @Override
+       public boolean isUserInRole(String role) {
+               return false;
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/958a3100/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/services/MetaDataAdmin.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/services/MetaDataAdmin.java
 
b/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/services/MetaDataAdmin.java
new file mode 100644
index 0000000..9b8ce94
--- /dev/null
+++ 
b/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/services/MetaDataAdmin.java
@@ -0,0 +1,195 @@
+/*
+ * 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.metadata.service.services;
+
+import org.apache.commons.configuration.XMLConfiguration;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.metadata.service.annotation.AuthorizationAction;
+import org.apache.stratos.metadata.service.definition.NewProperty;
+import org.apache.stratos.metadata.service.exception.RestAPIException;
+import org.apache.stratos.metadata.service.registry.DataRegistryFactory;
+import org.apache.stratos.metadata.service.registry.DataStore;
+import org.apache.stratos.metadata.service.util.ConfUtil;
+import org.wso2.carbon.registry.api.RegistryException;
+
+import javax.ws.rs.*;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+import java.net.URI;
+import java.util.List;
+
+@Path("/")
+public class MetaDataAdmin {
+    @Context
+    UriInfo uriInfo;
+
+    private static Log log = LogFactory.getLog(MetaDataAdmin.class);
+
+
+
+    private DataStore registry;
+
+    /**
+     * Meta data admin configuration loading
+     */
+    public MetaDataAdmin(){
+        XMLConfiguration conf = ConfUtil.getInstance(null).getConfiguration();
+        String DEFAULT_REG_TYPE = "carbon";
+        String registryType =  
conf.getString("metadataservice.govenanceregistrytype", DEFAULT_REG_TYPE);
+        registry = DataRegistryFactory.getDataStore(registryType);
+    }
+
+    @GET
+    @Path("/application/{application_id}/cluster/{cluster_id}/properties")
+    @Produces("application/json")
+    @Consumes("application/json")
+    @AuthorizationAction("/permission/protected/manage/monitor/tenants")
+    public Response getClusterProperties(@PathParam("application_id") String 
applicationId, @PathParam("cluster_id") String clusterId) throws 
RestAPIException {
+
+        List<NewProperty> properties;
+        NewProperty[] propertiesArr = null;
+           try {
+                   properties = registry
+                                   .getPropertiesOfCluster(applicationId, 
clusterId);
+                   if (properties != null) {
+                           propertiesArr = new NewProperty[properties.size()];
+                           propertiesArr = properties.toArray(propertiesArr);
+                   }
+           } catch (RegistryException e) {
+                   String msg = "Error occurred while getting properties ";
+                   log.error(msg, e);
+                   throw new RestAPIException(msg, e);
+           }
+
+        Response.ResponseBuilder rb;
+        if (propertiesArr == null) {
+            rb = Response.status(Response.Status.NOT_FOUND);
+        } else {
+            rb = Response.ok().entity(propertiesArr);
+        }
+        return rb.build();
+    }
+
+    @GET
+    
@Path("/application/{application_id}/cluster/{cluster_id}/property/{property_name}")
+    @Produces("application/json")
+    @Consumes("application/json")
+    @AuthorizationAction("/permission/protected/manage/monitor/tenants")
+    public Response getClusterProperty(@PathParam("application_id") String 
applicationId, @PathParam("cluster_id") String clusterId, 
@PathParam("property_name") String propertyName) throws RestAPIException{
+        List<NewProperty> properties;
+
+
+        NewProperty property = null;
+
+           try {
+                   properties = registry
+                                   .getPropertiesOfCluster(applicationId, 
clusterId);
+                   if (properties == null) {
+                           return 
Response.status(Response.Status.NOT_FOUND).build();
+                   }
+                   for (NewProperty p : properties) {
+                           if (propertyName.equals(p.getKey())) {
+                                   property = p;
+                                   break;
+                           }
+                   }
+           } catch (RegistryException e) {
+                   String msg = "Error occurred while getting property";
+                   log.error(msg, e);
+                   throw new RestAPIException(msg, e);
+           }
+
+        Response.ResponseBuilder rb;
+        if (property == null) {
+            rb = Response.status(Response.Status.NOT_FOUND);
+        } else {
+            rb = Response.ok().entity(property);
+        }
+        return rb.build();
+    }
+
+    @POST
+    @Path("application/{application_id}/cluster/{cluster_id}/property")
+    @Produces("application/json")
+    @Consumes("application/json")
+    @AuthorizationAction("/permission/protected/manage/monitor/tenants")
+    public Response addPropertyToACluster(@PathParam("application_id") String 
applicationId, @PathParam("cluster_id") String clusterId, NewProperty property)
+            throws RestAPIException {
+
+        URI url =  uriInfo.getAbsolutePathBuilder().path(applicationId + "/" + 
clusterId + "/" + property.getKey()).build();
+
+           try {
+                   registry.addPropertyToCluster(applicationId, clusterId, 
property);
+           } catch (RegistryException e) {
+                   String msg = "Error occurred while adding property";
+                   log.error(msg, e);
+                   throw new RestAPIException(msg, e);
+           }
+
+        return Response.created(url).build();
+    }
+
+    @POST
+    @Path("application/{application_id}/cluster/{cluster_id}/properties")
+    @Produces("application/json")
+    @Consumes("application/json")
+    @AuthorizationAction("/permission/protected/manage/monitor/tenants")
+    public Response addPropertiesToACluster(@PathParam("application_id") 
String applicationId, @PathParam("cluster_id") String clusterId, NewProperty[] 
properties)
+            throws RestAPIException {
+        URI url = uriInfo.getAbsolutePathBuilder().path(applicationId + "/" + 
clusterId).build();
+
+           try {
+                   registry.addPropertiesToCluster(applicationId, clusterId, 
properties);
+           } catch (RegistryException e) {
+                   String msg = "Error occurred while adding properties ";
+                   log.error(msg, e);
+                   throw new RestAPIException(msg, e);
+           }
+
+        return Response.created(url).build();
+    }
+
+    @DELETE
+    @Path("application/{application_id}")
+    @Produces("application/json")
+    @Consumes("application/json")
+    @AuthorizationAction("/permission/protected/manage/monitor/tenants")
+    public Response deleteApplicationProperties(@PathParam("application_id") 
String applicationId)
+            throws RestAPIException {
+
+           try {
+                   boolean deleted = registry.deleteApplication(applicationId);
+                   if (!deleted) {
+                           log.warn(String.format(
+                                           "Either no metadata is associated 
with given appId %s Or resources could not be deleted",
+                                           applicationId));
+                   }
+           } catch (RegistryException e) {
+                   String msg = "Resource attached with appId could not be 
deleted";
+                   log.error(msg, e);
+                   throw new RestAPIException(msg, e);
+           }
+
+        return Response.ok().build();
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/958a3100/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/util/ConfUtil.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/util/ConfUtil.java
 
b/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/util/ConfUtil.java
new file mode 100644
index 0000000..50eaa63
--- /dev/null
+++ 
b/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/util/ConfUtil.java
@@ -0,0 +1,76 @@
+/*
+ * 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.metadata.service.util;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.XMLConfiguration;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.metadata.service.Constants;
+import org.wso2.carbon.utils.CarbonUtils;
+
+import java.io.File;
+
+/**
+ * This class contains utility methods for read metadata configuration file.
+ */
+public class ConfUtil {
+
+       private static Log log = LogFactory.getLog(ConfUtil.class);
+
+       private XMLConfiguration config;
+
+       private static ConfUtil instance = null;
+
+       private ConfUtil(String configFilePath) {
+        log.debug("Loading configuration.....");
+
+               try {
+
+                       File confFile;
+                       if (StringUtils.isNotEmpty(configFilePath)) {
+                               confFile = new File(configFilePath);
+
+                       } else {
+                               confFile =
+                                          new 
File(CarbonUtils.getCarbonConfigDirPath(),
+                                                   
Constants.METADATASERVICE_CONFIG_FILE_NAME);
+                       }
+
+                       config = new XMLConfiguration(confFile);
+               } catch (ConfigurationException e) {
+                       log.error("Unable to load autoscaler configuration 
file", e);
+                       config = new XMLConfiguration(); // continue with 
default values
+               }
+       }
+
+       public static ConfUtil getInstance(String configFilePath) {
+               if (instance == null) {
+                       instance = new ConfUtil(configFilePath);
+               }
+               return instance;
+       }
+
+       public XMLConfiguration getConfiguration() {
+               return config;
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/958a3100/components/org.apache.stratos.metadata.service/src/main/resources/axis2_client.xml
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.metadata.service/src/main/resources/axis2_client.xml
 
b/components/org.apache.stratos.metadata.service/src/main/resources/axis2_client.xml
new file mode 100644
index 0000000..db07954
--- /dev/null
+++ 
b/components/org.apache.stratos.metadata.service/src/main/resources/axis2_client.xml
@@ -0,0 +1,299 @@
+<!--
+  ~ Copyright 2005-2011 WSO2, Inc. (http://wso2.com)
+  ~
+  ~ Licensed 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.
+  -->
+
+<axisconfig name="AxisJava2.0">
+    <!-- ================================================= -->
+    <!-- Parameters -->
+    <!-- ================================================= -->
+    <parameter name="hotdeployment">true</parameter>
+    <parameter name="hotupdate">false</parameter>
+    <parameter name="enableMTOM">false</parameter>
+
+    <!-- commons-http-client defaultMaxConnPerHost -->
+    <parameter name="defaultMaxConnPerHost">500</parameter>
+    <!-- commons-http-client maxTotalConnections -->
+    <parameter name="maxTotalConnections">15000</parameter>
+
+    <!--If turned on with use the Accept header of the request to determine 
the contentType of the
+    response-->
+    <parameter name="httpContentNegotiation">false</parameter>
+
+    <!--During a fault, stacktrace can be sent with the fault message. The 
following flag will control -->
+    <!--that behaviour.-->
+    <parameter name="sendStacktraceDetailsWithFaults">true</parameter>
+
+    <!--If there aren't any information available to find out the fault 
reason, we set the message of the exception-->
+    <!--as the faultreason/Reason. But when a fault is thrown from a service 
or some where, it will be -->
+    <!--wrapped by different levels. Due to this the initial exception message 
can be lost. If this flag-->
+    <!--is set then, Axis2 tries to get the first exception and set its 
message as the faultreason/Reason.-->
+    <parameter name="DrillDownToRootCauseForFaultReason">false</parameter>
+
+    <!--This is the user name and password of admin console-->
+    <parameter name="userName">admin</parameter>
+    <parameter name="password">axis2</parameter>
+
+    <!--To override repository/services you need to uncomment following 
parameter and value SHOULD be absolute file path.-->
+    <!--ServicesDirectory only works on the following cases-->
+    <!---File based configurator and in that case the value should be a file 
URL (http:// not allowed)-->
+    <!---When creating URL Based configurator with URL “file://”  -->
+    <!--- War based configurator with expanded case , -->
+
+    <!--All the other scenarios it will be ignored.-->
+    <!--<parameter name="ServicesDirectory">service</parameter>-->
+    <!--To override repository/modules you need to uncomment following 
parameter and value SHOULD be absolute file path-->
+    <!--<parameter name="ModulesDirectory">modules</parameter>-->
+
+    <!--Following params will set the proper context paths for invocations. 
All the endpoints will have a commons context-->
+    <!--root which can configured using the following contextRoot parameter-->
+    <!--<parameter name="contextRoot">axis2</parameter>-->
+
+    <!--Our HTTP endpoints can handle both REST and SOAP. Following parameters 
can be used to distinguish those endpoints-->
+    <!--<parameter name="servicePath">services</parameter>-->
+    <!--<parameter name="restPath">rest</parameter>-->
+
+    <!-- Following parameter will completely disable REST handling in Axis2-->
+    <parameter name="disableREST" locked="false">false</parameter>
+
+    <!--POJO deployer , this will alow users to drop .class file and make that 
into a service-->
+    <deployer extension=".class" directory="pojo" 
class="org.apache.axis2.deployment.POJODeployer"/>
+
+    <!-- Following parameter will set the host name for the epr-->
+    <!--<parameter name="hostname" locked="true">myhost.com</parameter>-->
+
+    <!-- ================================================= -->
+    <!-- Message Receivers -->
+    <!-- ================================================= -->
+    <!--This is the Default Message Receiver for the system , if you want to 
have MessageReceivers for -->
+    <!--all the other MEP implement it and add the correct entry to here , so 
that you can refer from-->
+    <!--any operation -->
+    <!--Note : You can override this for particular service by adding the same 
element with your requirement-->
+    <messageReceivers>
+        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only";
+                         
class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
+        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out";
+                         
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+        <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-only";
+                         
class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
+        <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-out";
+                         
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+    </messageReceivers>
+
+    <!-- ================================================= -->
+    <!-- Message Formatter -->
+    <!-- ================================================= -->
+    <!--Following content type to message formatter mapping can be used to 
implement support for different message -->
+    <!--format  serialization in Axis2. These message formats are expected to 
be resolved based on the content type. -->
+    <messageFormatters>
+        <messageFormatter contentType="application/x-www-form-urlencoded"
+                          
class="org.apache.axis2.transport.http.XFormURLEncodedFormatter"/>
+        <messageFormatter contentType="multipart/form-data"
+                          
class="org.apache.axis2.transport.http.MultipartFormDataFormatter"/>
+        <messageFormatter contentType="application/xml"
+                          
class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
+        <messageFormatter contentType="text/xml"
+                          
class="org.apache.axis2.transport.http.SOAPMessageFormatter"/>
+        <messageFormatter contentType="application/soap+xml"
+                          
class="org.apache.axis2.transport.http.SOAPMessageFormatter"/>
+       <!--JSON Message Formatters-->
+        <messageFormatter contentType="application/json"
+                          class="org.apache.axis2.json.JSONMessageFormatter"/>
+        <messageFormatter contentType="application/json/badgerfish"
+                          
class="org.apache.axis2.json.JSONBadgerfishMessageFormatter"/>
+        <messageFormatter contentType="text/javascript"
+                          class="org.apache.axis2.json.JSONMessageFormatter"/>
+    </messageFormatters>
+
+    <!-- ================================================= -->
+    <!-- Message Builders -->
+    <!-- ================================================= -->
+    <!--Following content type to builder mapping can be used to implement 
support for different message -->
+    <!--formats in Axis2. These message formats are expected to be resolved 
based on the content type. -->
+    <messageBuilders>
+        <messageBuilder contentType="application/xml"
+                        
class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
+        <messageBuilder contentType="application/x-www-form-urlencoded"
+                        
class="org.apache.axis2.builder.XFormURLEncodedBuilder"/>
+       <!--JSON Message Builders-->
+        <messageBuilder contentType="application/json"
+                        class="org.apache.axis2.json.JSONOMBuilder"/>
+        <messageBuilder contentType="application/json/badgerfish"
+                        class="org.apache.axis2.json.JSONBadgerfishOMBuilder"/>
+        <messageBuilder contentType="text/javascript"
+                        class="org.apache.axis2.json.JSONOMBuilder"/>
+        <!--Left commented because it adds the depandancy of servlet-api to 
other modules.
+        Please uncomment to Receive messages in multipart/form-data format-->
+        <!--<messageBuilder contentType="multipart/form-data"-->
+        <!--class="org.apache.axis2.builder.MultipartFormDataBuilder"/>-->
+    </messageBuilders>
+
+    <!-- ================================================= -->
+    <!-- Target Resolvers -->
+    <!-- ================================================= -->
+    <!-- Uncomment the following and specify the class name for your 
TargetResolver to add -->
+    <!-- a TargetResolver. TargetResolvers are used to process the To EPR for 
example to -->
+    <!-- choose a server in a cluster -->
+    <!--<targetResolvers>-->
+    <!--<targetResolver class="" />-->
+    <!--</targetResolvers>-->
+
+
+    <!-- ================================================= -->
+    <!-- Transport Ins -->
+    <!-- ================================================= -->
+    <transportReceiver name="http"
+                       
class="org.apache.axis2.transport.http.SimpleHTTPServer">
+        <parameter name="port">6071</parameter>
+        <!--If you want to give your own host address for EPR generation-->
+        <!--uncomment following parameter , and set as you required.-->
+        <!--<parameter name="hostname">http://myApp.com/ws</parameter>-->
+    </transportReceiver>
+
+    <!--Uncomment if you want to have TCP transport support-->
+    <!--<transportReceiver name="tcp"
+                       class="org.apache.axis2.transport.tcp.TCPServer">
+        <parameter name="port">6061</parameter>-->
+    <!--If you want to give your own host address for EPR generation-->
+    <!--uncomment following parameter , and set as you required.-->
+    <!--<parameter name="hostname">tcp://myApp.com/ws</parameter>-->
+    <!--</transportReceiver>-->
+
+    <!-- ================================================= -->
+    <!-- Transport Outs -->
+    <!-- ================================================= -->
+
+    <!--<transportSender name="jms"-->
+    <!--class="org.apache.axis2.transport.jms.JMSSender"/>-->
+    <transportSender name="tcp"
+                     
class="org.apache.axis2.transport.tcp.TCPTransportSender"/>
+    <transportSender name="local"
+                     
class="org.apache.axis2.transport.local.LocalTransportSender"/>
+    <transportSender name="http"
+                     
class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
+        <parameter name="PROTOCOL">HTTP/1.1</parameter>
+        <parameter name="Transfer-Encoding">chunked</parameter>
+        <parameter name="SO_TIMEOUT">60000</parameter>
+        <parameter name="CONNECTION_TIMEOUT">60000</parameter>
+    </transportSender>
+    <transportSender name="https"
+                     
class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
+        <parameter name="PROTOCOL">HTTP/1.1</parameter>
+        <parameter name="Transfer-Encoding">chunked</parameter>
+        <parameter name="SO_TIMEOUT">60000</parameter>
+        <parameter name="CONNECTION_TIMEOUT">60000</parameter>
+    </transportSender>
+    <!--<transportSender name="java"-->
+    <!--class="org.apache.axis2.transport.java.JavaTransportSender"/>-->
+
+
+    <!-- ================================================= -->
+    <!--  SOAP Role Configuration                          -->
+    <!-- ================================================= -->
+    <!-- Use the following pattern to configure this axis2
+         instance to act in particular roles. Note that in
+         the absence of any configuration, Axis2 will act 
+         only in the ultimate receiver role -->
+    <!--
+    <SOAPRoleConfiguration isUltimateReceiver="true">
+       <role>http://my/custom/role</role>
+    </SOAPRoleConfiguration>
+       -->
+
+    <!-- ================================================= -->
+    <!-- Phases  -->
+    <!-- ================================================= -->
+    <phaseOrder type="InFlow">
+        <!--  System pre-defined phases       -->
+        <phase name="Transport">
+            <handler name="RequestURIBasedDispatcher"
+                     
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
+                <order phase="Transport"/>
+            </handler>
+            <handler name="SOAPActionBasedDispatcher"
+                     
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
+                <order phase="Transport"/>
+            </handler>
+        </phase>
+        <phase name="Addressing">
+            <handler name="AddressingBasedDispatcher"
+                     
class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
+                <order phase="Addressing"/>
+            </handler>
+        </phase>
+        <phase name="Security"/>
+        <phase name="PreDispatch"/>
+        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+            <handler name="RequestURIBasedDispatcher"
+                     
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
+            <handler name="SOAPActionBasedDispatcher"
+                     
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
+            <handler name="RequestURIOperationDispatcher"
+                     
class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
+            <handler name="SOAPMessageBodyBasedDispatcher"
+                     
class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
+
+            <handler name="HTTPLocationBasedDispatcher"
+                     
class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
+        </phase>
+        <phase name="RMPhase"/>
+        <!--  System pre defined phases       -->
+        <!--   After Postdispatch phase module author or or service author can 
add any phase he want      -->
+        <phase name="OperationInPhase"/>
+    </phaseOrder>
+    <phaseOrder type="OutFlow">
+        <!--      user can add his own phases to this area  -->
+        <phase name="OperationOutPhase"/>
+        <!--system predefined phase-->
+        <!--these phase will run irrespective of the service-->
+        <phase name="RMPhase"/>
+        <phase name="PolicyDetermination"/>
+        <phase name="MessageOut"/>
+        <phase name="Security"/>
+    </phaseOrder>
+    <phaseOrder type="InFaultFlow">
+        <phase name="Addressing">
+            <handler name="AddressingBasedDispatcher"
+                     
class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
+                <order phase="Addressing"/>
+            </handler>
+        </phase>
+        <phase name="Security"/>
+        <phase name="PreDispatch"/>
+        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+            <handler name="RequestURIBasedDispatcher"
+                     
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
+            <handler name="SOAPActionBasedDispatcher"
+                     
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
+            <handler name="RequestURIOperationDispatcher"
+                     
class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
+            <handler name="SOAPMessageBodyBasedDispatcher"
+                     
class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
+
+            <handler name="HTTPLocationBasedDispatcher"
+                     
class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
+        </phase>
+        <phase name="RMPhase"/>
+        <!--      user can add his own phases to this area  -->
+        <phase name="OperationInFaultPhase"/>
+    </phaseOrder>
+    <phaseOrder type="OutFaultFlow">
+        <!--      user can add his own phases to this area  -->
+        <phase name="OperationOutFaultPhase"/>
+        <phase name="RMPhase"/>
+        <phase name="PolicyDetermination"/>
+        <phase name="MessageOut"/>
+        <phase name="Security"/>
+    </phaseOrder>
+</axisconfig>

http://git-wip-us.apache.org/repos/asf/stratos/blob/958a3100/components/org.apache.stratos.metadata.service/src/main/webapp/metadata-test/META-INF/webapp-classloading.xml
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.metadata.service/src/main/webapp/metadata-test/META-INF/webapp-classloading.xml
 
b/components/org.apache.stratos.metadata.service/src/main/webapp/metadata-test/META-INF/webapp-classloading.xml
new file mode 100644
index 0000000..c62912d
--- /dev/null
+++ 
b/components/org.apache.stratos.metadata.service/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/958a3100/components/org.apache.stratos.metadata.service/src/main/webapp/metadata-test/WEB-INF/cxf-servlet.xml
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.metadata.service/src/main/webapp/metadata-test/WEB-INF/cxf-servlet.xml
 
b/components/org.apache.stratos.metadata.service/src/main/webapp/metadata-test/WEB-INF/cxf-servlet.xml
new file mode 100644
index 0000000..f8b8750
--- /dev/null
+++ 
b/components/org.apache.stratos.metadata.service/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/958a3100/components/org.apache.stratos.metadata.service/src/main/webapp/metadata-test/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.metadata.service/src/main/webapp/metadata-test/WEB-INF/web.xml
 
b/components/org.apache.stratos.metadata.service/src/main/webapp/metadata-test/WEB-INF/web.xml
new file mode 100644
index 0000000..4a752f6
--- /dev/null
+++ 
b/components/org.apache.stratos.metadata.service/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/958a3100/components/org.apache.stratos.metadata.service/src/main/webapp/metadata/META-INF/webapp-classloading.xml
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.metadata.service/src/main/webapp/metadata/META-INF/webapp-classloading.xml
 
b/components/org.apache.stratos.metadata.service/src/main/webapp/metadata/META-INF/webapp-classloading.xml
new file mode 100644
index 0000000..c62912d
--- /dev/null
+++ 
b/components/org.apache.stratos.metadata.service/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/958a3100/components/org.apache.stratos.metadata.service/src/main/webapp/metadata/WEB-INF/cxf-servlet.xml
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.metadata.service/src/main/webapp/metadata/WEB-INF/cxf-servlet.xml
 
b/components/org.apache.stratos.metadata.service/src/main/webapp/metadata/WEB-INF/cxf-servlet.xml
new file mode 100644
index 0000000..7b0c60c
--- /dev/null
+++ 
b/components/org.apache.stratos.metadata.service/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.metadata.service.services.MetaDataAdmin"/>
+    <bean id="basicAuthenticationFilter" 
class="org.apache.stratos.metadata.service.handlers.StratosAuthenticationHandler"/>
+    <bean id="sessionAuthenticationFilter" 
class="org.apache.stratos.metadata.service.handlers.CookieBasedAuthenticationHandler"/>
+    <bean id="authorizationFilter" 
class="org.apache.stratos.metadata.service.handlers.StratosAuthorizingHandler">
+        <property name="securedObject" ref="stratosRestEndpointBean"/>
+    </bean>
+    <bean id="exceptionHandler" 
class="org.apache.stratos.metadata.service.handlers.CustomExceptionMapper"/>
+    <bean id="genericExceptionHandler" 
class="org.apache.stratos.metadata.service.handlers.GenericExceptionMapper"/>
+    <bean id="throwableExceptionHandler" 
class="org.apache.stratos.metadata.service.handlers.CustomThrowableExceptionMapper"/>
+    <!--The below config enables OAuth based authentication/authorization for 
REST API-->
+    <bean id="OAuthFilter" 
class="org.apache.stratos.metadata.service.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/958a3100/components/org.apache.stratos.metadata.service/src/main/webapp/metadata/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.metadata.service/src/main/webapp/metadata/WEB-INF/web.xml
 
b/components/org.apache.stratos.metadata.service/src/main/webapp/metadata/WEB-INF/web.xml
new file mode 100644
index 0000000..a46ee34
--- /dev/null
+++ 
b/components/org.apache.stratos.metadata.service/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/958a3100/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
deleted file mode 100644
index 0ee9a0d..0000000
--- a/components/org.apache.stratos.metadataservice/pom.xml
+++ /dev/null
@@ -1,162 +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.
-  -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
-    <parent>
-        <groupId>org.apache.stratos</groupId>
-        <artifactId>stratos-components-parent</artifactId>
-        <version>4.1.0-SNAPSHOT</version>
-    </parent>
-
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>org.apache.stratos.metadataservice</artifactId>
-    <packaging>war</packaging>
-    <name>Apache Stratos - Meta Data Service</name>
-
-    <profiles>
-        <profile>
-            <id>test</id>
-            <activation>
-                <property>
-                    <name>env</name>
-                    <value>test</value>
-                </property>
-            </activation>
-            <properties>
-                <appName>metadata-test</appName>
-            </properties>
-        </profile>
-        <profile>
-            <id>prod</id>
-            <activation>
-                <activeByDefault>true</activeByDefault>
-            </activation>
-            <properties>
-                <appName>metadata</appName>
-            </properties>
-        </profile>
-    </profiles>
-
-
-    <build>
-        <plugins>
-            <plugin>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <configuration>
-                    <source>1.5</source>
-                    <target>1.5</target>
-                </configuration>
-                <version>2.3.2</version>
-            </plugin>
-            <plugin>
-                <artifactId>maven-war-plugin</artifactId>
-                <version>2.2</version>
-                <configuration>
-                    <webResources>
-                        <resource>
-                            <!-- this is relative to the pom.xml directory -->
-                            <directory>src/main/webapp/${appName}</directory>
-                        </resource>
-                    </webResources>
-                    <warName>metadata</warName>
-                </configuration>
-            </plugin>
-
-        </plugins>
-    </build>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.cxf</groupId>
-            <artifactId>cxf-bundle</artifactId>
-            <version>2.7.7</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.core</artifactId>
-            <version>${wso2carbon.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.utils</artifactId>
-            <version>${wso2carbon.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.identity.oauth.stub</artifactId>
-            <version>${wso2carbon.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.tenant.mgt</artifactId>
-            <version>2.2.2</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.stratos</groupId>
-            <artifactId>org.apache.stratos.common</artifactId>
-            <version>${project.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.stratos</groupId>
-            <artifactId>org.apache.stratos.manager</artifactId>
-            <version>${project.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.stratos</groupId>
-            
<artifactId>org.apache.stratos.cloud.controller.service.stub</artifactId>
-            <version>${project.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.stratos</groupId>
-            <artifactId>org.apache.stratos.autoscaler.service.stub</artifactId>
-            <version>${project.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.stratos</groupId>
-            <artifactId>org.apache.stratos.messaging</artifactId>
-            <version>${project.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.ntask.core</artifactId>
-            <version>${wso2carbon.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.registry.ws.stub</artifactId>
-            <version>${wso2carbon.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>com.nimbusds.wso2</groupId>
-            <artifactId>nimbus-jose-jwt</artifactId>
-            <version>2.26.1.wso2v2</version>
-        </dependency>
-    </dependencies>
-</project>

http://git-wip-us.apache.org/repos/asf/stratos/blob/958a3100/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/Constants.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/Constants.java
 
b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/Constants.java
deleted file mode 100644
index f526d9e..0000000
--- 
a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/Constants.java
+++ /dev/null
@@ -1,28 +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.metadataservice;
-
-/**
- * Global constants used in this module
- */
-public class Constants {
-
-    public static final String METADATASERVICE_CONFIG_FILE_NAME = 
"metadataservice.xml";
-
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/958a3100/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/ServiceHolder.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/ServiceHolder.java
 
b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/ServiceHolder.java
deleted file mode 100644
index f925924..0000000
--- 
a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/ServiceHolder.java
+++ /dev/null
@@ -1,84 +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.metadataservice;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.common.TenantBillingService;
-import org.wso2.carbon.tenant.mgt.core.TenantPersistor;
-import org.wso2.carbon.context.PrivilegedCarbonContext;
-import org.wso2.carbon.registry.core.service.RegistryService;
-import org.wso2.carbon.user.core.service.RealmService;
-import org.wso2.carbon.user.core.tenant.TenantManager;
-import org.wso2.carbon.utils.ConfigurationContextService;
-
-/**
- * Some of the admin services needs objects with states inside the runtime.
- * There are
- * two mechanisms to get those kind of objects. Either with singleton with or
- * via OSGi
- * services. OSGi services mechanism is preferred. This is a helper class for
- * doing that.
- */
-public class ServiceHolder {
-       private static Log log = LogFactory.getLog(ServiceHolder.class);
-
-       public static TenantManager getTenantManager() {
-               PrivilegedCarbonContext carbonContext =
-                                                       
PrivilegedCarbonContext.getThreadLocalCarbonContext();
-               RealmService realmService = (RealmService) 
carbonContext.getOSGiService(RealmService.class);
-               return realmService.getTenantManager();
-       }
-
-       public static TenantBillingService getBillingService() {
-               PrivilegedCarbonContext carbonContext =
-                                                       
PrivilegedCarbonContext.getThreadLocalCarbonContext();
-               TenantBillingService tenantBillingService =
-                                                           
(TenantBillingService) carbonContext.getOSGiService(TenantBillingService.class);
-               return tenantBillingService;
-       }
-
-       public static RealmService getRealmService() {
-               PrivilegedCarbonContext carbonContext =
-                                                       
PrivilegedCarbonContext.getThreadLocalCarbonContext();
-               RealmService realmService = (RealmService) 
carbonContext.getOSGiService(RealmService.class);
-               return realmService;
-       }
-
-       public static RegistryService getRegistryService() {
-               PrivilegedCarbonContext carbonContext =
-                                                       
PrivilegedCarbonContext.getThreadLocalCarbonContext();
-               RegistryService registryService =
-                                                 (RegistryService) 
carbonContext.getOSGiService(RegistryService.class);
-               return registryService;
-       }
-
-       public static TenantPersistor getTenantPersistor() {
-               TenantPersistor tenantPersistor = new TenantPersistor();
-               return tenantPersistor;
-       }
-
-       public static ConfigurationContextService getConfigurationContext() {
-               PrivilegedCarbonContext carbonContext =
-                                                       
PrivilegedCarbonContext.getThreadLocalCarbonContext();
-               ConfigurationContextService configurationContextService =
-                                                                         
(ConfigurationContextService) 
carbonContext.getOSGiService(ConfigurationContextService.class);
-               return configurationContextService;
-       }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/958a3100/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/Utils.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/Utils.java
 
b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/Utils.java
deleted file mode 100644
index 42b100a..0000000
--- 
a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/Utils.java
+++ /dev/null
@@ -1,44 +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.metadataservice;
-
-public class Utils {
-
-       public static String buildMessage(int errorCode, String errorMessage) {
-               String jsonResponse =
-                                     "{\"Error\":{" + " \"errorCode\": \" " + 
errorCode + "\"," +
-                                             " \"errorMessage\": \" " + 
errorMessage + "\"" + "}" + "}";
-               return jsonResponse;
-       }
-
-       public static String buildMessage(String errorMessage) {
-               String jsonResponse =
-                                     "{\"Error\":{" + " \"errorCode\": \" " + 
-1234 + "\"," +
-                                             " \"errorMessage\": \" " + 
errorMessage + "\"" + "}" + "}";
-               return jsonResponse;
-       }
-
-       public static String buildAuthenticationSuccessMessage(String 
jSessionId) {
-               String jsonResponse =
-                                     "{\"Success\":{" + " \"sessionId\": \"" + 
jSessionId + "\"" + "}" +
-                                             "}";
-               return jsonResponse;
-       }
-
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/958a3100/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/annotation/AuthorizationAction.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/annotation/AuthorizationAction.java
 
b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/annotation/AuthorizationAction.java
deleted file mode 100644
index a6c8765..0000000
--- 
a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/annotation/AuthorizationAction.java
+++ /dev/null
@@ -1,36 +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.metadataservice.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Carbon kernel handles permissions by means of permission strings.
- * Permission strings are defined at the operation level. Here the admin
- * service developer has to specify authorization requirements using
- * the below annotation
- */
-@Retention(value = RetentionPolicy.RUNTIME)
-@Target(value = ElementType.METHOD)
-public @interface AuthorizationAction {
-       String[] value();
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/958a3100/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/annotation/SuperTenantService.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/annotation/SuperTenantService.java
 
b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/annotation/SuperTenantService.java
deleted file mode 100644
index 761faa4..0000000
--- 
a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/annotation/SuperTenantService.java
+++ /dev/null
@@ -1,34 +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.metadataservice.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * In Carbon admin authorization framework there are super-tenant only
- * admin services. We use below annotation to mark such admin services.
- */
-@Retention(value = RetentionPolicy.RUNTIME)
-@Target(value = ElementType.METHOD)
-public @interface SuperTenantService {
-       boolean value();
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/958a3100/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/context/AuthenticationContext.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/context/AuthenticationContext.java
 
b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/context/AuthenticationContext.java
deleted file mode 100644
index 7adbff6..0000000
--- 
a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/context/AuthenticationContext.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.apache.stratos.metadataservice.context;
-
-/*
- * 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.
- */
-
-public class AuthenticationContext {
-       // maintaining the authenticated state in threadLocal. We want to skip
-       // subsequent authentication handlers
-       // once a request get authenticated by a handler.
-       private static final ThreadLocal<Boolean> authenticated = new 
ThreadLocal<Boolean>() {
-               @Override
-               protected Boolean initialValue() {
-                       return false;
-               }
-       };
-
-       public static boolean isAthenticated() {
-               return authenticated.get();
-       }
-
-       public static void setAuthenticated(boolean isAuthenticated) {
-               authenticated.set(isAuthenticated);
-       }
-}

Reply via email to