Repository: stratos Updated Branches: refs/heads/master da776459f -> 64c8f5ab9
removing unsued apis from metadata service Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/64c8f5ab Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/64c8f5ab Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/64c8f5ab Branch: refs/heads/master Commit: 64c8f5ab90b0cd79ea9fad585f7ebcf3d6dc0b7a Parents: da77645 Author: Udara Liyanage <[email protected]> Authored: Tue May 12 22:17:30 2015 +0530 Committer: Udara Liyanage <[email protected]> Committed: Tue May 12 22:44:13 2015 +0530 ---------------------------------------------------------------------- .../service/registry/CarbonRegistry.java | 97 +------------------- 1 file changed, 1 insertion(+), 96 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/64c8f5ab/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/registry/CarbonRegistry.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/registry/CarbonRegistry.java b/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/registry/CarbonRegistry.java index d83edf2..03f7d40 100644 --- a/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/registry/CarbonRegistry.java +++ b/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/registry/CarbonRegistry.java @@ -44,7 +44,6 @@ public class CarbonRegistry implements DataStore { private static Log log = LogFactory.getLog(CarbonRegistry.class); @Context HttpServletRequest httpServletRequest; - private static int count = 0; public CarbonRegistry() { } @@ -125,8 +124,6 @@ public class CarbonRegistry implements DataStore { Registry registry = getRegistry(); String resourcePath = mainResource + applicationId; - log.info("**************addPropertyToApplication " + count++ + " property name " + property.getKey() + " values " + Arrays.toString(property.getValues())); - //log.info("**** property name " + property.getKey() + " values " + Arrays.toString(property.getValues())); try { PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); ctx.setTenantId(MultitenantConstants.SUPER_TENANT_ID); @@ -144,7 +141,6 @@ public class CarbonRegistry implements DataStore { } for(String value : property.getValues()){ - //log.info(String.format("*** application property value is added to the registry key=%s value=%s", property.getKey(), value)); nodeResource.addProperty(property.getKey(), value); } @@ -164,9 +160,6 @@ public class CarbonRegistry implements DataStore { registry.put(resourcePath, nodeResource); } //registry.commitTransaction(); - - - } catch (Exception e) { String msg = "Failed to persist properties in registry: " + resourcePath; //registry.rollbackTransaction(); @@ -207,7 +200,7 @@ public class CarbonRegistry implements DataStore { registry.put(resourcePath, nodeResource); registry.commitTransaction(); - log.info(String.format("****** Application %s property %s value %s is removed from metadata ", applicationId, propertyName, valueToRemove)); + log.info(String.format("Application %s property %s value %s is removed from metadata ", applicationId, propertyName, valueToRemove)); } catch (Exception e) { String msg = "Failed to persist properties in registry: " + resourcePath; registry.rollbackTransaction(); @@ -262,48 +255,6 @@ public class CarbonRegistry implements DataStore { } } - public void addPropertyToGroup(String applicationId, String groupId, Property property) throws RegistryException { - Registry registry = getRegistry(); - String resourcePath = mainResource + applicationId + "/groups/" + groupId; - - try { - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - ctx.setTenantId(MultitenantConstants.SUPER_TENANT_ID); - ctx.setTenantDomain(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME); - - registry.beginTransaction(); - Resource nodeResource = null; - if (registry.resourceExists(resourcePath)) { - nodeResource = registry.get(resourcePath); - } else { - nodeResource = registry.newResource(); - if (log.isDebugEnabled()) { - log.debug("Registry resource is create at path for cluster" + nodeResource.getPath() + " for cluster"); - } - } - - for(String value : property.getValues()){ - log.info(String.format("*** groups property value is added to the registry key=%s value=%s", property.getKey(), value)); - nodeResource.addProperty(property.getKey(), value); - } - - registry.put(resourcePath, nodeResource); - - registry.commitTransaction(); - - log.info(String.format("Registry property is persisted: [resource-path] %s [Property Name] %s [Property Values] %s", - resourcePath, property.getKey(), Arrays.asList(property.getValues()))); - - } catch (Exception e) { - String msg = "Failed to persist properties in registry: " + resourcePath; - registry.rollbackTransaction(); - log.error(msg, e); - throw new RegistryException(msg, e); - } - } - - - private UserRegistry getRegistry() throws RegistryException { return org.apache.stratos.common.internal.ServiceReferenceHolder.getInstance().getRegistryService().getGovernanceSystemRegistry(); } @@ -342,50 +293,4 @@ public class CarbonRegistry implements DataStore { return false; } - /** - * Create or get resource for application - * - * @param tempRegistry - * @param resourcePath - * @return - * @throws RegistryException - */ - private Resource createOrGetResourceforApplication(Registry tempRegistry, String resourcePath) throws RegistryException { - Resource regResource; - if (tempRegistry.resourceExists(resourcePath)) { - regResource = tempRegistry.get(resourcePath); - } else { - regResource = tempRegistry.newCollection(); - if (log.isDebugEnabled()) { - log.debug("Registry resource is create at path " + regResource.getPath() + " for application"); - } - } - return regResource; - } - - /** - * Create and get resources for Clustor - * - * @param tempRegistry - * @param resourcePath - * @return - * @throws RegistryException - */ - private Resource createOrGetResourceforCluster(Registry tempRegistry, String resourcePath) throws RegistryException { - - int index = resourcePath.lastIndexOf('/'); - String applicationResourcePath = resourcePath.substring(0, index); - createOrGetResourceforApplication(tempRegistry, applicationResourcePath); - Resource regResource; - if (tempRegistry.resourceExists(resourcePath)) { - regResource = tempRegistry.get(resourcePath); - } else { - regResource = tempRegistry.newResource(); - if (log.isDebugEnabled()) { - log.debug("Registry resource is create at path for cluster" + regResource.getPath() + " for cluster"); - } - } - return regResource; - } - }
