From 2ff2c6db72359addb323bafd3b15e855e817e468 Mon Sep 17 00:00:00 2001 From: gayan Date: Wed, 8 Oct 2014 14:23:30 +0530 Subject: [PATCH 1/6] Meta data service refactoring --- .../definition/CartridgeMetaData.java | 15 +- .../definition/NewProperty.java | 4 +- .../listener/TopologyAgent.java | 25 +- .../listener/TopologyListener.java | 111 ++----- .../registry/CarbonRegistry.java | 294 ++++++++---------- .../metadataservice/registry/DataStore.java | 2 +- .../registry/GRegRegistry.java | 12 +- .../services/MetaDataAdmin.java | 187 +++++++---- .../src/main/conf/metadataservice.xml | 2 +- .../all/repository/conf/metadataservice.xml | 2 +- 10 files changed, 309 insertions(+), 345 deletions(-) diff --git a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/definition/CartridgeMetaData.java b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/definition/CartridgeMetaData.java index fbe15ba9e1..1875434b20 100644 --- a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/definition/CartridgeMetaData.java +++ b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/definition/CartridgeMetaData.java @@ -1,6 +1,8 @@ package org.apache.stratos.metadataservice.definition; +import java.util.HashMap; import java.util.List; +import java.util.Map; import javax.xml.bind.annotation.XmlRootElement; @@ -20,24 +22,15 @@ public class CartridgeMetaData { public String version; - public List properties; + public String properties; @Override public String toString() { return "applicationName: " + applicationName + ", displayName: " + displayName + ", description: " + description + ", type: " + type + ", provider: " + provider + - ", host: " + host + ", Version: " + version + ", properties: " + getProperties(); + ", host: " + host + ", Version: " + version + ", properties: " + properties; } - private String getProperties() { - StringBuilder propertyBuilder = new StringBuilder(); - if (properties != null) { - for (PropertyBean propertyBean : properties) { - propertyBuilder.append(propertyBean.toString()); - } - } - return propertyBuilder.toString(); - } } diff --git a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/definition/NewProperty.java b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/definition/NewProperty.java index 552d29f791..73f75d9773 100644 --- a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/definition/NewProperty.java +++ b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/definition/NewProperty.java @@ -30,8 +30,8 @@ @XmlRootElement(name="properties") public class NewProperty implements Serializable{ - private String key; - private List values = new ArrayList(); + public String key; + public List values = new ArrayList(); public NewProperty(){} public NewProperty(String key, String value){ diff --git a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/listener/TopologyAgent.java b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/listener/TopologyAgent.java index 8e3936489c..6c55f1568d 100644 --- a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/listener/TopologyAgent.java +++ b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/listener/TopologyAgent.java @@ -1,5 +1,3 @@ -package org.apache.stratos.metadataservice.listener; - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,6 +18,9 @@ * under the License. */ +package org.apache.stratos.metadataservice.listener; + +import org.apache.commons.configuration.XMLConfiguration; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.stratos.messaging.event.Event; @@ -29,7 +30,8 @@ import org.apache.stratos.messaging.listener.topology.MemberTerminatedEventListener; import org.apache.stratos.messaging.message.receiver.topology.TopologyEventReceiver; import org.apache.stratos.messaging.message.receiver.topology.TopologyManager; -import org.apache.stratos.metadataservice.services.MetaDataAdmin; +import org.apache.stratos.metadataservice.registry.DataRegistryFactory; +import org.apache.stratos.metadataservice.util.ConfUtil; /** * Cartridge agent runnable. @@ -38,7 +40,6 @@ public class TopologyAgent implements Runnable { private static final Log log = LogFactory.getLog(TopologyAgent.class); - private boolean terminated; @Override public void run() { @@ -51,10 +52,21 @@ public void run() { } - protected void registerTopologyEventListeners() { + private void registerTopologyEventListeners() { + final String defaultRegType = "carbon"; + + XMLConfiguration conf; + log.info("==================Starting topology event message receiver thread================="); if (log.isDebugEnabled()) { log.debug("Starting topology event message receiver thread"); } + conf = ConfUtil.getInstance(null).getConfiguration(); + + final String registryType = + conf.getString("metadataservice.govenanceregistrytype", + defaultRegType); + + TopologyEventReceiver topologyEventReceiver = new TopologyEventReceiver(); topologyEventReceiver.addEventListener(new MemberTerminatedEventListener() { @@ -71,7 +83,7 @@ protected void onEvent(Event event) { log.debug("Terminated event :::::::::::::::::::: " + memberTerminatedEvent.getServiceName()); } - new MetaDataAdmin().removeCartridgeMetaDataDetails("appA", "php"); + DataRegistryFactory.getDataRegistryFactory(registryType).removeCartridgeMetaDataDetails("appA", "php"); } catch (Exception e) { if (log.isErrorEnabled()) { @@ -93,6 +105,7 @@ protected void onEvent(Event event) { log.debug("Member suspended event received"); } MemberSuspendedEvent memberSuspendedEvent = (MemberSuspendedEvent) event; + //TODO : Add the funtionalilty for the suspended event // extensionHandler.onMemberSuspendedEvent(memberSuspendedEvent); } catch (Exception e) { if (log.isErrorEnabled()) { diff --git a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/listener/TopologyListener.java b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/listener/TopologyListener.java index fbca388a94..bd6e750cd8 100644 --- a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/listener/TopologyListener.java +++ b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/listener/TopologyListener.java @@ -1,3 +1,24 @@ +/* + * + * 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.listener; import javax.servlet.ServletContextEvent; @@ -5,16 +26,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.stratos.messaging.event.Event; -import org.apache.stratos.messaging.event.topology.MemberStartedEvent; -import org.apache.stratos.messaging.event.topology.MemberSuspendedEvent; -import org.apache.stratos.messaging.event.topology.MemberTerminatedEvent; -import org.apache.stratos.messaging.listener.topology.MemberStartedEventListener; -import org.apache.stratos.messaging.listener.topology.MemberSuspendedEventListener; -import org.apache.stratos.messaging.listener.topology.MemberTerminatedEventListener; -import org.apache.stratos.messaging.message.receiver.topology.TopologyEventReceiver; -import org.apache.stratos.messaging.message.receiver.topology.TopologyManager; -import org.apache.stratos.metadataservice.services.MetaDataAdmin; public class TopologyListener implements ServletContextListener { @@ -40,87 +51,11 @@ public void contextInitialized(ServletContextEvent arg0) { } @Override - public void contextDestroyed(ServletContextEvent arg0) { + public void contextDestroyed(ServletContextEvent arg0) + { thread.stop(); } - protected void registerTopologyEventListeners() { - if (log.isDebugEnabled()) { - log.debug("Starting topology event message receiver thread"); - } - TopologyEventReceiver topologyEventReceiver = new TopologyEventReceiver(); - - topologyEventReceiver.addEventListener(new MemberTerminatedEventListener() { - @Override - protected void onEvent(Event event) { - try { - TopologyManager.acquireReadLock(); - if (log.isDebugEnabled()) { - log.debug("Member terminated event received"); - } - MemberTerminatedEvent memberTerminatedEvent = (MemberTerminatedEvent) event; - if(log.isDebugEnabled()){ - log.info("Terminated event :::::::::::::::::::: " + - memberTerminatedEvent.getServiceName()); - } - new MetaDataAdmin().removeCartridgeMetaDataDetails("appA", "php"); - // extensionHandler.onMemberTerminatedEvent(memberTerminatedEvent); - } catch (Exception e) { - if (log.isErrorEnabled()) { - log.error("Error processing member terminated event", e); - } - } finally { - TopologyManager.releaseReadLock(); - } - } - }); - - topologyEventReceiver.addEventListener(new MemberSuspendedEventListener() { - @Override - protected void onEvent(Event event) { - try { - TopologyManager.acquireReadLock(); - if (log.isDebugEnabled()) { - log.debug("Member suspended event received"); - } - MemberSuspendedEvent memberSuspendedEvent = (MemberSuspendedEvent) event; - // extensionHandler.onMemberSuspendedEvent(memberSuspendedEvent); - } catch (Exception e) { - if (log.isErrorEnabled()) { - log.error("Error processing member suspended event", e); - } - } finally { - TopologyManager.releaseReadLock(); - } - } - }); - - topologyEventReceiver.addEventListener(new MemberStartedEventListener() { - @Override - protected void onEvent(Event event) { - try { - TopologyManager.acquireReadLock(); - if (log.isDebugEnabled()) { - log.debug("Member started event received"); - } - MemberStartedEvent memberStartedEvent = (MemberStartedEvent) event; - // extensionHandler.onMemberStartedEvent(memberStartedEvent); - } catch (Exception e) { - if (log.isErrorEnabled()) { - log.error("Error processing member started event", e); - } - } finally { - TopologyManager.releaseReadLock(); - } - } - }); - - Thread thread = new Thread(topologyEventReceiver); - thread.start(); - if (log.isDebugEnabled()) { - log.info("Cartridge Agent topology receiver thread started"); - } - } } 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 98377c42f3..9e74ce0904 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 @@ -23,7 +23,8 @@ 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.*; @@ -32,152 +33,122 @@ import org.wso2.carbon.registry.api.RegistryException; import org.wso2.carbon.registry.api.Resource; import org.wso2.carbon.registry.core.Comment; -import org.wso2.carbon.registry.core.service.RegistryService; + +/** + * Carbon registry implementation + */ 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 = "admin@org.com"; - 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 { - log.debug("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.properties) { - resource.addProperty("hostname", prop.hostname); - resource.addProperty("username", prop.username); - resource.addProperty("password", prop.password); - } - - tempRegistry.put(resourcePath, resource); - - if(log.isDebugEnabled()){ - log.debug("A resource added to: " + resourcePath); - } - - Comment comment = new Comment(); - comment.setText("Added the " + applicationName + " " + type + " cartridge"); - // registry.addComment(resourcePath, comment); - - } catch (Exception e) { - if (log.isErrorEnabled()) { - log.error("addCartridgeMetaDataDetails", e); - } - } finally { - // Close the session - - } - - 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); - - 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 lst = new ArrayList(); - PropertyBean prop = new PropertyBean(); - prop.hostname = getResource.getProperty("hostname"); - prop.username = getResource.getProperty("username"); - prop.password = getResource.getProperty("password"); - lst.add(prop); - - cartridgeMetaData.properties = lst; - - } - - } catch (Exception e) { - - if (log.isErrorEnabled()) { - log.error("getCartridgeMetaDataDetails", e); - } - } 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; + private static Log log = LogFactory.getLog(CarbonRegistry.class); + @Context + HttpServletRequest httpServletRequest; + + private static final String mainResource = "/startos/"; + + + 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 void addCartridgeMetaDataDetails(String applicationName, String cartridgeType, + CartridgeMetaData cartridgeMetaData) throws Exception { + log.debug("Adding meta data details"); + + Registry tempRegistry = getGovernanceUserRegistry(); + + + 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); + resource.addProperty("Properties", cartridgeMetaData.properties); + + tempRegistry.put(resourcePath, resource); + + if (log.isDebugEnabled()) { + log.debug("A resource added to: " + resourcePath); + } + + Comment comment = new Comment(); + comment.setText("Added the " + applicationName + " " + type + " cartridge"); + // registry.addComment(resourcePath, comment); + + + } + + /* + * 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); + + 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"); + cartridgeMetaData.properties=getResource.getProperty("Properties"); + + + } + + } catch (Exception e) { + + if (log.isErrorEnabled()) { + log.error("getCartridgeMetaDataDetails", e); + } + } + 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; if (registry != null) { - registry.delete(resourcePath); + registry.delete(resourcePath); return true; } else { if (log.isDebugEnabled()) { @@ -185,14 +156,13 @@ public boolean removeCartridgeMetaDataDetails(String applicationName, String car } return false; } - } - + } public List getPropertiesOfCluster(String applicationName, String clusterId) throws RegistryException { Registry tempRegistry = getGovernanceUserRegistry(); String resourcePath = mainResource + applicationName + "/" + clusterId; - if(!tempRegistry.resourceExists(resourcePath)){ + if (!tempRegistry.resourceExists(resourcePath)) { return null; //throw new RegistryException("Cluster does not exist at " + resourcePath); } @@ -202,10 +172,9 @@ public List getPropertiesOfCluster(String applicationName, String c Properties props = regResource.getProperties(); Enumeration x = props.propertyNames(); - while(x.hasMoreElements()) - { + while (x.hasMoreElements()) { String key = (String) x.nextElement(); - List values = regResource.getPropertyValues(key); + List values = regResource.getPropertyValues(key); NewProperty property = new NewProperty(); property.setKey(key); String[] valueArr = new String[values.size()]; @@ -235,7 +204,7 @@ public void addPropertiesToCluster(String applicationName, String clusterId, New Resource regResource; regResource = createOrGetResourceforCluster(tempRegistry, resourcePath); - for(NewProperty property : properties){ + for (NewProperty property : properties) { regResource.setProperty(property.getKey(), (Arrays.asList(property.getValues()))); } @@ -248,7 +217,7 @@ public void addPropertiesToApplication(String applicationId, NewProperty[] prope String resourcePath = mainResource + applicationId; Resource regResource = createOrGetResourceforApplication(tempRegistry, resourcePath); - for(NewProperty property : properties){ + for (NewProperty property : properties) { regResource.setProperty(property.getKey(), (Arrays.asList(property.getValues()))); } @@ -268,7 +237,7 @@ public void addPropertyToApplication(String applicationId, NewProperty property) public List getPropertiesOfApplication(String applicationId) throws RegistryException { Registry tempRegistry = getGovernanceUserRegistry(); String resourcePath = mainResource + applicationId; - if(!tempRegistry.resourceExists(resourcePath)){ + if (!tempRegistry.resourceExists(resourcePath)) { return null; //throw new RegistryException("Cluster does not exist at " + resourcePath); } @@ -278,10 +247,9 @@ public List getPropertiesOfApplication(String applicationId) throws Properties props = regResource.getProperties(); Enumeration x = props.propertyNames(); - while(x.hasMoreElements()) - { + while (x.hasMoreElements()) { String key = (String) x.nextElement(); - List values = regResource.getPropertyValues(key); + List values = regResource.getPropertyValues(key); NewProperty property = new NewProperty(); property.setKey(key); String[] valueArr = new String[values.size()]; @@ -290,7 +258,7 @@ public List getPropertiesOfApplication(String applicationId) throws newProperties.add(property); } - if(newProperties.size() == 0){ + if (newProperties.size() == 0) { return null; } return newProperties; @@ -299,11 +267,11 @@ public List getPropertiesOfApplication(String applicationId) throws private Resource createOrGetResourceforApplication(Registry tempRegistry, String resourcePath) throws RegistryException { Resource regResource; - if(tempRegistry.resourceExists(resourcePath)) { + if (tempRegistry.resourceExists(resourcePath)) { regResource = tempRegistry.get(resourcePath); - }else{ + } else { regResource = tempRegistry.newCollection(); - if(log.isDebugEnabled()){ + if (log.isDebugEnabled()) { log.debug("Registry resource is create at path " + regResource.getPath() + " for application"); } } @@ -313,14 +281,14 @@ private Resource createOrGetResourceforApplication(Registry tempRegistry, String private Resource createOrGetResourceforCluster(Registry tempRegistry, String resourcePath) throws RegistryException { int index = resourcePath.lastIndexOf('/'); - String applicationResourcePath = resourcePath.substring(0,index); + String applicationResourcePath = resourcePath.substring(0, index); createOrGetResourceforApplication(tempRegistry, applicationResourcePath); Resource regResource; - if(tempRegistry.resourceExists(resourcePath)) { + if (tempRegistry.resourceExists(resourcePath)) { regResource = tempRegistry.get(resourcePath); - }else{ + } else { regResource = tempRegistry.newResource(); - if(log.isDebugEnabled()){ + if (log.isDebugEnabled()) { log.debug("Registry resource is create at path for cluster" + regResource.getPath() + " for cluster"); } } 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 index f7cac250cf..df1e4d4c96 100644 --- 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 @@ -29,7 +29,7 @@ * Interface of the Data Store */ public interface DataStore { - public String addCartridgeMetaDataDetails(String applicationName, String cartridgeType, + public void addCartridgeMetaDataDetails(String applicationName, String cartridgeType, CartridgeMetaData cartridgeMetaData) throws Exception; public String getCartridgeMetaDataDetails(String applicationName, String cartridgeType) 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 index c454631a2f..60f6168c04 100644 --- 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 @@ -102,7 +102,7 @@ private static WSRegistryServiceClient setRegistry() throws Exception { * org.apache.stratos.metadataservice.definition.CartridgeMetaData) */ @Override - public String addCartridgeMetaDataDetails(String applicationName, String cartridgeType, + public void addCartridgeMetaDataDetails(String applicationName, String cartridgeType, CartridgeMetaData cartridgeMetaData) throws Exception { Registry registry = setRegistry(); @@ -124,11 +124,7 @@ public String addCartridgeMetaDataDetails(String applicationName, String cartrid resource.addProperty("Version", cartridgeMetaData.version); resource.addProperty("host", cartridgeMetaData.host); - for (PropertyBean prop : cartridgeMetaData.properties) { - resource.addProperty("hostname", prop.hostname); - resource.addProperty("username", prop.username); - resource.addProperty("password", prop.password); - } + registry.put(resourcePath, resource); @@ -149,7 +145,7 @@ public String addCartridgeMetaDataDetails(String applicationName, String cartrid ((WSRegistryServiceClient) registry).logut(); } - return "success"; + } /* @@ -190,7 +186,7 @@ public String getCartridgeMetaDataDetails(String applicationName, String cartrid prop.password = getResource.getProperty("password"); lst.add(prop); - cartridgeMetaData.properties = lst; + //cartridgeMetaData.properties = lst; } 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 439cc0be70..02ee6d297c 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 @@ -1,9 +1,28 @@ +/* + * 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.services; 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.definition.NewProperty; import org.apache.stratos.metadataservice.exception.RestAPIException; import org.apache.stratos.metadataservice.registry.DataRegistryFactory; @@ -23,38 +42,78 @@ public class MetaDataAdmin { @Context UriInfo uriInfo; - private static Log log = LogFactory.getLog(MetaDataAdmin.class); - @Context - HttpServletRequest httpServletRequest; + private static Log log = LogFactory.getLog(MetaDataAdmin.class); + @Context + HttpServletRequest httpServletRequest; + + private final String defaultRegType = "carbon"; + + private XMLConfiguration conf; + + @POST + @Path("/cartridge/metadata/{applicationname}/{cartridgetype}") + @Produces("application/json") + @Consumes("application/json") + @AuthorizationAction("/permission/protected/manage/monitor/tenants") + public Response addCartridgeMetaDataDetails(@PathParam("applicationname") String applicationName, + @PathParam("cartridgetype") String cartridgeType, + CartridgeMetaData cartridgeMetaData) throws RestAPIException { + + conf = ConfUtil.getInstance(null).getConfiguration(); + URI url = uriInfo.getAbsolutePathBuilder().path(applicationName + "/" + cartridgeType).build(); + String registryType = + conf.getString("metadataservice.govenanceregistrytype", + defaultRegType); + try { + DataRegistryFactory.getDataRegistryFactory(registryType) + .addCartridgeMetaDataDetails(applicationName, cartridgeType, + cartridgeMetaData); + } catch (Exception err) { + log.error("Error occurred while adding meta data details ", err); + } + + return Response.created(url).build(); + + } - private final String defaultRegType = "carbon"; - private XMLConfiguration conf; + @GET + @Path("/cartridge/metadata/{applicationname}/{cartridgetype}") + @Produces("application/json") + @Consumes("application/json") + @AuthorizationAction("/permission/protected/manage/monitor/tenants") + public Response getCartridgeMetaDataDetails(@PathParam("applicationname") String applicationName, + @PathParam("cartridgetype") String cartridgeType) throws RestAPIException - @POST - @Path("/init") - @AuthorizationAction("/permission/protected/manage/monitor/tenants") - public void initialize() throws RestAPIException { - conf = ConfUtil.getInstance(null).getConfiguration(); - } + { + conf = ConfUtil.getInstance(null).getConfiguration(); + String registryType = + conf.getString("metadataservice.govenanceregistrytype", + defaultRegType); + String result = null; + try { + result = DataRegistryFactory.getDataRegistryFactory(registryType) + .getCartridgeMetaDataDetails(applicationName, cartridgeType); + } catch (Exception err) { + log.error("Error occurred while adding meta data details ", err); + } + Response.ResponseBuilder rb; + if (result == null) { + rb = Response.status(Response.Status.NOT_FOUND); + } else { + rb = Response.ok().entity(result); + } + return rb.build(); - 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); + } - } @GET @Path("/application/{application_id}/cluster/{cluster_id}/properties") @Produces("application/json") @Consumes("application/json") @AuthorizationAction("/permission/protected/manage/monitor/tenants") - public Response getClusterProperties(@PathParam("application_id") String applicationId, @PathParam("cluster_id") String clusterId){ + public Response getClusterProperties(@PathParam("application_id") String applicationId, @PathParam("cluster_id") String clusterId) { conf = ConfUtil.getInstance(null).getConfiguration(); String registryType = @@ -65,7 +124,7 @@ public Response getClusterProperties(@PathParam("application_id") String applica try { properties = DataRegistryFactory.getDataRegistryFactory(registryType) .getPropertiesOfCluster(applicationId, clusterId); - if(properties != null) { + if (properties != null) { propertiesArr = new NewProperty[properties.size()]; propertiesArr = properties.toArray(propertiesArr); } @@ -73,10 +132,10 @@ public Response getClusterProperties(@PathParam("application_id") String applica log.error("Error occurred while getting properties ", e); } - Response.ResponseBuilder rb=null; - if(propertiesArr == null){ + Response.ResponseBuilder rb; + if (propertiesArr == null) { rb = Response.status(Response.Status.NOT_FOUND); - }else{ + } else { rb = Response.ok().entity(propertiesArr); } return rb.build(); @@ -87,22 +146,22 @@ public Response getClusterProperties(@PathParam("application_id") String applica @Produces("application/json") @Consumes("application/json") @AuthorizationAction("/permission/protected/manage/monitor/tenants") - public Response getClusterProperty(@PathParam("application_id") String applicationId, @PathParam("cluster_id") String clusterId, @PathParam("property_name") String propertyName){ + public Response getClusterProperty(@PathParam("application_id") String applicationId, @PathParam("cluster_id") String clusterId, @PathParam("property_name") String propertyName) { conf = ConfUtil.getInstance(null).getConfiguration(); String registryType = conf.getString("metadataservice.govenanceregistrytype", defaultRegType); - List properties = null; + List properties; NewProperty property = null; try { properties = DataRegistryFactory.getDataRegistryFactory(registryType) .getPropertiesOfCluster(applicationId, clusterId); - if(properties == null){ + if (properties == null) { return Response.status(Response.Status.NOT_FOUND).build(); } - for(NewProperty p : properties){ - if(propertyName.equals(p.getKey())){ + for (NewProperty p : properties) { + if (propertyName.equals(p.getKey())) { property = p; break; } @@ -111,10 +170,10 @@ public Response getClusterProperty(@PathParam("application_id") String applicati log.error("Error occurred while getting property ", e); } - Response.ResponseBuilder rb=null; - if(property == null){ + Response.ResponseBuilder rb; + if (property == null) { rb = Response.status(Response.Status.NOT_FOUND); - }else{ + } else { rb = Response.ok().entity(property); } return rb.build(); @@ -125,22 +184,22 @@ public Response getClusterProperty(@PathParam("application_id") String applicati @Produces("application/json") @Consumes("application/json") @AuthorizationAction("/permission/protected/manage/monitor/tenants") - public Response getClusterDependencies(@PathParam("application_id") String applicationId, @PathParam("cluster_id") String clusterId){ + public Response getClusterDependencies(@PathParam("application_id") String applicationId, @PathParam("cluster_id") String clusterId) { conf = ConfUtil.getInstance(null).getConfiguration(); String registryType = conf.getString("metadataservice.govenanceregistrytype", defaultRegType); - List properties = null; + List properties; NewProperty property = null; try { properties = DataRegistryFactory.getDataRegistryFactory(registryType) .getPropertiesOfCluster(applicationId, clusterId); - if(properties == null){ + if (properties == null) { return Response.status(Response.Status.NOT_FOUND).build(); } - for(NewProperty p : properties){ - if("dependencies".equals(p.getKey())){ + for (NewProperty p : properties) { + if ("dependencies".equals(p.getKey())) { property = p; break; } @@ -148,10 +207,10 @@ public Response getClusterDependencies(@PathParam("application_id") String appli } catch (Exception e) { log.error("Error occurred while getting properties ", e); } - Response.ResponseBuilder rb=null; - if(property == null){ + Response.ResponseBuilder rb; + if (property == null) { rb = Response.status(Response.Status.NOT_FOUND); - }else{ + } else { rb = Response.ok().entity(property); } return rb.build(); @@ -162,18 +221,18 @@ public Response getClusterDependencies(@PathParam("application_id") String appli @Produces("application/json") @Consumes("application/json") @AuthorizationAction("/permission/protected/manage/monitor/tenants") - public Response getApplicationProperties(@PathParam("application_id") String applicationId){ + public Response getApplicationProperties(@PathParam("application_id") String applicationId) { conf = ConfUtil.getInstance(null).getConfiguration(); String registryType = conf.getString("metadataservice.govenanceregistrytype", defaultRegType); - List properties = null; + List properties; NewProperty[] propertiesArr = null; try { properties = DataRegistryFactory.getDataRegistryFactory(registryType) .getPropertiesOfApplication(applicationId); - if(properties != null) { + if (properties != null) { propertiesArr = new NewProperty[properties.size()]; propertiesArr = properties.toArray(propertiesArr); } @@ -181,10 +240,10 @@ public Response getApplicationProperties(@PathParam("application_id") String app log.error("Error occurred while getting properties ", e); } - Response.ResponseBuilder rb=null; - if(propertiesArr == null){ + Response.ResponseBuilder rb; + if (propertiesArr == null) { rb = Response.status(Response.Status.NOT_FOUND); - }else{ + } else { rb = Response.ok().entity(propertiesArr); } return rb.build(); @@ -195,22 +254,22 @@ public Response getApplicationProperties(@PathParam("application_id") String app @Produces("application/json") @Consumes("application/json") @AuthorizationAction("/permission/protected/manage/monitor/tenants") - public Response getApplicationProperty(@PathParam("application_id") String applicationId, @PathParam("property_name") String propertyName){ + public Response getApplicationProperty(@PathParam("application_id") String applicationId, @PathParam("property_name") String propertyName) { conf = ConfUtil.getInstance(null).getConfiguration(); String registryType = conf.getString("metadataservice.govenanceregistrytype", defaultRegType); - List properties = null; + List properties; NewProperty property = null; try { properties = DataRegistryFactory.getDataRegistryFactory(registryType) .getPropertiesOfApplication(applicationId); - if(properties == null){ + if (properties == null) { return Response.status(Response.Status.NOT_FOUND).build(); } - for(NewProperty p : properties){ - if(propertyName.equals(p.getKey())){ + for (NewProperty p : properties) { + if (propertyName.equals(p.getKey())) { property = p; break; } @@ -219,10 +278,10 @@ public Response getApplicationProperty(@PathParam("application_id") String appli log.error("Error occurred while getting property", e); } - Response.ResponseBuilder rb=null; - if(property == null){ + Response.ResponseBuilder rb; + if (property == null) { rb = Response.status(Response.Status.NOT_FOUND); - }else{ + } else { rb = Response.ok().entity(property); } return rb.build(); @@ -234,12 +293,12 @@ public Response getApplicationProperty(@PathParam("application_id") String appli @Produces("application/json") @Consumes("application/json") @AuthorizationAction("/permission/protected/manage/monitor/tenants") - public Response addClusterDependencies(@PathParam("application_id") String applicationId, @PathParam("cluster_id") String clusterId, NewProperty property) throws RestAPIException { + public Response addClusterDependencies(@PathParam("application_id") String applicationId, @PathParam("cluster_id") String clusterId, NewProperty property) throws RestAPIException { - if(!property.getKey().equals("dependencies")){ + if (!property.getKey().equals("dependencies")) { throw new RestAPIException("Property name should be dependencies"); } - URI url = uriInfo.getAbsolutePathBuilder().path(applicationId + "/" + clusterId + "/" + property.getKey()).build(); + URI url = uriInfo.getAbsolutePathBuilder().path(applicationId + "/" + clusterId + "/" + property.getKey()).build(); conf = ConfUtil.getInstance(null).getConfiguration(); String registryType = conf.getString("metadataservice.govenanceregistrytype", defaultRegType); @@ -259,7 +318,7 @@ public Response addClusterDependencies(@PathParam("application_id") String appli public Response addPropertyToACluster(@PathParam("application_id") String applicationId, @PathParam("cluster_id") String clusterId, NewProperty property) throws RestAPIException { - URI url = uriInfo.getAbsolutePathBuilder().path(applicationId + "/" + clusterId + "/" + property.getKey()).build(); + URI url = uriInfo.getAbsolutePathBuilder().path(applicationId + "/" + clusterId + "/" + property.getKey()).build(); conf = ConfUtil.getInstance(null).getConfiguration(); String registryType = conf.getString("metadataservice.govenanceregistrytype", defaultRegType); @@ -280,7 +339,7 @@ public Response addPropertyToACluster(@PathParam("application_id") String applic @AuthorizationAction("/permission/protected/manage/monitor/tenants") public Response addPropertiesToACluster(@PathParam("application_id") String applicationId, @PathParam("cluster_id") String clusterId, NewProperty[] properties) throws RestAPIException { - URI url = uriInfo.getAbsolutePathBuilder().path(applicationId + "/" + clusterId).build(); + URI url = uriInfo.getAbsolutePathBuilder().path(applicationId + "/" + clusterId).build(); conf = ConfUtil.getInstance(null).getConfiguration(); @@ -290,7 +349,7 @@ public Response addPropertiesToACluster(@PathParam("application_id") String appl try { DataRegistryFactory.getDataRegistryFactory(registryType).addPropertiesToCluster(applicationId, clusterId, properties); } catch (Exception e) { - log.error("Error occurred while adding properties ", e); + log.error("Error occurred while adding properties ", e); } @@ -302,9 +361,9 @@ public Response addPropertiesToACluster(@PathParam("application_id") String appl @Produces("application/json") @Consumes("application/json") @AuthorizationAction("/permission/protected/manage/monitor/tenants") - public Response addPropertiesToApplication(@PathParam("application_id") String applicationId,NewProperty[] properties) + public Response addPropertiesToApplication(@PathParam("application_id") String applicationId, NewProperty[] properties) throws RestAPIException { - URI url = uriInfo.getAbsolutePathBuilder().path(applicationId).build(); + URI url = uriInfo.getAbsolutePathBuilder().path(applicationId).build(); conf = ConfUtil.getInstance(null).getConfiguration(); @@ -328,7 +387,7 @@ public Response addPropertiesToApplication(@PathParam("application_id") String a @AuthorizationAction("/permission/protected/manage/monitor/tenants") public Response addPropertyToApplication(@PathParam("application_id") String applicationId, NewProperty property) throws RestAPIException { - URI url = uriInfo.getAbsolutePathBuilder().path(applicationId).build(); + URI url = uriInfo.getAbsolutePathBuilder().path(applicationId).build(); conf = ConfUtil.getInstance(null).getConfiguration(); diff --git a/products/stratos/modules/distribution/src/main/conf/metadataservice.xml b/products/stratos/modules/distribution/src/main/conf/metadataservice.xml index d871bc0b9f..5e8bb1d689 100644 --- a/products/stratos/modules/distribution/src/main/conf/metadataservice.xml +++ b/products/stratos/modules/distribution/src/main/conf/metadataservice.xml @@ -19,7 +19,7 @@ --> - OWN + carbon https://localhost:9445/services/ admin admin diff --git a/tools/stratos-installer/config/all/repository/conf/metadataservice.xml b/tools/stratos-installer/config/all/repository/conf/metadataservice.xml index 690e056579..5e8bb1d689 100644 --- a/tools/stratos-installer/config/all/repository/conf/metadataservice.xml +++ b/tools/stratos-installer/config/all/repository/conf/metadataservice.xml @@ -19,7 +19,7 @@ --> - GREG + carbon https://localhost:9445/services/ admin admin From ba59e20fd476b7c93f2e40e08a88c2430bedfd12 Mon Sep 17 00:00:00 2001 From: gayan Date: Wed, 8 Oct 2014 21:16:26 +0530 Subject: [PATCH 2/6] Meta data service refactoring --- .../stratos/metadataservice/Constants.java | 3 +- .../listener/TopologyAgent.java | 5 +- .../listener/TopologyListener.java | 8 + .../registry/CarbonRegistry.java | 60 +-- .../metadataservice/registry/DataStore.java | 1 - .../registry/GRegRegistry.java | 353 +++++++++--------- 6 files changed, 215 insertions(+), 215 deletions(-) diff --git a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/Constants.java b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/Constants.java index bd84c5f3c5..f526d9e4c2 100644 --- a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/Constants.java +++ b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/Constants.java @@ -23,7 +23,6 @@ */ public class Constants { - public static final String SUPER_TENANT_SERVICE = "super.tenant.service"; - public static final String METADATASERVICE_CONFIG_FILE_NAME = "metadataservice.xml"; + public static final String METADATASERVICE_CONFIG_FILE_NAME = "metadataservice.xml"; } diff --git a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/listener/TopologyAgent.java b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/listener/TopologyAgent.java index 6c55f1568d..f9afd7892d 100644 --- a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/listener/TopologyAgent.java +++ b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/listener/TopologyAgent.java @@ -52,6 +52,9 @@ public void run() { } + /** + * Register the topology event listener + */ private void registerTopologyEventListeners() { final String defaultRegType = "carbon"; @@ -106,7 +109,7 @@ protected void onEvent(Event event) { } MemberSuspendedEvent memberSuspendedEvent = (MemberSuspendedEvent) event; //TODO : Add the funtionalilty for the suspended event - // extensionHandler.onMemberSuspendedEvent(memberSuspendedEvent); + } catch (Exception e) { if (log.isErrorEnabled()) { log.error("Error processing member suspended event", e); diff --git a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/listener/TopologyListener.java b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/listener/TopologyListener.java index bd6e750cd8..6f0f60c9a6 100644 --- a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/listener/TopologyListener.java +++ b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/listener/TopologyListener.java @@ -34,6 +34,10 @@ public class TopologyListener implements ServletContextListener { private TopologyAgent topologyThread = null; private Thread thread = null; + /** + * Initialization of the context + * @param arg0 + */ @Override public void contextInitialized(ServletContextEvent arg0) { log.info("Topology literner started...."); @@ -50,6 +54,10 @@ public void contextInitialized(ServletContextEvent arg0) { } + /** + * Destroy the context + * @param arg0 + */ @Override public void contextDestroyed(ServletContextEvent arg0) { 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 9e74ce0904..fde98705d4 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 @@ -24,7 +24,6 @@ import javax.ws.rs.core.Context; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.stratos.metadataservice.definition.*; @@ -51,12 +50,14 @@ 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) + * @param applicationName Application Name + * @param cartridgeType Cartridge Type + * @param cartridgeMetaData Cartridge Meta Data + * @throws Exception */ @Override public void addCartridgeMetaDataDetails(String applicationName, String cartridgeType, @@ -96,51 +97,50 @@ public void addCartridgeMetaDataDetails(String applicationName, String cartridge } - /* + /** * Get the meta data from the registry * - * @see org.apache.stratos.metadataservice.registry.DataStore# - * getCartridgeMetaDataDetails(java.lang.String, java.lang.String) + * @param applicationName + * @param cartridgeType + * @return + * @throws Exception */ @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); - 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"); - cartridgeMetaData.properties=getResource.getProperty("Properties"); + String resourcePath = mainResource + applicationName + "/" + cartridgeType; + if (registry.resourceExists(resourcePath)) { + Resource getResource = registry.get(resourcePath); - } + 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"); + cartridgeMetaData.properties = getResource.getProperty("Properties"); - } catch (Exception e) { - if (log.isErrorEnabled()) { - log.error("getCartridgeMetaDataDetails", e); - } } + + return cartridgeMetaData.toString(); } - /* - * + + /** * Remove the meta data from the registry * - * @see org.apache.stratos.metadataservice.registry.DataStore# - * removeCartridgeMetaDataDetails(java.lang.String, java.lang.String) + * @param applicationName + * @param cartridgeType + * @return + * @throws Exception */ @Override public boolean removeCartridgeMetaDataDetails(String applicationName, String cartridgeType) 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 index df1e4d4c96..b35d4b5589 100644 --- 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 @@ -18,7 +18,6 @@ */ package org.apache.stratos.metadataservice.registry; -import org.apache.stratos.metadataservice.definition.ApplicationBean; import org.apache.stratos.metadataservice.definition.CartridgeMetaData; import org.apache.stratos.metadataservice.definition.NewProperty; import org.wso2.carbon.registry.api.RegistryException; 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 index 60f6168c04..d7bc975476 100644 --- 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 @@ -18,22 +18,13 @@ */ 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.ApplicationBean; import org.apache.stratos.metadataservice.definition.CartridgeMetaData; import org.apache.stratos.metadataservice.definition.NewProperty; -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.RegistryException; @@ -41,182 +32,182 @@ import org.wso2.carbon.registry.core.Comment; import org.wso2.carbon.registry.ws.client.registry.WSRegistryServiceClient; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.Context; +import java.io.File; +import java.util.List; + /** - * * 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 = "admin@org.com"; - 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 void addCartridgeMetaDataDetails(String applicationName, String cartridgeType, - CartridgeMetaData cartridgeMetaData) throws Exception { - - 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); - - - - registry.put(resourcePath, resource); - - - registry.rateResource(resourcePath, defaultRank); - - Comment comment = new Comment(); - comment.setText("Added the " + applicationName + " " + type + " cartridge"); - registry.addComment(resourcePath, comment); - - } catch (Exception e) { - - if (log.isErrorEnabled()) { - log.error("addCartridgeMetaDataDetails", e); - } - } finally { - // Close the session - ((WSRegistryServiceClient) registry).logut(); - } - - - } - - /* - * 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); - if(log.isDebugEnabled()){ - log.debug("Resource retrived"); - log.debug("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 lst = new ArrayList(); - PropertyBean prop = new PropertyBean(); - prop.hostname = getResource.getProperty("hostname"); - prop.username = getResource.getProperty("username"); - prop.password = getResource.getProperty("password"); - lst.add(prop); - - //cartridgeMetaData.properties = lst; - - } - - } catch (Exception e) { - - if (log.isErrorEnabled()) { - log.error("getCartridgeMetaDataDetails", e); - } - } 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; - } + private static Log log = LogFactory.getLog(GRegRegistry.class); + @Context + HttpServletRequest httpServletRequest; + + private static ConfigurationContext configContext; + + static { + configContext = null; + } + + private static final String defaultUsername = "admin@org.com"; + 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 defaultAxis2Repo = "repository/deployment/client"; + String axis2Repo = conf.getString("metadataservice.axis2Repo", defaultAxis2Repo); + String defaultAxis2Conf = "repository/conf/axis2/axis2_client.xml"; + 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 + * @param applicationName + * @param cartridgeType + * @param cartridgeMetaData + * @throws Exception + */ + @Override + public void addCartridgeMetaDataDetails(String applicationName, String cartridgeType, + CartridgeMetaData cartridgeMetaData) throws Exception { + + 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); + resource.addProperty("Properties", cartridgeMetaData.properties); + registry.put(resourcePath, resource); + + registry.rateResource(resourcePath, defaultRank); + + Comment comment = new Comment(); + comment.setText("Added the " + applicationName + " " + type + " cartridge"); + registry.addComment(resourcePath, comment); + + } catch (Exception e) { + + if (log.isErrorEnabled()) { + log.error("addCartridgeMetaDataDetails", e); + } + } finally { + // Close the session + ((WSRegistryServiceClient) registry).logut(); + } + + + } + + /** + * Get the meta data from the registry + * @param applicationName + * @param cartridgeType + * @return + * @throws Exception + */ + @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); + if (log.isDebugEnabled()) { + log.debug("Resource retrived"); + log.debug("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"); + cartridgeMetaData.properties = getResource.getProperty("Properties"); + + + + } + + } catch (Exception e) { + + if (log.isErrorEnabled()) { + log.error("getCartridgeMetaDataDetails", e); + } + } finally { + // Close the session + ((WSRegistryServiceClient) registry).logut(); + } + return cartridgeMetaData.toString(); + } + + /** + * Remove catridge meta data details from the registry + * @param applicationName + * @param cartridgeType + * @return + * @throws Exception + */ + @Override + public boolean removeCartridgeMetaDataDetails(String applicationName, String cartridgeType) + throws Exception { + Registry registry = setRegistry(); + String resourcePath = mainResource + applicationName + "/" + cartridgeType; + registry.delete(resourcePath); + return false; + } public void addPropertiesToCluster(String applicationName, String clusterId, NewProperty[] properties) throws RegistryException { @@ -227,7 +218,7 @@ public List getPropertiesOfCluster(String applicationName, String c } public void addPropertyToCluster(String applicationId, String clusterId, NewProperty property) throws RegistryException { - + } public void addPropertiesToApplication(String applicationId, NewProperty[] properties) throws RegistryException { From 175a9a128cc30e5e2c5f52a2bf6965fb00af8c07 Mon Sep 17 00:00:00 2001 From: gayan Date: Wed, 8 Oct 2014 21:17:31 +0530 Subject: [PATCH 3/6] Meta data service refactoring --- .../stratos/metadataservice/registry/CarbonRegistry.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) 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 fde98705d4..6f047fedcb 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 @@ -31,7 +31,7 @@ import org.wso2.carbon.registry.api.Registry; import org.wso2.carbon.registry.api.RegistryException; import org.wso2.carbon.registry.api.Resource; -import org.wso2.carbon.registry.core.Comment; + /** * Carbon registry implementation @@ -90,10 +90,6 @@ public void addCartridgeMetaDataDetails(String applicationName, String cartridge log.debug("A resource added to: " + resourcePath); } - Comment comment = new Comment(); - comment.setText("Added the " + applicationName + " " + type + " cartridge"); - // registry.addComment(resourcePath, comment); - } From c006fa42117d2afc6233a7aaca44cda247199311 Mon Sep 17 00:00:00 2001 From: gayan Date: Thu, 9 Oct 2014 10:13:39 +0530 Subject: [PATCH 4/6] Meta data service refactoring --- .../stratos/metadataservice/definition/NewProperty.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/definition/NewProperty.java b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/definition/NewProperty.java index 73f75d9773..552d29f791 100644 --- a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/definition/NewProperty.java +++ b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/definition/NewProperty.java @@ -30,8 +30,8 @@ @XmlRootElement(name="properties") public class NewProperty implements Serializable{ - public String key; - public List values = new ArrayList(); + private String key; + private List values = new ArrayList(); public NewProperty(){} public NewProperty(String key, String value){ From 99fefd2086735570635260939e97cdcc10acf4f2 Mon Sep 17 00:00:00 2001 From: gayan Date: Thu, 9 Oct 2014 10:18:03 +0530 Subject: [PATCH 5/6] Meta data service refactoring --- .../registry/CarbonRegistry.java | 57 ++++++++++++++++++- 1 file changed, 55 insertions(+), 2 deletions(-) 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 6f047fedcb..4527eddc28 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 @@ -154,7 +154,14 @@ public boolean removeCartridgeMetaDataDetails(String applicationName, String car } } - + /** + * Get Properties of clustor + * @param applicationName + * @param clusterId + * @return + * @throws RegistryException + */ + @Override public List getPropertiesOfCluster(String applicationName, String clusterId) throws RegistryException { Registry tempRegistry = getGovernanceUserRegistry(); String resourcePath = mainResource + applicationName + "/" + clusterId; @@ -182,6 +189,14 @@ public List getPropertiesOfCluster(String applicationName, String c return newProperties; } + /** + * Add property to cluster + * @param applicationId + * @param clusterId + * @param property + * @throws RegistryException + */ + @Override public void addPropertyToCluster(String applicationId, String clusterId, NewProperty property) throws RegistryException { Registry tempRegistry = getGovernanceUserRegistry(); String resourcePath = mainResource + applicationId + "/" + clusterId; @@ -193,6 +208,13 @@ public void addPropertyToCluster(String applicationId, String clusterId, NewProp } + /** + * Add properties to clustor + * @param applicationName + * @param clusterId + * @param properties + * @throws RegistryException + */ @Override public void addPropertiesToCluster(String applicationName, String clusterId, NewProperty[] properties) throws RegistryException { Registry tempRegistry = getGovernanceUserRegistry(); @@ -208,6 +230,12 @@ public void addPropertiesToCluster(String applicationName, String clusterId, New log.info(String.format("Properties are added to cluster %s of application %s", clusterId, applicationName)); } + /** + * Add properties to application + * @param applicationId + * @param properties + * @throws RegistryException + */ public void addPropertiesToApplication(String applicationId, NewProperty[] properties) throws RegistryException { Registry tempRegistry = getGovernanceUserRegistry(); String resourcePath = mainResource + applicationId; @@ -221,6 +249,12 @@ public void addPropertiesToApplication(String applicationId, NewProperty[] prope log.info(String.format("Properties are added to application %s", applicationId)); } + /** + * Add property to application + * @param applicationId + * @param property + * @throws RegistryException + */ public void addPropertyToApplication(String applicationId, NewProperty property) throws RegistryException { Registry tempRegistry = getGovernanceUserRegistry(); String resourcePath = mainResource + applicationId; @@ -230,6 +264,12 @@ public void addPropertyToApplication(String applicationId, NewProperty property) log.info(String.format("Property %s is added to application %s ", property.getKey(), applicationId)); } + /** + * Get properties of application + * @param applicationId + * @return + * @throws RegistryException + */ public List getPropertiesOfApplication(String applicationId) throws RegistryException { Registry tempRegistry = getGovernanceUserRegistry(); String resourcePath = mainResource + applicationId; @@ -260,7 +300,13 @@ public List getPropertiesOfApplication(String applicationId) throws return newProperties; } - + /** + * Create or get resources for application + * @param tempRegistry + * @param resourcePath + * @return + * @throws RegistryException + */ private Resource createOrGetResourceforApplication(Registry tempRegistry, String resourcePath) throws RegistryException { Resource regResource; if (tempRegistry.resourceExists(resourcePath)) { @@ -274,6 +320,13 @@ private Resource createOrGetResourceforApplication(Registry tempRegistry, String return regResource; } + /** + * Create and get resources for Clustor + * @param tempRegistry + * @param resourcePath + * @return + * @throws RegistryException + */ private Resource createOrGetResourceforCluster(Registry tempRegistry, String resourcePath) throws RegistryException { int index = resourcePath.lastIndexOf('/'); From ef6dcf082cad92bd7c2c11f980ac35f1dd44bc31 Mon Sep 17 00:00:00 2001 From: gayan Date: Thu, 9 Oct 2014 10:54:30 +0530 Subject: [PATCH 6/6] Meta data service refactoring --- .../metadataservice/listener/TopologyListener.java | 4 ++-- .../stratos/metadataservice/registry/CarbonRegistry.java | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/listener/TopologyListener.java b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/listener/TopologyListener.java index 6f0f60c9a6..6c018b4b39 100644 --- a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/listener/TopologyListener.java +++ b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/listener/TopologyListener.java @@ -36,7 +36,7 @@ public class TopologyListener implements ServletContextListener { /** * Initialization of the context - * @param arg0 + * @param arg0 ServletContextEvent */ @Override public void contextInitialized(ServletContextEvent arg0) { @@ -56,7 +56,7 @@ public void contextInitialized(ServletContextEvent arg0) { /** * Destroy the context - * @param arg0 + * @param arg0 ServletContextEvent */ @Override public void contextDestroyed(ServletContextEvent arg0) 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 4527eddc28..600a064596 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 @@ -96,8 +96,8 @@ public void addCartridgeMetaDataDetails(String applicationName, String cartridge /** * Get the meta data from the registry * - * @param applicationName - * @param cartridgeType + * @param applicationName name of the application + * @param cartridgeType cartridge type * @return * @throws Exception */ @@ -133,8 +133,8 @@ public String getCartridgeMetaDataDetails(String applicationName, String cartrid /** * Remove the meta data from the registry * - * @param applicationName - * @param cartridgeType + * @param applicationName name of the application + * @param cartridgeType cartridge type * @return * @throws Exception */