http://git-wip-us.apache.org/repos/asf/stratos/blob/a495dc13/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/registry/CarbonRegistry.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/registry/CarbonRegistry.java
 
b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/registry/CarbonRegistry.java
new file mode 100644
index 0000000..7d5acd0
--- /dev/null
+++ 
b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/registry/CarbonRegistry.java
@@ -0,0 +1,187 @@
+/*
+ * 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.registry;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.core.Context;
+
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.metadataservice.definition.CartridgeMetaData;
+import org.apache.stratos.metadataservice.definition.PropertyBean;
+import org.wso2.carbon.core.AbstractAdmin;
+import org.wso2.carbon.registry.api.Registry;
+import org.wso2.carbon.registry.api.Resource;
+import org.wso2.carbon.registry.core.Comment;
+import org.wso2.carbon.registry.core.service.RegistryService;
+
+public class CarbonRegistry extends AbstractAdmin implements DataStore {
+
+       private static Log log = LogFactory.getLog(CarbonRegistry.class);
+       @Context
+       HttpServletRequest httpServletRequest;
+
+       private static ConfigurationContext configContext = null;
+
+       private static String defaultAxis2Repo = "repository/deployment/client";
+       private static String defaultAxis2Conf = 
"repository/conf/axis2/axis2_client.xml";
+
+       private static final String defaultUsername = "[email protected]";
+       private static final String defaultPassword = "admin123";
+       private static final String serverURL = 
"https://localhost:9445/services/";;
+       private static final String mainResource = "/startos/";
+       private static final int defaultRank = 3;
+       private RegistryService registryService;
+
+       public CarbonRegistry() {
+
+       }
+
+       /*
+        * Add the meta data to governance registry
+        * 
+        * @see org.apache.stratos.metadataservice.registry.DataStore#
+        * addCartridgeMetaDataDetails(java.lang.String, java.lang.String,
+        * org.apache.stratos.metadataservice.definition.CartridgeMetaData)
+        */
+       @Override
+       public String addCartridgeMetaDataDetails(String applicationName, 
String cartridgeType,
+                                                 CartridgeMetaData 
cartridgeMetaData) throws Exception {
+               System.out.println("Adding meta data details");
+
+               Registry tempRegistry = getGovernanceUserRegistry();
+               try {
+
+                       Resource resource = tempRegistry.newResource();
+
+                       String type = cartridgeMetaData.type;
+
+                       resource.setContent("Application description :: " + 
type);
+
+                       String resourcePath = mainResource + applicationName + 
"/" + cartridgeType;
+
+                       resource.addProperty("Application Name", 
cartridgeMetaData.applicationName);
+                       resource.addProperty("Display Name", 
cartridgeMetaData.displayName);
+                       resource.addProperty("Description", 
cartridgeMetaData.description);
+                       resource.addProperty("Cartidge Type", 
cartridgeMetaData.type);
+                       resource.addProperty("provider", 
cartridgeMetaData.provider);
+                       resource.addProperty("Version", 
cartridgeMetaData.version);
+                       resource.addProperty("host", cartridgeMetaData.host);
+
+                       for (PropertyBean prop : cartridgeMetaData.property) {
+                               resource.addProperty("hostname", prop.hostname);
+                               resource.addProperty("username", prop.username);
+                               resource.addProperty("password", prop.password);
+                       }
+
+                       tempRegistry.put(resourcePath, resource);
+
+                       System.out.println("A resource added to: " + 
resourcePath);
+
+                       System.out.println(cartridgeMetaData.type);
+                       // registry.rateResource(resourcePath, defaultRank);
+
+                       Comment comment = new Comment();
+                       comment.setText("Added the " + applicationName + " " + 
type + " cartridge");
+                       // registry.addComment(resourcePath, comment);
+
+               } catch (Exception e) {
+
+                       System.out.println(e.getMessage());
+                       e.printStackTrace();
+               } finally {
+                       // Close the session
+
+               }
+               System.out.println("Add meta data details");
+               return "success";
+       }
+
+       /*
+        * Get the meta data from the registry
+        * 
+        * @see org.apache.stratos.metadataservice.registry.DataStore#
+        * getCartridgeMetaDataDetails(java.lang.String, java.lang.String)
+        */
+       @Override
+       public String getCartridgeMetaDataDetails(String applicationName, 
String cartridgeType)
+                                                                               
               throws Exception {
+               Registry registry = getGovernanceUserRegistry();
+               CartridgeMetaData cartridgeMetaData = new CartridgeMetaData();
+               try {
+
+                       String resourcePath = mainResource + applicationName + 
"/" + cartridgeType;
+                       if (registry.resourceExists(resourcePath)) {
+
+                               Resource getResource = 
registry.get(resourcePath);
+                               System.out.println("Resource retrived");
+                               System.out.println("Printing retrieved resource 
content: " +
+                                                  new String((byte[]) 
getResource.getContent()));
+
+                               cartridgeMetaData.type = 
getResource.getProperty("Cartidge Type");
+                               cartridgeMetaData.applicationName = 
getResource.getProperty("Application Name");
+                               cartridgeMetaData.description = 
getResource.getProperty("Description");
+                               cartridgeMetaData.displayName = 
getResource.getProperty("Display Name");
+                               cartridgeMetaData.host = 
getResource.getProperty("host");
+                               cartridgeMetaData.provider = 
getResource.getProperty("provider");
+                               cartridgeMetaData.version = 
getResource.getProperty("Version");
+
+                               List<PropertyBean> lst = new 
ArrayList<PropertyBean>();
+                               PropertyBean prop = new PropertyBean();
+                               prop.hostname = 
getResource.getProperty("hostname");
+                               prop.username = 
getResource.getProperty("username");
+                               prop.password = 
getResource.getProperty("password");
+                               lst.add(prop);
+
+                               cartridgeMetaData.property = lst;
+
+                       }
+
+               } catch (Exception e) {
+
+                       System.out.println(e.getMessage());
+                       e.printStackTrace();
+               } finally {
+                       // Close the session
+
+               }
+               return cartridgeMetaData.toString();
+       }
+
+       /*
+        * 
+        * Remove the meta data from the registry
+        * 
+        * @see org.apache.stratos.metadataservice.registry.DataStore#
+        * removeCartridgeMetaDataDetails(java.lang.String, java.lang.String)
+        */
+       @Override
+       public boolean removeCartridgeMetaDataDetails(String applicationName, 
String cartridgeType)
+                                                                               
                   throws Exception {
+               Registry registry = getGovernanceUserRegistry();
+               String resourcePath = mainResource + applicationName + "/" + 
cartridgeType;
+               registry.delete(resourcePath);
+               return false;
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/a495dc13/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/registry/DataRegistryFactory.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/registry/DataRegistryFactory.java
 
b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/registry/DataRegistryFactory.java
new file mode 100644
index 0000000..25f0053
--- /dev/null
+++ 
b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/registry/DataRegistryFactory.java
@@ -0,0 +1,36 @@
+/*
+ * 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.registry;
+
+/*
+ * Factory for the Data Registry
+ */
+public class DataRegistryFactory {
+
+       public static DataStore getDataRegistryFactory(String registryName) {
+               if (registryName.equals("GREG")) {
+                       return new GRegRegistry();
+               } else if (registryName.equals("OWN")) {
+                       return new CarbonRegistry();
+               } else {
+                       return null;
+               }
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/a495dc13/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/registry/DataStore.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/registry/DataStore.java
 
b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/registry/DataStore.java
new file mode 100644
index 0000000..93302b7
--- /dev/null
+++ 
b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/registry/DataStore.java
@@ -0,0 +1,36 @@
+/*
+ * 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.registry;
+
+import org.apache.stratos.metadataservice.definition.CartridgeMetaData;
+
+/*
+ * Interface of the Data Store
+ */
+public interface DataStore {
+       public String addCartridgeMetaDataDetails(String applicationName, 
String cartridgeType,
+                                                 CartridgeMetaData 
cartridgeMetaData) throws Exception;
+
+       public String getCartridgeMetaDataDetails(String applicationName, 
String cartridgeType)
+                                                                               
               throws Exception;
+
+       public boolean removeCartridgeMetaDataDetails(String applicationName, 
String cartridgeType)
+                                                                               
                   throws Exception;
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/a495dc13/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/registry/GRegRegistry.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/registry/GRegRegistry.java
 
b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/registry/GRegRegistry.java
new file mode 100644
index 0000000..080fc60
--- /dev/null
+++ 
b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/registry/GRegRegistry.java
@@ -0,0 +1,220 @@
+/*
+ * 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.registry;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.core.Context;
+
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.commons.configuration.XMLConfiguration;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.metadataservice.definition.CartridgeMetaData;
+import org.apache.stratos.metadataservice.definition.PropertyBean;
+import org.apache.stratos.metadataservice.util.ConfUtil;
+import org.wso2.carbon.registry.api.Registry;
+import org.wso2.carbon.registry.api.Resource;
+import org.wso2.carbon.registry.core.Comment;
+import org.wso2.carbon.registry.ws.client.registry.WSRegistryServiceClient;
+
+/**
+ * 
+ * Governance registry implementation for the registry factory
+ * 
+ */
+public class GRegRegistry implements DataStore {
+
+       private static Log log = LogFactory.getLog(GRegRegistry.class);
+       @Context
+       HttpServletRequest httpServletRequest;
+
+       private static ConfigurationContext configContext = null;
+
+       private static String defaultAxis2Repo = "repository/deployment/client";
+       private static String defaultAxis2Conf = 
"repository/conf/axis2/axis2_client.xml";
+
+       private static final String defaultUsername = "[email protected]";
+       private static final String defaultPassword = "admin123";
+       private static final String serverURL = 
"https://localhost:9445/services/";;
+       private static final String mainResource = "/startos/";
+       private static final int defaultRank = 3;
+
+       /*
+        * Registry initiation
+        */
+       private static WSRegistryServiceClient setRegistry() throws Exception {
+
+               XMLConfiguration conf = 
ConfUtil.getInstance(null).getConfiguration();
+
+               String gregUsername = 
conf.getString("metadataservice.username", defaultUsername);
+               String gregPassword = 
conf.getString("metadataservice.password", defaultPassword);
+               String gregServerURL = 
conf.getString("metadataservice.serverurl", serverURL);
+               String axis2Repo = conf.getString("metadataservice.axis2Repo", 
defaultAxis2Repo);
+               String axis2Conf = conf.getString("metadataservice.axis2Conf", 
defaultAxis2Conf);
+               String defaultTrustStore =
+                                          "repository" + File.separator + 
"resources" + File.separator +
+                                                  "security" + File.separator 
+ "wso2carbon.jks";
+               String trustStorePath = 
conf.getString("metadataservice.trustStore", defaultTrustStore);
+               String trustStorePassword =
+                                           
conf.getString("metadataservice.trustStorePassword",
+                                                          "wso2carbon");
+               String trustStoreType = 
conf.getString("metadataservice.trustStoreType", "JKS");
+
+               System.setProperty("javax.net.ssl.trustStore", trustStorePath);
+               System.setProperty("javax.net.ssl.trustStorePassword", 
trustStorePassword);// "wso2carbon"
+               System.setProperty("javax.net.ssl.trustStoreType", 
trustStoreType);// "JKS"
+               System.setProperty("carbon.repo.write.mode", "true");
+               configContext =
+                               
ConfigurationContextFactory.createConfigurationContextFromFileSystem(axis2Repo,
+                                                                               
                     axis2Conf);
+               return new WSRegistryServiceClient(gregServerURL, gregUsername, 
gregPassword, configContext);
+       }
+
+       /*
+        * Add the meta data to governance registry
+        * 
+        * @see org.apache.stratos.metadataservice.registry.DataStore#
+        * addCartridgeMetaDataDetails(java.lang.String, java.lang.String,
+        * org.apache.stratos.metadataservice.definition.CartridgeMetaData)
+        */
+       @Override
+       public String addCartridgeMetaDataDetails(String applicationName, 
String cartridgeType,
+                                                 CartridgeMetaData 
cartridgeMetaData) throws Exception {
+               System.out.println("Adding meta data details");
+               Registry registry = setRegistry();
+               try {
+
+                       Resource resource = registry.newResource();
+
+                       String type = cartridgeMetaData.type;
+
+                       resource.setContent("Application description :: " + 
type);
+
+                       String resourcePath = mainResource + applicationName + 
"/" + cartridgeType;
+
+                       resource.addProperty("Application Name", 
cartridgeMetaData.applicationName);
+                       resource.addProperty("Display Name", 
cartridgeMetaData.displayName);
+                       resource.addProperty("Description", 
cartridgeMetaData.description);
+                       resource.addProperty("Cartidge Type", 
cartridgeMetaData.type);
+                       resource.addProperty("provider", 
cartridgeMetaData.provider);
+                       resource.addProperty("Version", 
cartridgeMetaData.version);
+                       resource.addProperty("host", cartridgeMetaData.host);
+
+                       for (PropertyBean prop : cartridgeMetaData.property) {
+                               resource.addProperty("hostname", prop.hostname);
+                               resource.addProperty("username", prop.username);
+                               resource.addProperty("password", prop.password);
+                       }
+
+                       registry.put(resourcePath, resource);
+
+                       System.out.println("A resource added to: " + 
resourcePath);
+
+                       System.out.println(cartridgeMetaData.type);
+                       registry.rateResource(resourcePath, defaultRank);
+
+                       Comment comment = new Comment();
+                       comment.setText("Added the " + applicationName + " " + 
type + " cartridge");
+                       registry.addComment(resourcePath, comment);
+
+               } catch (Exception e) {
+
+                       System.out.println(e.getMessage());
+                       e.printStackTrace();
+               } finally {
+                       // Close the session
+                       ((WSRegistryServiceClient) registry).logut();
+               }
+               System.out.println("Add meta data details");
+               return "success";
+       }
+
+       /*
+        * Get the meta data from the registry
+        * 
+        * @see org.apache.stratos.metadataservice.registry.DataStore#
+        * getCartridgeMetaDataDetails(java.lang.String, java.lang.String)
+        */
+       @Override
+       public String getCartridgeMetaDataDetails(String applicationName, 
String cartridgeType)
+                                                                               
               throws Exception {
+               Registry registry = setRegistry();
+               CartridgeMetaData cartridgeMetaData = new CartridgeMetaData();
+               try {
+
+                       String resourcePath = mainResource + applicationName + 
"/" + cartridgeType;
+                       if (registry.resourceExists(resourcePath)) {
+
+                               Resource getResource = 
registry.get(resourcePath);
+                               System.out.println("Resource retrived");
+                               System.out.println("Printing retrieved resource 
content: " +
+                                                  new String((byte[]) 
getResource.getContent()));
+
+                               cartridgeMetaData.type = 
getResource.getProperty("Cartidge Type");
+                               cartridgeMetaData.applicationName = 
getResource.getProperty("Application Name");
+                               cartridgeMetaData.description = 
getResource.getProperty("Description");
+                               cartridgeMetaData.displayName = 
getResource.getProperty("Display Name");
+                               cartridgeMetaData.host = 
getResource.getProperty("host");
+                               cartridgeMetaData.provider = 
getResource.getProperty("provider");
+                               cartridgeMetaData.version = 
getResource.getProperty("Version");
+
+                               List<PropertyBean> lst = new 
ArrayList<PropertyBean>();
+                               PropertyBean prop = new PropertyBean();
+                               prop.hostname = 
getResource.getProperty("hostname");
+                               prop.username = 
getResource.getProperty("username");
+                               prop.password = 
getResource.getProperty("password");
+                               lst.add(prop);
+
+                               cartridgeMetaData.property = lst;
+
+                       }
+
+               } catch (Exception e) {
+
+                       System.out.println(e.getMessage());
+                       e.printStackTrace();
+               } finally {
+                       // Close the session
+                       ((WSRegistryServiceClient) registry).logut();
+               }
+               return cartridgeMetaData.toString();
+       }
+
+       /*
+        * 
+        * Remove the meta data from the registry
+        * 
+        * @see org.apache.stratos.metadataservice.registry.DataStore#
+        * removeCartridgeMetaDataDetails(java.lang.String, java.lang.String)
+        */
+       @Override
+       public boolean removeCartridgeMetaDataDetails(String applicationName, 
String cartridgeType)
+                                                                               
                   throws Exception {
+               Registry registry = setRegistry();
+               String resourcePath = mainResource + applicationName + "/" + 
cartridgeType;
+               registry.delete(resourcePath);
+               return false;
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/a495dc13/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/security/StratosPrincipal.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/security/StratosPrincipal.java
 
b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/security/StratosPrincipal.java
new file mode 100644
index 0000000..b0be94a
--- /dev/null
+++ 
b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/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.metadataservice.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/a495dc13/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/security/StratosSecurityContext.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/security/StratosSecurityContext.java
 
b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/security/StratosSecurityContext.java
new file mode 100644
index 0000000..5cc64f3
--- /dev/null
+++ 
b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/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.metadataservice.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/a495dc13/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/services/MetaDataAdmin.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/services/MetaDataAdmin.java
 
b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/services/MetaDataAdmin.java
new file mode 100644
index 0000000..e30ffec
--- /dev/null
+++ 
b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/services/MetaDataAdmin.java
@@ -0,0 +1,87 @@
+package org.apache.stratos.metadataservice.services;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+
+import org.apache.commons.configuration.XMLConfiguration;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.metadataservice.annotation.AuthorizationAction;
+import org.apache.stratos.metadataservice.definition.CartridgeMetaData;
+import org.apache.stratos.metadataservice.exception.RestAPIException;
+import org.apache.stratos.metadataservice.registry.DataRegistryFactory;
+import org.apache.stratos.metadataservice.util.ConfUtil;
+
+@Path("/metadataservice/")
+public class MetaDataAdmin {
+
+       private static Log log = LogFactory.getLog(MetaDataAdmin.class);
+       @Context
+       HttpServletRequest httpServletRequest;
+
+       private final String defaultRegType = "GREG";
+
+       private XMLConfiguration conf;
+
+       @POST
+       @Path("/init")
+       @AuthorizationAction("/permission/protected/manage/monitor/tenants")
+       public void initialize() throws RestAPIException {
+               conf = ConfUtil.getInstance(null).getConfiguration();
+       }
+
+       @POST
+       @Path("/cartridge/metadata/{applicationname}/{cartridgetype}")
+       @Produces("application/json")
+       @Consumes("application/json")
+       @AuthorizationAction("/permission/protected/manage/monitor/tenants")
+       public String addCartridgeMetaDataDetails(@PathParam("applicationname") 
String applicationName,
+                                                 @PathParam("cartridgetype") 
String cartridgeType,
+                                                 CartridgeMetaData 
cartridgeMetaData) throws Exception {
+
+               conf = ConfUtil.getInstance(null).getConfiguration();
+
+               String registryType =
+                                     
conf.getString("metadataservice.govenanceregistrytype",
+                                                    defaultRegType);
+               return DataRegistryFactory.getDataRegistryFactory(registryType)
+                                         
.addCartridgeMetaDataDetails(applicationName, cartridgeType,
+                                                                      
cartridgeMetaData);
+
+       }
+
+       @GET
+       @Path("/cartridge/metadata/{applicationname}/{cartridgetype}")
+       @Produces("application/json")
+       @Consumes("application/json")
+       @AuthorizationAction("/permission/protected/manage/monitor/tenants")
+       public String getCartridgeMetaDataDetails(@PathParam("applicationname") 
String applicationName,
+                                                 @PathParam("cartridgetype") 
String cartridgeType)
+
+       throws Exception {
+               conf = ConfUtil.getInstance(null).getConfiguration();
+               String registryType =
+                                     
conf.getString("metadataservice.govenanceregistrytype",
+                                                    defaultRegType);
+               return DataRegistryFactory.getDataRegistryFactory(registryType)
+                                         
.getCartridgeMetaDataDetails(applicationName, cartridgeType);
+
+       }
+
+       public boolean removeCartridgeMetaDataDetails(String applicationName, 
String cartridgeType)
+                                                                               
                   throws Exception {
+               conf = ConfUtil.getInstance(null).getConfiguration();
+               String registryType =
+                                     
conf.getString("metadataservice.govenanceregistrytype",
+                                                    defaultRegType);
+               return DataRegistryFactory.getDataRegistryFactory(registryType)
+                                         
.removeCartridgeMetaDataDetails(applicationName, cartridgeType);
+
+       }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/a495dc13/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/util/ConfUtil.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/util/ConfUtil.java
 
b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/util/ConfUtil.java
new file mode 100644
index 0000000..bbe2078
--- /dev/null
+++ 
b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/util/ConfUtil.java
@@ -0,0 +1,74 @@
+/*
+ * 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.util;
+
+import java.io.File;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.XMLConfiguration;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.metadataservice.Constants;
+import org.wso2.carbon.utils.CarbonUtils;
+
+/**
+ * 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.info("Loading configuration.....");
+               try {
+
+                       File confFile;
+                       if (configFilePath != null && 
!configFilePath.isEmpty()) {
+                               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/a495dc13/components/org.apache.stratos.metadataservice/src/main/resources/axis2_client.xml
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.metadataservice/src/main/resources/axis2_client.xml
 
b/components/org.apache.stratos.metadataservice/src/main/resources/axis2_client.xml
new file mode 100644
index 0000000..db07954
--- /dev/null
+++ 
b/components/org.apache.stratos.metadataservice/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/a495dc13/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
new file mode 100644
index 0000000..c62912d
--- /dev/null
+++ 
b/components/org.apache.stratos.metadataservice/src/main/webapp/stratosmetadataservice-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/a495dc13/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
new file mode 100644
index 0000000..f8b8750
--- /dev/null
+++ 
b/components/org.apache.stratos.metadataservice/src/main/webapp/stratosmetadataservice-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/a495dc13/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
new file mode 100644
index 0000000..4a752f6
--- /dev/null
+++ 
b/components/org.apache.stratos.metadataservice/src/main/webapp/stratosmetadataservice-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/a495dc13/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
new file mode 100644
index 0000000..c62912d
--- /dev/null
+++ 
b/components/org.apache.stratos.metadataservice/src/main/webapp/stratosmetadataservice/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/a495dc13/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
new file mode 100644
index 0000000..bf40055
--- /dev/null
+++ 
b/components/org.apache.stratos.metadataservice/src/main/webapp/stratosmetadataservice/WEB-INF/cxf-servlet.xml
@@ -0,0 +1,79 @@
+<?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="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="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/a495dc13/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
new file mode 100644
index 0000000..7929bed
--- /dev/null
+++ 
b/components/org.apache.stratos.metadataservice/src/main/webapp/stratosmetadataservice/WEB-INF/web.xml
@@ -0,0 +1,42 @@
+<?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>
+       <listener>  
+          
<listener-class>org.apache.stratos.metadataservice.listener.TopologyListener</listener-class>
  
+    </listener>  
+    <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/a495dc13/features/manager/metadataservice/org.apache.stratos.metadataservice.feature/pom.xml
----------------------------------------------------------------------
diff --git 
a/features/manager/metadataservice/org.apache.stratos.metadataservice.feature/pom.xml
 
b/features/manager/metadataservice/org.apache.stratos.metadataservice.feature/pom.xml
new file mode 100644
index 0000000..f12fed0
--- /dev/null
+++ 
b/features/manager/metadataservice/org.apache.stratos.metadataservice.feature/pom.xml
@@ -0,0 +1,320 @@
+<?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.
+-->
+
+<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-manager-features</artifactId>
+        <version>4.0.0</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>org.apache.stratos.metadataservice.feature</artifactId>
+    <packaging>pom</packaging>
+    <name>Apache Stratos - Meta Data Service feature</name>
+    <description>This feature packs the Meta Data Service of 
stratos</description>
+
+    <dependencies>
+        <!--CXF runtime environment-->
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-bundle</artifactId>
+            <version>2.7.6</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf.xjcplugins</groupId>
+            <artifactId>cxf-xjc-dv</artifactId>
+            <version>2.6.2</version>
+        </dependency>
+        <dependency>
+          <groupId>commons-lang</groupId>
+          <artifactId>commons-lang</artifactId>
+          <version>2.6</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf.xjc-utils</groupId>
+            <artifactId>cxf-xjc-runtime</artifactId>
+            <version>2.6.2</version>
+        </dependency>
+        <dependency>
+          <groupId>org.apache.velocity</groupId>
+          <artifactId>velocity</artifactId>
+          <version>1.7</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf.xjcplugins</groupId>
+            <artifactId>cxf-xjc-ts</artifactId>
+            <version>2.6.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf.xjcplugins</groupId>
+            <artifactId>cxf-xjc-boolean</artifactId>
+            <version>2.6.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf.xjcplugins</groupId>
+            <artifactId>cxf-xjc-bug671</artifactId>
+            <version>2.6.2</version>
+        </dependency>
+        <dependency>
+            <groupId>net.sf.ehcache</groupId>
+            <artifactId>ehcache-core</artifactId>
+            <version>2.5.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpasyncclient</artifactId>
+            <version>4.0-beta3</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+            <version>4.2.5</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpcore</artifactId>
+            <version>4.2.4</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpcore-nio</artifactId>
+            <version>4.2.4</version>
+        </dependency>
+        <dependency>
+            <groupId>javax.ws.rs</groupId>
+            <artifactId>javax.ws.rs-api</artifactId>
+            <version>2.0-m10</version>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.xml.bind</groupId>
+            <artifactId>jaxb-impl</artifactId>
+            <version>2.1.13</version>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.xml.bind</groupId>
+            <artifactId>jaxb-xjc</artifactId>
+            <version>2.1.13</version>
+        </dependency>
+        <dependency>
+            <groupId>org.codehaus.woodstox</groupId>
+            <artifactId>woodstox-core-asl</artifactId>
+            <version>4.2.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.codehaus.woodstox</groupId>
+            <artifactId>stax2-api</artifactId>
+            <version>3.1.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.codehaus.jettison</groupId>
+            <artifactId>jettison</artifactId>
+            <version>1.3.4</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.neethi</groupId>
+            <artifactId>neethi</artifactId>
+            <version>3.0.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.ws.security</groupId>
+            <artifactId>wss4j</artifactId>
+            <version>1.6.11</version>
+        </dependency>
+        <dependency>
+            <groupId>xml-resolver</groupId>
+            <artifactId>xml-resolver</artifactId>
+            <version>1.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.ws.xmlschema</groupId>
+            <artifactId>xmlschema-core</artifactId>
+            <version>2.0.3</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.santuario</groupId>
+            <artifactId>xmlsec</artifactId>
+            <version>1.5.5</version>
+        </dependency>
+        <dependency>
+            <groupId>wsdl4j</groupId>
+            <artifactId>wsdl4j</artifactId>
+            <version>1.6.3</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+            <version>1.1.1</version>
+        </dependency>
+        <dependency>
+          <groupId>commons-collections</groupId>
+          <artifactId>commons-collections</artifactId>
+          <version>3.2.1</version>
+        </dependency>
+        <dependency>
+          <groupId>aopalliance</groupId>
+          <artifactId>aopalliance</artifactId>
+          <version>1.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-aop</artifactId>
+            <version>3.0.7.RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-asm</artifactId>
+            <version>3.0.7.RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-beans</artifactId>
+            <version>3.0.7.RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
+            <version>3.0.7.RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-core</artifactId>
+            <version>3.0.7.RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-expression</artifactId>
+            <version>3.0.7.RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-web</artifactId>
+            <version>3.0.7.RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>org.wso2.carbon.webapp.ext</groupId>
+            <artifactId>carbon-cxf</artifactId>
+            <version>1.0.0</version>
+        </dependency>
+         <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.registry.ws.client</artifactId>
+            <version>4.2.0</version>
+        </dependency>
+         <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.registry.ws.stub</artifactId>
+            <version>4.2.0</version>
+        </dependency>
+        
+        
+        <!--dependency>
+            <groupId>org.apache.stratos</groupId>
+            <artifactId>org.apache.stratos.autoscaler.service.stub</artifactId>
+            <version>${project.version}</version>
+        </dependency-->
+    </dependencies>
+
+    <build>
+        <resources>
+            <resource>
+                <directory>${project.build.directory}/runtime/</directory>
+            </resource>
+            <resource>
+                <directory>${project.build.directory}/web-app/</directory>
+            </resource>
+           <resource>
+                <directory>src/main/resources</directory>
+            </resource>
+        </resources>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>copy-dependencies</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>copy-dependencies</goal>
+                        </goals>
+                        <configuration>
+                            
<outputDirectory>${project.build.directory}/runtime/cxf</outputDirectory>
+                           <excludeTransitive>true</excludeTransitive>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>pack-REST-webapp</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>copy</goal>
+                        </goals>
+                        <configuration>
+                            <artifactItems>
+                                <artifactItem>
+                                    <groupId>org.apache.stratos</groupId>
+                                    
<artifactId>org.apache.stratos.metadataservice</artifactId>
+                                    <version>${project.version}</version>
+                                    <type>war</type>
+                                    <overWrite>true</overWrite>
+                                    
<outputDirectory>${project.build.directory}/web-app/web-app</outputDirectory>
+                                    
<destFileName>stratosmetadataservice.war</destFileName>
+                                </artifactItem>
+                            </artifactItems>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.wso2.maven</groupId>
+                <artifactId>carbon-p2-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>p2-feature-generation</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>p2-feature-gen</goal>
+                        </goals>
+                        <configuration>
+                            <id>org.apache.stratos.metadataservice</id>
+                            
<propertiesFile>../../etc/feature.properties</propertiesFile>
+                            <adviceFile>
+                                <properties>
+                                    
<propertyDef>org.wso2.carbon.p2.category.type:server</propertyDef>
+                                    
<propertyDef>org.eclipse.equinox.p2.type.group:false</propertyDef>
+                                </properties>
+                            </adviceFile>
+                           <bundles>
+                               
<bundleDef>org.apache.stratos:org.apache.stratos.manager.stub:${project.version}</bundleDef>
+                           </bundles>
+                            <importFeatures>
+                                
<importFeatureDef>org.wso2.carbon.core:${wso2carbon.version}</importFeatureDef>
+                            </importFeatures>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/stratos/blob/a495dc13/features/manager/metadataservice/org.apache.stratos.metadataservice.feature/src/main/resources/p2.inf
----------------------------------------------------------------------
diff --git 
a/features/manager/metadataservice/org.apache.stratos.metadataservice.feature/src/main/resources/p2.inf
 
b/features/manager/metadataservice/org.apache.stratos.metadataservice.feature/src/main/resources/p2.inf
new file mode 100644
index 0000000..13f9684
--- /dev/null
+++ 
b/features/manager/metadataservice/org.apache.stratos.metadataservice.feature/src/main/resources/p2.inf
@@ -0,0 +1,23 @@
+# 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.
+
+instructions.configure = \
+org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.apache.stratos.metadataservice_${feature.version}/cxf,target:${installFolder}/../../../lib/runtimes/cxf,overwrite:true);\
+org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.apache.stratos.metadataservice_${feature.version}/web-app/stratosmetadataservice.war,target:${installFolder}/../../deployment/server/webapps/stratosmetadataservice.war,overwrite:true);\
+org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.apache.stratos.metadataservice_${feature.version}/tomcat/webapp-classloading.xml,target:${installFolder}/../../conf/tomcat/webapp-classloading.xml,overwrite:true);\
+org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.apache.stratos.metadataservice_${feature.version}/tomcat/webapp-classloading-environments.xml,target:${installFolder}/../../conf/tomcat/webapp-classloading-environments.xml,overwrite:true);\
+org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.apache.stratos.metadataservice_${feature.version}/tomcat/context.xml,target:${installFolder}/../../conf/tomcat/context.xml,overwrite:true);\

http://git-wip-us.apache.org/repos/asf/stratos/blob/a495dc13/features/manager/metadataservice/org.apache.stratos.metadataservice.feature/src/main/resources/tomcat/context.xml
----------------------------------------------------------------------
diff --git 
a/features/manager/metadataservice/org.apache.stratos.metadataservice.feature/src/main/resources/tomcat/context.xml
 
b/features/manager/metadataservice/org.apache.stratos.metadataservice.feature/src/main/resources/tomcat/context.xml
new file mode 100644
index 0000000..a85c9af
--- /dev/null
+++ 
b/features/manager/metadataservice/org.apache.stratos.metadataservice.feature/src/main/resources/tomcat/context.xml
@@ -0,0 +1,36 @@
+<?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.
+-->
+<!-- The contents of this file will be loaded for each web application -->
+<Context crossContext="true">
+
+    <!-- Default set of monitored resources -->
+
+    <Loader className="org.wso2.carbon.webapp.mgt.loader.CarbonWebappLoader" 
loaderClass="org.wso2.carbon.webapp.mgt.loader.CarbonWebappClassLoader"/>
+
+    <!-- Uncomment this to disable session persistence across Tomcat restarts 
-->
+    <!--
+    <Manager pathname="" />
+    -->
+
+    <!-- Uncomment this to enable Comet connection tacking (provides events
+         on session expiration as well as webapp lifecycle) -->
+    <!--
+    <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" 
/>
+    -->
+
+</Context>

Reply via email to