Update meta data service - STRATOS-998
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/7f9afdf7 Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/7f9afdf7 Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/7f9afdf7 Branch: refs/heads/master Commit: 7f9afdf76ddc8594a9c9cc9bb8481e18d39d545f Parents: 861a690 Author: gayan <[email protected]> Authored: Mon Nov 24 19:12:33 2014 +0530 Committer: gayan <[email protected]> Committed: Mon Nov 24 19:12:33 2014 +0530 ---------------------------------------------------------------------- .../metadataservice/registry/CarbonRegistry.java | 14 +++++++++----- .../metadataservice/registry/DataRegistryFactory.java | 2 +- .../metadataservice/services/MetaDataAdmin.java | 5 ++--- .../webapp/stratosmetadataservice/WEB-INF/web.xml | 3 --- 4 files changed, 12 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/7f9afdf7/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 index 89250b3..5c3495d 100644 --- 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 @@ -21,10 +21,13 @@ package org.apache.stratos.metadataservice.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.DataHolder; +import org.apache.stratos.manager.registry.RegistryManager; import org.apache.stratos.metadataservice.definition.NewProperty; import org.wso2.carbon.core.AbstractAdmin; import org.wso2.carbon.registry.api.Registry; import org.wso2.carbon.registry.api.RegistryException; +import org.wso2.carbon.registry.api.RegistryService; import org.wso2.carbon.registry.api.Resource; import javax.servlet.http.HttpServletRequest; @@ -34,9 +37,10 @@ import java.util.*; /** * Carbon registry implementation + * */ -public class CarbonRegistry extends AbstractAdmin implements DataStore { +public class CarbonRegistry implements DataStore { private static Log log = LogFactory.getLog(CarbonRegistry.class); @Context @@ -58,7 +62,7 @@ public class CarbonRegistry extends AbstractAdmin implements DataStore { * @throws RegistryException */ public List<NewProperty> getPropertiesOfCluster(String applicationName, String clusterId) throws RegistryException { - Registry tempRegistry = getGovernanceUserRegistry(); + Registry tempRegistry = DataHolder.getRegistryService().getRegistry(); String resourcePath = mainResource + applicationName + "/" + clusterId; if (!tempRegistry.resourceExists(resourcePath)) { return null; @@ -92,7 +96,7 @@ public class CarbonRegistry extends AbstractAdmin implements DataStore { * @throws RegistryException */ public void addPropertyToCluster(String applicationId, String clusterId, NewProperty property) throws RegistryException { - Registry tempRegistry = getGovernanceUserRegistry(); + Registry tempRegistry = DataHolder.getRegistryService().getRegistry(); String resourcePath = mainResource + applicationId + "/" + clusterId; Resource regResource = createOrGetResourceforCluster(tempRegistry, resourcePath); @@ -112,7 +116,7 @@ public class CarbonRegistry extends AbstractAdmin implements DataStore { if(StringUtils.isEmpty(applicationId)){ throw new IllegalArgumentException("Application ID can not be null"); } - Registry tempRegistry = getGovernanceUserRegistry(); + Registry tempRegistry = DataHolder.getRegistryService().getRegistry(); String resourcePath = mainResource + applicationId; if(tempRegistry.resourceExists(resourcePath)){ @@ -132,7 +136,7 @@ public class CarbonRegistry extends AbstractAdmin implements DataStore { * @throws RegistryException */ public void addPropertiesToCluster(String applicationName, String clusterId, NewProperty[] properties) throws RegistryException { - Registry tempRegistry = getGovernanceUserRegistry(); + Registry tempRegistry = DataHolder.getRegistryService().getRegistry(); String resourcePath = mainResource + applicationName + "/" + clusterId; Resource regResource; regResource = createOrGetResourceforCluster(tempRegistry, resourcePath); http://git-wip-us.apache.org/repos/asf/stratos/blob/7f9afdf7/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 index 2f6a113..71de98c 100644 --- 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 @@ -23,7 +23,7 @@ package org.apache.stratos.metadataservice.registry; */ public class DataRegistryFactory { - public static DataStore getDataRegistryFactory(String registryName) { + public static DataStore getDataStore(String registryName) { if (registryName.equals("greg")) { return new GRegRegistry(); } else if (registryName.equals("carbon")) { http://git-wip-us.apache.org/repos/asf/stratos/blob/7f9afdf7/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 index e88bc2a..fc688f9 100644 --- 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 @@ -43,8 +43,7 @@ public class MetaDataAdmin { UriInfo uriInfo; private static Log log = LogFactory.getLog(MetaDataAdmin.class); - @Context - HttpServletRequest httpServletRequest; + private DataStore registry; @@ -56,7 +55,7 @@ public class MetaDataAdmin { XMLConfiguration conf = ConfUtil.getInstance(null).getConfiguration(); String DEFAULT_REG_TYPE = "carbon"; String registryType = conf.getString("metadataservice.govenanceregistrytype", DEFAULT_REG_TYPE); - registry = DataRegistryFactory.getDataRegistryFactory(registryType); + registry = DataRegistryFactory.getDataStore(registryType); } @GET http://git-wip-us.apache.org/repos/asf/stratos/blob/7f9afdf7/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 index 7929bed..a46ee34 100644 --- 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 @@ -24,9 +24,6 @@ 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>
