incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maha...@apache.org
Subject svn commit: r1398884 [1/2] - in /incubator/ambari/branches/AMBARI-666: ./ ambari-server/src/main/java/org/apache/ambari/server/api/query/ ambari-server/src/main/java/org/apache/ambari/server/api/resources/ ambari-server/src/main/java/org/apache/ambari/...
Date Tue, 16 Oct 2012 16:55:06 GMT
Author: mahadev
Date: Tue Oct 16 16:55:05 2012
New Revision: 1398884

URL: http://svn.apache.org/viewvc?rev=1398884&view=rev
Log:
AMBARI-870. Support metric types other than string (Tom Beerbower via mahadev)

Modified:
    incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt
    incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/query/QueryImpl.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/resources/BaseResourceDefinition.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ComponentResourceDefinition.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/resources/HostComponentResourceDefinition.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ResourceDefinition.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/services/BasePersistenceManager.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/services/serializers/JsonSerializer.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProvider.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/DefaultProviderModule.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/PropertyPredicateVisitor.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestImpl.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ResourceImpl.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ResourceProviderImpl.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/jdbc/JDBCManagementController.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/jdbc/JDBCProviderModule.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/jdbc/JDBCResourceProvider.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXMetricHolder.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXPropertyProvider.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/ComparisonPredicate.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/EqualsPredicate.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/GreaterEqualsPredicate.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/GreaterPredicate.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/LessEqualsPredicate.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/LessPredicate.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/spi/Request.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/spi/Resource.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PredicateBuilder.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PropertyHelper.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/api/services/CreatePersistenceManagerTest.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/api/services/UpdatePersistenceManagerTest.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ResourceImplTest.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ResourceProviderImplTest.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/controller/jmx/JMXPropertyProviderTest.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/controller/predicate/GreaterEqualsPredicateTest.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/controller/predicate/GreaterPredicateTest.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/controller/predicate/LessEqualsPredicateTest.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/controller/predicate/LessPredicateTest.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/controller/predicate/ResourceImpl.java

Modified: incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt?rev=1398884&r1=1398883&r2=1398884&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt (original)
+++ incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt Tue Oct 16 16:55:05 2012
@@ -12,6 +12,9 @@ AMBARI-666 branch (unreleased changes)
 
   NEW FEATURES
 
+  AMBARI-870. Support metric types other than string (Tom Beerbower via
+  mahadev)
+
   AMBARI-868. Clean up site.pp generation on the agent and remove the imports
   in the sample site.pp. (mahadev)
 

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/query/QueryImpl.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/query/QueryImpl.java?rev=1398884&r1=1398883&r2=1398884&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/query/QueryImpl.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/query/QueryImpl.java Tue Oct 16 16:55:05 2012
@@ -141,7 +141,7 @@ public class QueryImpl implements Query 
         String subResCategory = entry.getKey();
         ResourceDefinition r = entry.getValue();
 
-        r.setParentId(m_resourceDefinition.getType(), resource.getPropertyValue(
+        r.setParentId(m_resourceDefinition.getType(), (String) resource.getPropertyValue(
             getClusterController().getSchema(m_resourceDefinition.getType()).
                 getKeyPropertyId(m_resourceDefinition.getType())));
 

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/resources/BaseResourceDefinition.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/resources/BaseResourceDefinition.java?rev=1398884&r1=1398883&r2=1398884&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/resources/BaseResourceDefinition.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/resources/BaseResourceDefinition.java Tue Oct 16 16:55:05 2012
@@ -57,7 +57,7 @@ public abstract class BaseResourceDefini
   private Map<Resource.Type, String> m_mapResourceIds = new HashMap<Resource.Type, String>();
 
   //TODO: Refactor out of this class when setProperties is moved.
-  private Map<PropertyId, String> m_properties = new HashMap<PropertyId, String>();
+  private Map<PropertyId, Object> m_properties = new HashMap<PropertyId, Object>();
 
 
   /**
@@ -131,7 +131,7 @@ public abstract class BaseResourceDefini
   }
 
   @Override
-  public Map<PropertyId, String> getProperties() {
+  public Map<PropertyId, Object> getProperties() {
     return m_properties;
   }
 
@@ -167,7 +167,7 @@ public abstract class BaseResourceDefini
       if (parent.getName() != null) {
         String parentName = parent.getName();
         Schema schema = getClusterController().getSchema(r.getType());
-        String id = r.getPropertyValue(schema.getKeyPropertyId(r.getType()));
+        Object id = r.getPropertyValue(schema.getKeyPropertyId(r.getType()));
 
         int i = href.indexOf("?");
         if (i != -1) {

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ComponentResourceDefinition.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ComponentResourceDefinition.java?rev=1398884&r1=1398883&r2=1398884&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ComponentResourceDefinition.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ComponentResourceDefinition.java Tue Oct 16 16:55:05 2012
@@ -115,8 +115,8 @@ public class ComponentResourceDefinition
         Resource r = resultNode.getObject();
         String clusterId = getResourceIds().get(Resource.Type.Cluster);
         Schema schema = ClusterControllerHelper.getClusterController().getSchema(r.getType());
-        String serviceId = r.getPropertyValue(schema.getKeyPropertyId(Resource.Type.Service));
-        String componentId = r.getPropertyValue(schema.getKeyPropertyId(r.getType()));
+        Object serviceId = r.getPropertyValue(schema.getKeyPropertyId(Resource.Type.Service));
+        Object componentId = r.getPropertyValue(schema.getKeyPropertyId(r.getType()));
 
         href = href.substring(0, href.indexOf(clusterId) + clusterId.length() + 1) +
             "services/" + serviceId + "/components/" + componentId;

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/resources/HostComponentResourceDefinition.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/resources/HostComponentResourceDefinition.java?rev=1398884&r1=1398883&r2=1398884&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/resources/HostComponentResourceDefinition.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/resources/HostComponentResourceDefinition.java Tue Oct 16 16:55:05 2012
@@ -116,8 +116,8 @@ public class HostComponentResourceDefini
         Resource r = resultNode.getObject();
         String clusterId = getResourceIds().get(Resource.Type.Cluster);
         Schema schema = ClusterControllerHelper.getClusterController().getSchema(r.getType());
-        String host = r.getPropertyValue(schema.getKeyPropertyId(Resource.Type.Host));
-        String hostComponent = r.getPropertyValue(schema.getKeyPropertyId(r.getType()));
+        Object host = r.getPropertyValue(schema.getKeyPropertyId(Resource.Type.Host));
+        Object hostComponent = r.getPropertyValue(schema.getKeyPropertyId(r.getType()));
 
         href = href.substring(0, href.indexOf(clusterId) + clusterId.length() + 1) +
             "hosts/" + host + "/host_components/" + hostComponent;

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ResourceDefinition.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ResourceDefinition.java?rev=1398884&r1=1398883&r2=1398884&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ResourceDefinition.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ResourceDefinition.java Tue Oct 16 16:55:05 2012
@@ -122,7 +122,7 @@ public interface ResourceDefinition {
    *
    * @return the properties which have been set on this resource
    */
-  public Map<PropertyId, String> getProperties();
+  public Map<PropertyId, Object> getProperties();
 
   /**
    * Resource specific result processor.

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/services/BasePersistenceManager.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/services/BasePersistenceManager.java?rev=1398884&r1=1398883&r2=1398884&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/services/BasePersistenceManager.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/services/BasePersistenceManager.java Tue Oct 16 16:55:05 2012
@@ -36,7 +36,7 @@ public abstract class BasePersistenceMan
     return ClusterControllerHelper.getClusterController();
   }
 
-  protected Request createControllerRequest(Map<PropertyId, String> properties) {
+  protected Request createControllerRequest(Map<PropertyId, Object> properties) {
     return PropertyHelper.getCreateRequest(Collections.singleton(properties));
   }
 }

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/services/serializers/JsonSerializer.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/services/serializers/JsonSerializer.java?rev=1398884&r1=1398883&r2=1398884&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/services/serializers/JsonSerializer.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/api/services/serializers/JsonSerializer.java Tue Oct 16 16:55:05 2012
@@ -101,17 +101,17 @@ public class JsonSerializer implements R
     }
   }
 
-  private void handleResourceProperties(Map<String, Map<String, String>> mapCatProps) throws IOException {
-    for (Map.Entry<String, Map<String, String>> categoryEntry : mapCatProps.entrySet()) {
+  private void handleResourceProperties(Map<String, Map<String, Object>> mapCatProps) throws IOException {
+    for (Map.Entry<String, Map<String, Object>> categoryEntry : mapCatProps.entrySet()) {
       String category = categoryEntry.getKey();
-      Map<String, String> mapProps = categoryEntry.getValue();
+      Map<String, Object> mapProps = categoryEntry.getValue();
       if (category != null) {
         m_generator.writeFieldName(category);
         m_generator.writeStartObject();
       }
 
-      for (Map.Entry<String, String> propEntry : mapProps.entrySet()) {
-        m_generator.writeStringField(propEntry.getKey(), propEntry.getValue());
+      for (Map.Entry<String, Object> propEntry : mapProps.entrySet()) {
+        m_generator.writeObjectField(propEntry.getKey(), propEntry.getValue());
       }
 
       if (category != null) {

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProvider.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProvider.java?rev=1398884&r1=1398883&r2=1398884&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProvider.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProvider.java Tue Oct 16 16:55:05 2012
@@ -117,8 +117,8 @@ public class GangliaPropertyProvider imp
     }
     Set<PropertyId> ids = PropertyHelper.getRequestPropertyIds(getPropertyIds(), request, predicate);
 
-    String hostName           = PropertyHelper.fixHostName(resource.getPropertyValue(HOST_COMPONENT_HOST_NAME_PROPERTY_ID));
-    String componentName      = resource.getPropertyValue(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID);
+    String hostName           = PropertyHelper.fixHostName((String) resource.getPropertyValue(HOST_COMPONENT_HOST_NAME_PROPERTY_ID));
+    String componentName      = (String) resource.getPropertyValue(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID);
     String gangliaClusterName = GANGLIA_CLUSTER_NAMES.get(componentName);
 
     if (gangliaClusterName == null) {

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/DefaultProviderModule.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/DefaultProviderModule.java?rev=1398884&r1=1398883&r2=1398884&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/DefaultProviderModule.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/DefaultProviderModule.java Tue Oct 16 16:55:05 2012
@@ -148,7 +148,7 @@ public class DefaultProviderModule imple
 
     Set<Resource> hosts = hostProvider.getResources(request, null);
     for (Resource host : hosts) {
-      String attributes = host.getPropertyValue(HOST_ATTRIBUTES_PROPERTY_ID);
+      String attributes = (String) host.getPropertyValue(HOST_ATTRIBUTES_PROPERTY_ID);
       if (attributes != null && !attributes.startsWith("[]")) {
         try {
           Map<String, String> attributeMap = mapper.readValue(attributes, new TypeReference<Map<String, String>>() {});
@@ -169,12 +169,10 @@ public class DefaultProviderModule imple
         equals("GANGLIA_MONITOR_SERVER").toPredicate();
 
     Set<Resource> hostComponents = provider.getResources(request, predicate);
-    for (Resource hostComponent : hostComponents) {
-      String hostName = hostComponent.getPropertyValue(HOST_COMPONENT_HOST_NAME_PROPERTY_ID);
-      return hostMapping.get(hostName);
-    }
+    // should only be one. TODO add check
+    String hostName = (String) hostComponents.iterator().next().getPropertyValue(HOST_COMPONENT_HOST_NAME_PROPERTY_ID);
 
-    return null;
+    return hostMapping.get(hostName);
   }
 
 }

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/PropertyPredicateVisitor.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/PropertyPredicateVisitor.java?rev=1398884&r1=1398883&r2=1398884&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/PropertyPredicateVisitor.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/PropertyPredicateVisitor.java Tue Oct 16 16:55:05 2012
@@ -32,18 +32,18 @@ import java.util.Map;
  * Predicate visitor for extracting property values from the PropertyPredicates of a predicate graph.
  */
 public class PropertyPredicateVisitor implements PredicateVisitor {
-  private final Map<PropertyId, String> properties = new HashMap<PropertyId, String>();
+  private final Map<PropertyId, Object> properties = new HashMap<PropertyId, Object>();
 
   @Override
   public void acceptComparisonPredicate(ComparisonPredicate predicate) {
-    properties.put(predicate.getPropertyId(), predicate.getValue().toString());
+    properties.put(predicate.getPropertyId(), predicate.getValue());
   }
 
   @Override
   public void acceptArrayPredicate(ArrayPredicate predicate) {
     BasePredicate[] predicates = predicate.getPredicates();
-    for (int i = 0; i < predicates.length; i++) {
-      predicates[i].accept(this);
+    for (BasePredicate predicate1 : predicates) {
+      predicate1.accept(this);
     }
   }
 
@@ -60,7 +60,7 @@ public class PropertyPredicateVisitor im
    *
    * @return the properties
    */
-  public Map<PropertyId, String> getProperties() {
+  public Map<PropertyId, Object> getProperties() {
     return properties;
   }
 }

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestImpl.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestImpl.java?rev=1398884&r1=1398883&r2=1398884&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestImpl.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestImpl.java Tue Oct 16 16:55:05 2012
@@ -41,7 +41,7 @@ public class RequestImpl implements Requ
    * The properties associated with this request.  Used for requests that create
    * resources or update resource values.
    */
-  private final Set<Map<PropertyId, String>> properties;
+  private final Set<Map<PropertyId, Object>> properties;
 
 
   // ----- Constructors ------------------------------------------------------
@@ -52,13 +52,13 @@ public class RequestImpl implements Requ
    * @param propertyIds  the property ids associated with the request; may be null
    * @param properties   the properties associated with the request; may be null
    */
-  public RequestImpl(Set<PropertyId> propertyIds, Set<Map<PropertyId, String>> properties) {
+  public RequestImpl(Set<PropertyId> propertyIds, Set<Map<PropertyId, Object>> properties) {
     this.propertyIds = propertyIds == null ?
         Collections.unmodifiableSet(new HashSet<PropertyId>()) :
         Collections.unmodifiableSet(propertyIds);
 
     this.properties = properties == null ?
-        Collections.unmodifiableSet(new HashSet<Map<PropertyId, String>>()) :
+        Collections.unmodifiableSet(new HashSet<Map<PropertyId, Object>>()) :
         Collections.unmodifiableSet(properties);
   }
 
@@ -71,7 +71,7 @@ public class RequestImpl implements Requ
   }
 
   @Override
-  public Set<Map<PropertyId, String>> getProperties() {
+  public Set<Map<PropertyId, Object>> getProperties() {
     return properties;
   }
 
@@ -105,10 +105,8 @@ public class RequestImpl implements Requ
 
     RequestImpl request = (RequestImpl) o;
 
-    if (properties == null ? request.properties != null : !properties.equals(request.properties)) return false;
-    if (propertyIds == null ? request.propertyIds != null : !propertyIds.equals(request.propertyIds)) return false;
-
-    return true;
+    return !(properties == null ? request.properties != null : !properties.equals(request.properties)) &&
+        !(propertyIds == null ? request.propertyIds != null : !propertyIds.equals(request.propertyIds));
   }
 
   @Override

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ResourceImpl.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ResourceImpl.java?rev=1398884&r1=1398883&r2=1398884&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ResourceImpl.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ResourceImpl.java Tue Oct 16 16:55:05 2012
@@ -37,7 +37,7 @@ public class ResourceImpl implements Res
   /**
    * The map of categories/properties for this resource.
    */
-  private final Map<String, Map<String, String>> categories = new HashMap<String, Map<String, String>>();
+  private final Map<String, Map<String, Object>> categories = new HashMap<String, Map<String, Object>>();
 
 
   // ----- Constructors ------------------------------------------------------
@@ -60,18 +60,18 @@ public class ResourceImpl implements Res
   }
 
   @Override
-  public Map<String, Map<String, String>> getCategories() {
+  public Map<String, Map<String, Object>> getCategories() {
     return categories;
   }
 
   @Override
-  public void setProperty(PropertyId id, String value) {
+  public void setProperty(PropertyId id, Object value) {
     String category = id.getCategory();
 
-    Map<String, String> properties = categories.get(category);
+    Map<String, Object> properties = categories.get(category);
 
     if (properties == null) {
-      properties = new HashMap<String, String>();
+      properties = new HashMap<String, Object>();
       categories.put(category, properties);
     }
 
@@ -79,29 +79,9 @@ public class ResourceImpl implements Res
   }
 
   @Override
-  public void setProperty(PropertyId id, Integer value) {
-    setProperty(id, value.toString());
-  }
-
-  @Override
-  public void setProperty(PropertyId id, Float value) {
-    setProperty(id, value.toString());
-  }
-
-  @Override
-  public void setProperty(PropertyId id, Double value) {
-    setProperty(id, value.toString());
-  }
-
-  @Override
-  public void setProperty(PropertyId id, Long value) {
-    setProperty(id, value.toString());
-  }
-
-  @Override
-  public String getPropertyValue(PropertyId id) {
+  public Object getPropertyValue(PropertyId id) {
 
-    Map<String, String> properties = categories.get(id.getCategory());
+    Map<String, Object> properties = categories.get(id.getCategory());
 
     if (properties != null) {
       return properties.get(id.getName());
@@ -117,8 +97,8 @@ public class ResourceImpl implements Res
     StringBuilder sb = new StringBuilder();
 
     sb.append("Resource : ").append(type).append("\n");
-    for (Map.Entry<String, Map<String, String>> catEntry : categories.entrySet()) {
-      for (Map.Entry<String, String> propEntry : catEntry.getValue().entrySet()) {
+    for (Map.Entry<String, Map<String, Object>> catEntry : categories.entrySet()) {
+      for (Map.Entry<String, Object> propEntry : catEntry.getValue().entrySet()) {
         sb.append("    ").append(catEntry.getKey()).append(".").append(propEntry.getKey()).append(" : ").append(propEntry.getValue()).append("\n");
       }
     }

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ResourceProviderImpl.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ResourceProviderImpl.java?rev=1398884&r1=1398883&r2=1398884&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ResourceProviderImpl.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ResourceProviderImpl.java Tue Oct 16 16:55:05 2012
@@ -18,8 +18,6 @@
 
 package org.apache.ambari.server.controller.internal;
 
-import org.apache.ambari.server.controller.utilities.PredicateHelper;
-import org.apache.ambari.server.controller.utilities.PropertyHelper;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.controller.AmbariManagementController;
 import org.apache.ambari.server.controller.ClusterRequest;
@@ -34,18 +32,16 @@ import org.apache.ambari.server.controll
 import org.apache.ambari.server.controller.ServiceResponse;
 import org.apache.ambari.server.controller.spi.Predicate;
 import org.apache.ambari.server.controller.spi.PropertyId;
-import org.apache.ambari.server.controller.spi.PropertyProvider;
 import org.apache.ambari.server.controller.spi.Request;
 import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.controller.spi.ResourceProvider;
-import org.apache.ambari.server.controller.spi.Schema;
+import org.apache.ambari.server.controller.utilities.PredicateHelper;
+import org.apache.ambari.server.controller.utilities.PropertyHelper;
 
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
@@ -55,11 +51,6 @@ import java.util.Set;
 public abstract class ResourceProviderImpl implements ResourceProvider {
 
   /**
-   * The list of property providers for this provider's resource type.
-   */
-  private final List<PropertyProvider> propertyProviders;
-
-  /**
    * The set of property ids supported by this resource provider.
    */
   private final Set<PropertyId> propertyIds;
@@ -119,7 +110,6 @@ public abstract class ResourceProviderIm
   private ResourceProviderImpl(Set<PropertyId> propertyIds,
                                Map<Resource.Type, PropertyId> keyPropertyIds,
                                AmbariManagementController managementController) {
-    this.propertyProviders    = new LinkedList<PropertyProvider>();
     this.propertyIds          = propertyIds;
     this.keyPropertyIds       = keyPropertyIds;
     this.managementController = managementController;
@@ -149,25 +139,17 @@ public abstract class ResourceProviderIm
     return managementController;
   }
 
-  /**
-   * Add a property provider
-   * @param propertyProvider
-   */
-  public void addPropertyProvider(PropertyProvider propertyProvider) {
-    propertyProviders.add(propertyProvider);
-  }
-
   // ----- utility methods ---------------------------------------------------
 
   protected abstract Set<PropertyId> getPKPropertyIds();
 
-  protected Set<Map<PropertyId, String>> getPropertyMaps(Map<PropertyId, String> requestPropertyMap,
+  protected Set<Map<PropertyId, Object>> getPropertyMaps(Map<PropertyId, Object> requestPropertyMap,
                                                          Predicate predicate)
       throws AmbariException{
 
     Set<PropertyId>              pkPropertyIds       = getPKPropertyIds();
-    Set<Map<PropertyId, String>> properties          = new HashSet<Map<PropertyId, String>>();
-    Set<Map<PropertyId, String>> predicateProperties = new HashSet<Map<PropertyId, String>>();
+    Set<Map<PropertyId, Object>> properties          = new HashSet<Map<PropertyId, Object>>();
+    Set<Map<PropertyId, Object>> predicateProperties = new HashSet<Map<PropertyId, Object>>();
 
     if (predicate != null && pkPropertyIds.equals(PredicateHelper.getPropertyIds(predicate))) {
       predicateProperties.add(getProperties(predicate));
@@ -177,11 +159,11 @@ public abstract class ResourceProviderIm
       }
     }
 
-    for (Map<PropertyId, String> predicatePropertyMap : predicateProperties) {
+    for (Map<PropertyId, Object> predicatePropertyMap : predicateProperties) {
       // get properties from the given request properties
-      Map<PropertyId, String> propertyMap = requestPropertyMap == null ?
-          new HashMap<PropertyId, String>():
-          new HashMap<PropertyId, String>(requestPropertyMap);
+      Map<PropertyId, Object> propertyMap = requestPropertyMap == null ?
+          new HashMap<PropertyId, Object>():
+          new HashMap<PropertyId, Object>(requestPropertyMap);
       // add the pk properties
       setProperties(propertyMap, predicatePropertyMap, pkPropertyIds);
       properties.add(propertyMap);
@@ -196,7 +178,7 @@ public abstract class ResourceProviderIm
    *
    * @return the map of properties
    */
-  private static Map<PropertyId, String> getProperties(Predicate predicate) {
+  private static Map<PropertyId, Object> getProperties(Predicate predicate) {
     if (predicate == null) {
       return Collections.emptyMap();
     }
@@ -212,7 +194,7 @@ public abstract class ResourceProviderIm
    * @param from         the source map
    * @param propertyIds  the set of property ids
    */
-  private static void setProperties(Map<PropertyId, String> to, Map<PropertyId, String> from, Set<PropertyId> propertyIds) {
+  private static void setProperties(Map<PropertyId, Object> to, Map<PropertyId, Object> from, Set<PropertyId> propertyIds) {
     for (PropertyId propertyId : propertyIds) {
       if (from.containsKey(propertyId)) {
         to.put(propertyId, from.get(propertyId));
@@ -323,7 +305,7 @@ public abstract class ResourceProviderIm
     @Override
     public void createResources(Request request) throws AmbariException {
 
-      for (Map<PropertyId, String> properties : request.getProperties()) {
+      for (Map<PropertyId, Object> properties : request.getProperties()) {
         getManagementController().createCluster(getRequest(properties));
       }
     }
@@ -347,7 +329,7 @@ public abstract class ResourceProviderIm
 
     @Override
     public void updateResources(Request request, Predicate predicate) throws AmbariException {
-      for (Map<PropertyId, String> propertyMap : getPropertyMaps(request.getProperties().iterator().next(), predicate)) {
+      for (Map<PropertyId, Object> propertyMap : getPropertyMaps(request.getProperties().iterator().next(), predicate)) {
         ClusterRequest clusterRequest = getRequest(propertyMap);
         getManagementController().updateCluster(clusterRequest);
       }
@@ -355,7 +337,7 @@ public abstract class ResourceProviderIm
 
     @Override
     public void deleteResources(Predicate predicate) throws AmbariException {
-      for (Map<PropertyId, String> propertyMap : getPropertyMaps(null, predicate)) {
+      for (Map<PropertyId, Object> propertyMap : getPropertyMaps(null, predicate)) {
         ClusterRequest clusterRequest = getRequest(propertyMap);
         getManagementController().deleteCluster(clusterRequest);
       }
@@ -375,13 +357,13 @@ public abstract class ResourceProviderIm
      *
      * @return the cluster request object
      */
-    private ClusterRequest getRequest(Map<PropertyId, String> properties) {
+    private ClusterRequest getRequest(Map<PropertyId, Object> properties) {
 
-      String id = properties.get(CLUSTER_ID_PROPERTY_ID);
+      Long id = (Long) properties.get(CLUSTER_ID_PROPERTY_ID);
       return new ClusterRequest(
-          id == null ? null : Long.decode(id),
-          properties.get(CLUSTER_NAME_PROPERTY_ID),
-          properties.get(CLUSTER_VERSION_PROPERTY_ID),
+          id == null ? null : id,
+          (String) properties.get(CLUSTER_NAME_PROPERTY_ID),
+          (String) properties.get(CLUSTER_VERSION_PROPERTY_ID),
           /*properties.get(CLUSTER_HOSTS_PROPERTY_ID)*/ null);
     }
   }
@@ -414,7 +396,7 @@ public abstract class ResourceProviderIm
 
     @Override
     public void createResources(Request request) throws AmbariException {
-      for (Map<PropertyId, String> properties : request.getProperties()) {
+      for (Map<PropertyId, Object> properties : request.getProperties()) {
         getManagementController().createService(getRequest(properties));
       }
     }
@@ -440,7 +422,7 @@ public abstract class ResourceProviderIm
 
     @Override
     public void updateResources(Request request, Predicate predicate) throws AmbariException {
-      for (Map<PropertyId, String> propertyMap : getPropertyMaps(request.getProperties().iterator().next(), predicate)) {
+      for (Map<PropertyId, Object> propertyMap : getPropertyMaps(request.getProperties().iterator().next(), predicate)) {
         ServiceRequest serviceRequest = getRequest(propertyMap);
         getManagementController().updateService(serviceRequest);
       }
@@ -448,7 +430,7 @@ public abstract class ResourceProviderIm
 
     @Override
     public void deleteResources(Predicate predicate) throws AmbariException {
-      for (Map<PropertyId, String> propertyMap : getPropertyMaps(null, predicate)) {
+      for (Map<PropertyId, Object> propertyMap : getPropertyMaps(null, predicate)) {
         ServiceRequest serviceRequest = getRequest(propertyMap);
         getManagementController().deleteService(serviceRequest);
       }
@@ -468,12 +450,12 @@ public abstract class ResourceProviderIm
      *
      * @return the service request object
      */
-    private ServiceRequest getRequest(Map<PropertyId, String> properties) {
+    private ServiceRequest getRequest(Map<PropertyId, Object> properties) {
       return new ServiceRequest(
-          properties.get(SERVICE_CLUSTER_NAME_PROPERTY_ID),
-          properties.get(SERVICE_SERVICE_NAME_PROPERTY_ID),
+          (String) properties.get(SERVICE_CLUSTER_NAME_PROPERTY_ID),
+          (String) properties.get(SERVICE_SERVICE_NAME_PROPERTY_ID),
           null,
-          properties.get(SERVICE_SERVICE_STATE_PROPERTY_ID));
+          (String) properties.get(SERVICE_SERVICE_STATE_PROPERTY_ID));
     }
   }
 
@@ -506,7 +488,7 @@ public abstract class ResourceProviderIm
 
     @Override
     public void createResources(Request request) throws AmbariException {
-      for (Map<PropertyId, String> properties : request.getProperties()) {
+      for (Map<PropertyId, Object> properties : request.getProperties()) {
         getManagementController().createComponent(getRequest(properties));
       }
     }
@@ -533,7 +515,7 @@ public abstract class ResourceProviderIm
 
     @Override
     public void updateResources(Request request, Predicate predicate) throws AmbariException {
-      for (Map<PropertyId, String> propertyMap : getPropertyMaps(request.getProperties().iterator().next(), predicate)) {
+      for (Map<PropertyId, Object> propertyMap : getPropertyMaps(request.getProperties().iterator().next(), predicate)) {
         ServiceComponentRequest serviceComponentRequest = getRequest(propertyMap);
         getManagementController().updateComponent(serviceComponentRequest);
       }
@@ -541,7 +523,7 @@ public abstract class ResourceProviderIm
 
     @Override
     public void deleteResources(Predicate predicate) throws AmbariException {
-      for (Map<PropertyId, String> propertyMap : getPropertyMaps(null, predicate)) {
+      for (Map<PropertyId, Object> propertyMap : getPropertyMaps(null, predicate)) {
         ServiceComponentRequest serviceComponentRequest = getRequest(propertyMap);
         getManagementController().deleteComponent(serviceComponentRequest);
       }
@@ -561,13 +543,13 @@ public abstract class ResourceProviderIm
      *
      * @return the component request object
      */
-    private ServiceComponentRequest getRequest(Map<PropertyId, String> properties) {
+    private ServiceComponentRequest getRequest(Map<PropertyId, Object> properties) {
       return new ServiceComponentRequest(
-          properties.get(COMPONENT_CLUSTER_NAME_PROPERTY_ID),
-          properties.get(COMPONENT_SERVICE_NAME_PROPERTY_ID),
-          properties.get(COMPONENT_COMPONENT_NAME_PROPERTY_ID),
+          (String) properties.get(COMPONENT_CLUSTER_NAME_PROPERTY_ID),
+          (String) properties.get(COMPONENT_SERVICE_NAME_PROPERTY_ID),
+          (String) properties.get(COMPONENT_COMPONENT_NAME_PROPERTY_ID),
           null,
-          properties.get(COMPONENT_STATE_PROPERTY_ID));
+          (String) properties.get(COMPONENT_STATE_PROPERTY_ID));
     }
   }
 
@@ -598,7 +580,7 @@ public abstract class ResourceProviderIm
 
     @Override
     public void createResources(Request request) throws AmbariException {
-      for (Map<PropertyId, String> properties : request.getProperties()) {
+      for (Map<PropertyId, Object> properties : request.getProperties()) {
         getManagementController().createHost(getRequest(properties));
       }
     }
@@ -629,7 +611,7 @@ public abstract class ResourceProviderIm
 
     @Override
     public void updateResources(Request request, Predicate predicate) throws AmbariException {
-      for (Map<PropertyId, String> propertyMap : getPropertyMaps(request.getProperties().iterator().next(), predicate)) {
+      for (Map<PropertyId, Object> propertyMap : getPropertyMaps(request.getProperties().iterator().next(), predicate)) {
         HostRequest hostRequest = getRequest(propertyMap);
         getManagementController().updateHost(hostRequest);
       }
@@ -637,7 +619,7 @@ public abstract class ResourceProviderIm
 
     @Override
     public void deleteResources(Predicate predicate) throws AmbariException {
-      for (Map<PropertyId, String> propertyMap : getPropertyMaps(null, predicate)) {
+      for (Map<PropertyId, Object> propertyMap : getPropertyMaps(null, predicate)) {
         HostRequest hostRequest = getRequest(propertyMap);
         getManagementController().deleteHost(hostRequest);
       }
@@ -657,11 +639,11 @@ public abstract class ResourceProviderIm
      *
      * @return the component request object
      */
-    private HostRequest getRequest(Map<PropertyId, String> properties) {
+    private HostRequest getRequest(Map<PropertyId, Object> properties) {
       return new HostRequest(
-          properties.get(HOST_NAME_PROPERTY_ID),
+          (String)  properties.get(HOST_NAME_PROPERTY_ID),
           // TODO : more than one cluster
-          Collections.singletonList(properties.get(HOST_CLUSTER_NAME_PROPERTY_ID)),
+          Collections.singletonList((String)  properties.get(HOST_CLUSTER_NAME_PROPERTY_ID)),
           null);
     }
   }
@@ -696,7 +678,7 @@ public abstract class ResourceProviderIm
 
     @Override
     public void createResources(Request request) throws AmbariException {
-      for (Map<PropertyId, String> properties : request.getProperties()) {
+      for (Map<PropertyId, Object> properties : request.getProperties()) {
         getManagementController().createHostComponent(getRequest(properties));
       }
     }
@@ -723,7 +705,7 @@ public abstract class ResourceProviderIm
 
     @Override
     public void updateResources(Request request, Predicate predicate) throws AmbariException {
-      for (Map<PropertyId, String> propertyMap : getPropertyMaps(request.getProperties().iterator().next(), predicate)) {
+      for (Map<PropertyId, Object> propertyMap : getPropertyMaps(request.getProperties().iterator().next(), predicate)) {
         ServiceComponentHostRequest hostComponentRequest = getRequest(propertyMap);
         getManagementController().updateHostComponent(hostComponentRequest);
       }
@@ -731,7 +713,7 @@ public abstract class ResourceProviderIm
 
     @Override
     public void deleteResources(Predicate predicate) throws AmbariException {
-      for (Map<PropertyId, String> propertyMap : getPropertyMaps(null, predicate)) {
+      for (Map<PropertyId, Object> propertyMap : getPropertyMaps(null, predicate)) {
         ServiceComponentHostRequest serviceComponentHostRequest = getRequest(propertyMap);
         getManagementController().deleteHostComponent(serviceComponentHostRequest);
       }
@@ -751,14 +733,14 @@ public abstract class ResourceProviderIm
      *
      * @return the component request object
      */
-    private ServiceComponentHostRequest getRequest(Map<PropertyId, String> properties) {
+    private ServiceComponentHostRequest getRequest(Map<PropertyId, Object> properties) {
       return new ServiceComponentHostRequest(
-          properties.get(HOST_COMPONENT_CLUSTER_NAME_PROPERTY_ID),
-          properties.get(HOST_COMPONENT_SERVICE_NAME_PROPERTY_ID),
-          properties.get(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID),
-          properties.get(HOST_COMPONENT_HOST_NAME_PROPERTY_ID),
+          (String) properties.get(HOST_COMPONENT_CLUSTER_NAME_PROPERTY_ID),
+          (String) properties.get(HOST_COMPONENT_SERVICE_NAME_PROPERTY_ID),
+          (String) properties.get(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID),
+          (String) properties.get(HOST_COMPONENT_HOST_NAME_PROPERTY_ID),
           null,
-          properties.get(HOST_COMPONENT_STATE_PROPERTY_ID));
+          (String) properties.get(HOST_COMPONENT_STATE_PROPERTY_ID));
     }
   }
 }

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/jdbc/JDBCManagementController.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/jdbc/JDBCManagementController.java?rev=1398884&r1=1398883&r2=1398884&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/jdbc/JDBCManagementController.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/jdbc/JDBCManagementController.java Tue Oct 16 16:55:05 2012
@@ -214,9 +214,9 @@ public class JDBCManagementController im
 
       try {
 
-        Set<Map<PropertyId, String>> propertySet = request.getProperties();
+        Set<Map<PropertyId, Object>> propertySet = request.getProperties();
 
-        for (Map<PropertyId, String> properties : propertySet) {
+        for (Map<PropertyId, Object> properties : propertySet) {
           String sql = getInsertSQL(resourceTables.get(type), properties);
 
           Statement statement = connection.createStatement();
@@ -301,9 +301,9 @@ public class JDBCManagementController im
     try {
       Connection connection = connectionFactory.getConnection();
       try {
-        Set<Map<PropertyId, String>> propertySet = request.getProperties();
+        Set<Map<PropertyId, Object>> propertySet = request.getProperties();
 
-        Map<PropertyId, String> properties = propertySet.iterator().next();
+        Map<PropertyId, Object> properties = propertySet.iterator().next();
 
         String resourceTable = resourceTables.get(type);
 
@@ -476,12 +476,12 @@ public class JDBCManagementController im
    *
    * @return the insert SQL
    */
-  private String getInsertSQL(String table, Map<PropertyId, String> properties) {
+  private String getInsertSQL(String table, Map<PropertyId, Object> properties) {
 
     StringBuilder columns = new StringBuilder();
     StringBuilder values = new StringBuilder();
 
-    for (Map.Entry<PropertyId, String> entry : properties.entrySet()) {
+    for (Map.Entry<PropertyId, Object> entry : properties.entrySet()) {
       PropertyId propertyId = entry.getKey();
       Object propertyValue = entry.getValue();
 
@@ -619,7 +619,7 @@ public class JDBCManagementController im
    *
    * @return the update SQL statement
    */
-  private String getUpdateSQL(String table, Map<PropertyId, String> properties, Predicate predicate) {
+  private String getUpdateSQL(String table, Map<PropertyId, Object> properties, Predicate predicate) {
 
     if (predicate instanceof BasePredicate) {
 
@@ -632,7 +632,7 @@ public class JDBCManagementController im
       whereClause.append(visitor.getSQL());
 
       StringBuilder setClause = new StringBuilder();
-      for (Map.Entry<PropertyId, String> entry : properties.entrySet()) {
+      for (Map.Entry<PropertyId, Object> entry : properties.entrySet()) {
 
         if (setClause.length() > 0) {
           setClause.append(", ");

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/jdbc/JDBCProviderModule.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/jdbc/JDBCProviderModule.java?rev=1398884&r1=1398883&r2=1398884&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/jdbc/JDBCProviderModule.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/jdbc/JDBCProviderModule.java Tue Oct 16 16:55:05 2012
@@ -144,7 +144,7 @@ public class JDBCProviderModule implemen
 
     Set<Resource> hosts = hostProvider.getResources(request, null);
     for (Resource host : hosts) {
-      String attributes = host.getPropertyValue(HOST_ATTRIBUTES_PROPERTY_ID);
+      String attributes = (String) host.getPropertyValue(HOST_ATTRIBUTES_PROPERTY_ID);
       if (attributes != null && !attributes.startsWith("[]")) {
         try {
           Map<String, String> attributeMap = mapper.readValue(attributes, new TypeReference<Map<String, String>>() {});
@@ -166,7 +166,7 @@ public class JDBCProviderModule implemen
 
     Set<Resource> hostComponents = provider.getResources(request, predicate);
     for (Resource hostComponent : hostComponents) {
-      String hostName = hostComponent.getPropertyValue(HOST_COMPONENT_HOST_NAME_PROPERTY_ID);
+      String hostName = (String) hostComponent.getPropertyValue(HOST_COMPONENT_HOST_NAME_PROPERTY_ID);
       return hostMapping.get(hostName);
     }
 

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/jdbc/JDBCResourceProvider.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/jdbc/JDBCResourceProvider.java?rev=1398884&r1=1398883&r2=1398884&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/jdbc/JDBCResourceProvider.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/jdbc/JDBCResourceProvider.java Tue Oct 16 16:55:05 2012
@@ -123,9 +123,9 @@ public class JDBCResourceProvider implem
 
       try {
 
-        Set<Map<PropertyId, String>> propertySet = request.getProperties();
+        Set<Map<PropertyId, Object>> propertySet = request.getProperties();
 
-        for (Map<PropertyId, String> properties : propertySet) {
+        for (Map<PropertyId, Object> properties : propertySet) {
           String sql = getInsertSQL(properties);
 
           Statement statement = connection.createStatement();
@@ -147,9 +147,9 @@ public class JDBCResourceProvider implem
     try {
       Connection connection = connectionFactory.getConnection();
       try {
-        Set<Map<PropertyId, String>> propertySet = request.getProperties();
+        Set<Map<PropertyId, Object>> propertySet = request.getProperties();
 
-        Map<PropertyId, String> properties = propertySet.iterator().next();
+        Map<PropertyId, Object> properties = propertySet.iterator().next();
 
         String sql = getUpdateSQL(properties, predicate);
 
@@ -184,16 +184,16 @@ public class JDBCResourceProvider implem
   }
 
 
-  private String getInsertSQL(Map<PropertyId, String> properties) {
+  private String getInsertSQL(Map<PropertyId, Object> properties) {
 
     StringBuilder columns = new StringBuilder();
     StringBuilder values = new StringBuilder();
     String table = null;
 
 
-    for (Map.Entry<PropertyId, String> entry : properties.entrySet()) {
+    for (Map.Entry<PropertyId, Object> entry : properties.entrySet()) {
       PropertyId propertyId    = entry.getKey();
-      String     propertyValue = entry.getValue();
+      Object     propertyValue = entry.getValue();
 
       table = propertyId.getCategory();
 
@@ -304,7 +304,7 @@ public class JDBCResourceProvider implem
     throw new IllegalStateException("Can't generate SQL.");
   }
 
-  private String getUpdateSQL(Map<PropertyId, String> properties, Predicate predicate) {
+  private String getUpdateSQL(Map<PropertyId, Object> properties, Predicate predicate) {
 
     if (predicate instanceof BasePredicate) {
 
@@ -320,7 +320,7 @@ public class JDBCResourceProvider implem
 
 
       StringBuilder setClause = new StringBuilder();
-      for (Map.Entry<PropertyId, String> entry : properties.entrySet()) {
+      for (Map.Entry<PropertyId, Object> entry : properties.entrySet()) {
 
         if (setClause.length() > 0) {
           setClause.append(", ");

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXMetricHolder.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXMetricHolder.java?rev=1398884&r1=1398883&r2=1398884&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXMetricHolder.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXMetricHolder.java Tue Oct 16 16:55:05 2012
@@ -26,13 +26,13 @@ import java.util.Map;
  */
 public class JMXMetricHolder {
 
-  private List<Map<String, String>> beans;
+  private List<Map<String, Object>> beans;
 
-  public List<Map<String, String>> getBeans() {
+  public List<Map<String, Object>> getBeans() {
     return beans;
   }
 
-  public void setBeans(List<Map<String, String>> beans) {
+  public void setBeans(List<Map<String, Object>> beans) {
     this.beans = beans;
   }
 
@@ -40,9 +40,9 @@ public class JMXMetricHolder {
   public String toString() {
     StringBuilder stringBuilder = new StringBuilder();
 
-    for (Map<String, String> map : beans) {
-      for (Map.Entry<String, String> entry : map.entrySet()) {
-        stringBuilder.append("    " + entry.toString() + "\n");
+    for (Map<String, Object> map : beans) {
+      for (Map.Entry<String, Object> entry : map.entrySet()) {
+        stringBuilder.append("    ").append(entry.toString()).append("\n");
       }
     }
     return stringBuilder.toString();

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXPropertyProvider.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXPropertyProvider.java?rev=1398884&r1=1398883&r2=1398884&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXPropertyProvider.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXPropertyProvider.java Tue Oct 16 16:55:05 2012
@@ -43,6 +43,7 @@ public class JMXPropertyProvider impleme
   protected static final PropertyId HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID = PropertyHelper.getPropertyId("component_name", "HostRoles");
 
   private static final String CATEGORY_KEY = "tag.context";
+//  private static final String NAME_KEY     = "name";
 
   /**
    * Set of property ids supported by this provider.
@@ -128,7 +129,7 @@ public class JMXPropertyProvider impleme
 
     Set<PropertyId> ids = PropertyHelper.getRequestPropertyIds(getPropertyIds(), request, predicate);
 
-    String hostName = hostMapping.get(resource.getPropertyValue(HOST_COMPONENT_HOST_NAME_PROPERTY_ID));
+    String hostName = hostMapping.get( resource.getPropertyValue(HOST_COMPONENT_HOST_NAME_PROPERTY_ID));
     String port     = JMX_PORTS.get(resource.getPropertyValue(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID));
 
     if (hostName == null || port == null) {
@@ -139,10 +140,10 @@ public class JMXPropertyProvider impleme
 
     try {
       JMXMetricHolder metricHolder = new ObjectMapper().readValue(streamProvider.readFrom(spec), JMXMetricHolder.class);
-      for (Map<String, String> propertyMap : metricHolder.getBeans()) {
-        String category = propertyMap.get(CATEGORY_KEY);
+      for (Map<String, Object> bean : metricHolder.getBeans()) {
+        String category = getCategory(bean);
         if (category != null) {
-          for (Map.Entry<String, String> entry : propertyMap.entrySet()) {
+          for (Map.Entry<String, Object> entry : bean.entrySet()) {
 
             PropertyId propertyId = PropertyHelper.getPropertyId(entry.getKey(), category);
 
@@ -159,6 +160,22 @@ public class JMXPropertyProvider impleme
     return true;
   }
 
+  private String getCategory(Map<String, Object> bean) {
+    if (bean.containsKey(CATEGORY_KEY)) {
+      return (String) bean.get(CATEGORY_KEY);
+    }
+//    if (bean.containsKey(NAME_KEY)) {
+//      try {
+//        ObjectName objectName = new ObjectName((String) bean.get(NAME_KEY));
+//
+//
+//      } catch (MalformedObjectNameException e) {
+//        // TODO : log this
+//      }
+//    }
+    return null;
+  }
+
   /**
    * Get the spec to locate the JMX stream from the given source
    *

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/ComparisonPredicate.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/ComparisonPredicate.java?rev=1398884&r1=1398883&r2=1398884&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/ComparisonPredicate.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/ComparisonPredicate.java Tue Oct 16 16:55:05 2012
@@ -24,15 +24,15 @@ import org.apache.ambari.server.controll
 /**
  * Predicate that compares a given value to a {@link Resource} property.
  */
-public abstract class ComparisonPredicate extends PropertyPredicate implements BasePredicate {
-  private final Comparable<String> value;
+public abstract class ComparisonPredicate<T> extends PropertyPredicate implements BasePredicate {
+  private final Comparable<T> value;
 
-  public ComparisonPredicate(PropertyId propertyId, Comparable<String> value) {
+  public ComparisonPredicate(PropertyId propertyId, Comparable<T> value) {
     super(propertyId);
     this.value = value;
   }
 
-  public Comparable<String> getValue() {
+  public Comparable<T> getValue() {
     return value;
   }
 
@@ -44,9 +44,7 @@ public abstract class ComparisonPredicat
 
     ComparisonPredicate that = (ComparisonPredicate) o;
 
-    if (value != null ? !value.equals(that.value) : that.value != null) return false;
-
-    return true;
+    return !(value != null ? !value.equals(that.value) : that.value != null);
   }
 
   @Override

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/EqualsPredicate.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/EqualsPredicate.java?rev=1398884&r1=1398883&r2=1398884&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/EqualsPredicate.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/EqualsPredicate.java Tue Oct 16 16:55:05 2012
@@ -24,17 +24,17 @@ import org.apache.ambari.server.controll
 /**
  * Predicate that checks equality of a given value to a {@link Resource} property.
  */
-public class EqualsPredicate extends ComparisonPredicate {
+public class EqualsPredicate<T> extends ComparisonPredicate {
 
 
-  public EqualsPredicate(PropertyId propertyId, Comparable<String> value) {
+  public EqualsPredicate(PropertyId propertyId, Comparable<T> value) {
     super(propertyId, value);
   }
 
   @Override
   public boolean evaluate(Resource resource) {
-    String propertyValue = resource.getPropertyValue(getPropertyId());
-    return propertyValue == null ? false : getValue().compareTo(propertyValue) == 0;
+    Object propertyValue = resource.getPropertyValue(getPropertyId());
+    return propertyValue != null && getValue().compareTo(propertyValue) == 0;
   }
 
   @Override

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/GreaterEqualsPredicate.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/GreaterEqualsPredicate.java?rev=1398884&r1=1398883&r2=1398884&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/GreaterEqualsPredicate.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/GreaterEqualsPredicate.java Tue Oct 16 16:55:05 2012
@@ -24,16 +24,16 @@ import org.apache.ambari.server.controll
 /**
  * Predicate that checks if a given value is greater than or equal to a {@link Resource} property.
  */
-public class GreaterEqualsPredicate extends ComparisonPredicate {
+public class GreaterEqualsPredicate<T> extends ComparisonPredicate {
 
-  public GreaterEqualsPredicate(PropertyId propertyId, Comparable<String> value) {
+  public GreaterEqualsPredicate(PropertyId propertyId, Comparable<T> value) {
     super(propertyId, value);
   }
 
   @Override
   public boolean evaluate(Resource resource) {
-    String propertyValue = resource.getPropertyValue(getPropertyId());
-    return propertyValue == null ? false : getValue().compareTo(propertyValue) <= 0;
+    Object propertyValue = resource.getPropertyValue(getPropertyId());
+    return propertyValue != null && getValue().compareTo(propertyValue) <= 0;
   }
 
   @Override

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/GreaterPredicate.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/GreaterPredicate.java?rev=1398884&r1=1398883&r2=1398884&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/GreaterPredicate.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/GreaterPredicate.java Tue Oct 16 16:55:05 2012
@@ -23,16 +23,16 @@ import org.apache.ambari.server.controll
 /**
  * Predicate that checks if a given value is greater than a {@link Resource} property.
  */
-public class GreaterPredicate extends ComparisonPredicate {
+public class GreaterPredicate<T> extends ComparisonPredicate {
 
-  public GreaterPredicate(PropertyId propertyId, Comparable<String> value) {
+  public GreaterPredicate(PropertyId propertyId, Comparable<T> value) {
     super(propertyId, value);
   }
 
   @Override
   public boolean evaluate(Resource resource) {
-    String propertyValue = resource.getPropertyValue(getPropertyId());
-    return propertyValue == null ? false : getValue().compareTo(propertyValue) < 0;
+    Object propertyValue = resource.getPropertyValue(getPropertyId());
+    return propertyValue != null && getValue().compareTo(propertyValue) < 0;
   }
 
   @Override

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/LessEqualsPredicate.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/LessEqualsPredicate.java?rev=1398884&r1=1398883&r2=1398884&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/LessEqualsPredicate.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/LessEqualsPredicate.java Tue Oct 16 16:55:05 2012
@@ -24,16 +24,16 @@ import org.apache.ambari.server.controll
 /**
  * Predicate that checks if a given value is less than or equal to a {@link Resource} property.
  */
-public class LessEqualsPredicate extends ComparisonPredicate {
+public class LessEqualsPredicate<T> extends ComparisonPredicate {
 
-  public LessEqualsPredicate(PropertyId propertyId, Comparable<String> value) {
+  public LessEqualsPredicate(PropertyId propertyId, Comparable<T> value) {
     super(propertyId, value);
   }
 
   @Override
   public boolean evaluate(Resource resource) {
-    String propertyValue = resource.getPropertyValue(getPropertyId());
-    return propertyValue == null ? false : getValue().compareTo(propertyValue) >= 0;
+    Object propertyValue = resource.getPropertyValue(getPropertyId());
+    return propertyValue != null && getValue().compareTo(propertyValue) >= 0;
   }
 
   @Override

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/LessPredicate.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/LessPredicate.java?rev=1398884&r1=1398883&r2=1398884&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/LessPredicate.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/LessPredicate.java Tue Oct 16 16:55:05 2012
@@ -23,16 +23,16 @@ import org.apache.ambari.server.controll
 /**
  * Predicate that checks if a given value is less than a {@link Resource} property.
  */
-public class LessPredicate extends ComparisonPredicate {
+public class LessPredicate<T> extends ComparisonPredicate {
 
-  public LessPredicate(PropertyId propertyId, Comparable<String> value) {
+  public LessPredicate(PropertyId propertyId, Comparable<T> value) {
     super(propertyId, value);
   }
 
   @Override
   public boolean evaluate(Resource resource) {
-    String propertyValue = resource.getPropertyValue(getPropertyId());
-    return propertyValue == null ? false : getValue().compareTo(propertyValue) > 0;
+    Object propertyValue = resource.getPropertyValue(getPropertyId());
+    return propertyValue != null && getValue().compareTo(propertyValue) > 0;
   }
 
   @Override

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/spi/Request.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/spi/Request.java?rev=1398884&r1=1398883&r2=1398884&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/spi/Request.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/spi/Request.java Tue Oct 16 16:55:05 2012
@@ -45,7 +45,7 @@ public interface Request {
    *
    * @return the set of properties being requested
    */
-  public Set<Map<PropertyId, String>> getProperties();
+  public Set<Map<PropertyId, Object>> getProperties();
 
   /**
    * Get the {@link TemporalInfo temporal information} for the given property

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/spi/Resource.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/spi/Resource.java?rev=1398884&r1=1398883&r2=1398884&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/spi/Resource.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/spi/Resource.java Tue Oct 16 16:55:05 2012
@@ -38,47 +38,15 @@ public interface Resource {
    *
    * @return the map of categories
    */
-  public Map<String, Map<String, String>> getCategories();
+  public Map<String, Map<String, Object>> getCategories();
 
   /**
-   * Set a string property value for the given property id on this resource.
+   * Set a property value for the given property id on this resource.
    *
    * @param id    the property id
    * @param value the value
    */
-  public void setProperty(PropertyId id, String value);
-
-  /**
-   * Set a integer property value for the given property id on this resource.
-   *
-   * @param id    the property id
-   * @param value the value
-   */
-  public void setProperty(PropertyId id, Integer value);
-
-  /**
-   * Set a float property value for the given property id on this resource.
-   *
-   * @param id    the property id
-   * @param value the value
-   */
-  public void setProperty(PropertyId id, Float value);
-
-  /**
-   * Set a double property value for the given property id on this resource.
-   *
-   * @param id    the property id
-   * @param value the value
-   */
-  public void setProperty(PropertyId id, Double value);
-
-  /**
-   * Set a long property value for the given property id on this resource.
-   *
-   * @param id    the property id
-   * @param value the value
-   */
-  public void setProperty(PropertyId id, Long value);
+  public void setProperty(PropertyId id, Object value);
 
   /**
    * Get a property value for the given property id from this resource.
@@ -86,7 +54,7 @@ public interface Resource {
    * @param id the property id
    * @return the property value
    */
-  public String getPropertyValue(PropertyId id);
+  public Object getPropertyValue(PropertyId id);
 
   /**
    * Resource types.

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PredicateBuilder.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PredicateBuilder.java?rev=1398884&r1=1398883&r2=1398884&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PredicateBuilder.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PredicateBuilder.java Tue Oct 16 16:55:05 2012
@@ -20,7 +20,6 @@ package org.apache.ambari.server.control
 import org.apache.ambari.server.controller.internal.PropertyIdImpl;
 import org.apache.ambari.server.controller.predicate.AndPredicate;
 import org.apache.ambari.server.controller.predicate.BasePredicate;
-import org.apache.ambari.server.controller.predicate.Comparables;
 import org.apache.ambari.server.controller.predicate.EqualsPredicate;
 import org.apache.ambari.server.controller.predicate.GreaterEqualsPredicate;
 import org.apache.ambari.server.controller.predicate.GreaterPredicate;
@@ -82,7 +81,6 @@ public class PredicateBuilder {
     return this;
   }
 
-
   public PredicateBuilder begin() {
     checkDone();
     return new PredicateBuilder(this);
@@ -147,134 +145,54 @@ public class PredicateBuilder {
   public class PredicateBuilderWithProperty {
 
     // ----- Equals -----
-    public PredicateBuilderWithPredicate equals(Comparable<String> value) {
+    public <T>PredicateBuilderWithPredicate equals(Comparable<T> value) {
       if (propertyId == null) {
         throw new IllegalStateException("No property.");
       }
-      addPredicate(new EqualsPredicate(propertyId, value));
+      addPredicate(new EqualsPredicate<T>(propertyId, value));
 
       return new PredicateBuilderWithPredicate();
     }
 
-    public PredicateBuilderWithPredicate equals(Integer value) {
-      return equals(Comparables.forInteger(value));
-    }
-
-    public PredicateBuilderWithPredicate equals(Float value) {
-      return equals(Comparables.forFloat(value));
-    }
-
-    public PredicateBuilderWithPredicate equals(Double value) {
-      return equals(Comparables.forDouble(value));
-    }
-
-    public PredicateBuilderWithPredicate equals(Long value) {
-      return equals(Comparables.forLong(value));
-    }
-
     // ----- Greater than -----
-    public PredicateBuilderWithPredicate greaterThan(Comparable<String> value) {
+    public <T>PredicateBuilderWithPredicate greaterThan(Comparable<T> value) {
       if (propertyId == null) {
         throw new IllegalStateException("No property.");
       }
-      addPredicate(new GreaterPredicate(propertyId, value));
+      addPredicate(new GreaterPredicate<T>(propertyId, value));
 
       return new PredicateBuilderWithPredicate();
     }
 
-    public PredicateBuilderWithPredicate greaterThan(Integer value) {
-      return greaterThan(Comparables.forInteger(value));
-    }
-
-    public PredicateBuilderWithPredicate greaterThan(Float value) {
-      return greaterThan(Comparables.forFloat(value));
-    }
-
-    public PredicateBuilderWithPredicate greaterThan(Double value) {
-      return greaterThan(Comparables.forDouble(value));
-    }
-
-    public PredicateBuilderWithPredicate greaterThan(Long value) {
-      return greaterThan(Comparables.forLong(value));
-    }
-
     // ----- Greater than equal to -----
-    public PredicateBuilderWithPredicate greaterThanEqualTo(Comparable<String> value) {
+    public <T>PredicateBuilderWithPredicate greaterThanEqualTo(Comparable<T> value) {
       if (propertyId == null) {
         throw new IllegalStateException("No property.");
       }
-      addPredicate(new GreaterEqualsPredicate(propertyId, value));
+      addPredicate(new GreaterEqualsPredicate<T>(propertyId, value));
 
       return new PredicateBuilderWithPredicate();
     }
 
-    public PredicateBuilderWithPredicate greaterThanEqualTo(Integer value) {
-      return greaterThanEqualTo(Comparables.forInteger(value));
-    }
-
-    public PredicateBuilderWithPredicate greaterThanEqualTo(Float value) {
-      return greaterThanEqualTo(Comparables.forFloat(value));
-    }
-
-    public PredicateBuilderWithPredicate greaterThanEqualTo(Double value) {
-      return greaterThanEqualTo(Comparables.forDouble(value));
-    }
-
-    public PredicateBuilderWithPredicate greaterThanEqualTo(Long value) {
-      return greaterThanEqualTo(Comparables.forLong(value));
-    }
-
     // ----- Less than -----
-    public PredicateBuilderWithPredicate lessThan(Comparable<String> value) {
+    public <T>PredicateBuilderWithPredicate lessThan(Comparable<T> value) {
       if (propertyId == null) {
         throw new IllegalStateException("No property.");
       }
-      addPredicate(new LessPredicate(propertyId, value));
+      addPredicate(new LessPredicate<T>(propertyId, value));
 
       return new PredicateBuilderWithPredicate();
     }
 
-    public PredicateBuilderWithPredicate lessThan(Integer value) {
-      return lessThan(Comparables.forInteger(value));
-    }
-
-    public PredicateBuilderWithPredicate lessThan(Float value) {
-      return lessThan(Comparables.forFloat(value));
-    }
-
-    public PredicateBuilderWithPredicate lessThan(Double value) {
-      return lessThan(Comparables.forDouble(value));
-    }
-
-    public PredicateBuilderWithPredicate lessThan(Long value) {
-      return lessThan(Comparables.forLong(value));
-    }
-
     // ----- Less than equal to -----
-    public PredicateBuilderWithPredicate lessThanEqualTo(Comparable<String> value) {
+    public <T>PredicateBuilderWithPredicate lessThanEqualTo(Comparable<T> value) {
       if (propertyId == null) {
         throw new IllegalStateException("No property.");
       }
-      addPredicate(new LessEqualsPredicate(propertyId, value));
+      addPredicate(new LessEqualsPredicate<T>(propertyId, value));
 
       return new PredicateBuilderWithPredicate();
     }
-
-    public PredicateBuilderWithPredicate lessThanEqualTo(Integer value) {
-      return lessThanEqualTo(Comparables.forInteger(value));
-    }
-
-    public PredicateBuilderWithPredicate lessThanEqualTo(Float value) {
-      return lessThanEqualTo(Comparables.forFloat(value));
-    }
-
-    public PredicateBuilderWithPredicate lessThanEqualTo(Double value) {
-      return lessThanEqualTo(Comparables.forDouble(value));
-    }
-
-    public PredicateBuilderWithPredicate lessThanEqualTo(Long value) {
-      return lessThanEqualTo(Comparables.forLong(value));
-    }
   }
 
   public class PredicateBuilderWithPredicate {

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PropertyHelper.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PropertyHelper.java?rev=1398884&r1=1398883&r2=1398884&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PropertyHelper.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PropertyHelper.java Tue Oct 16 16:55:05 2012
@@ -30,7 +30,6 @@ import java.io.IOException;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 
@@ -103,13 +102,13 @@ public class PropertyHelper {
    *
    * @return the map of properties for the given resource
    */
-  public static Map<PropertyId, String> getProperties(Resource resource) {
-    Map<PropertyId, String> properties = new HashMap<PropertyId, String>();
+  public static Map<PropertyId, Object> getProperties(Resource resource) {
+    Map<PropertyId, Object> properties = new HashMap<PropertyId, Object>();
 
-    Map<String, Map<String, String>> categories = resource.getCategories();
+    Map<String, Map<String, Object>> categories = resource.getCategories();
 
-    for (Map.Entry<String, Map<String, String>> categoryEntry : categories.entrySet()) {
-      for (Map.Entry<String, String>  propertyEntry : categoryEntry.getValue().entrySet()) {
+    for (Map.Entry<String, Map<String, Object>> categoryEntry : categories.entrySet()) {
+      for (Map.Entry<String, Object>  propertyEntry : categoryEntry.getValue().entrySet()) {
 
         properties.put(PropertyHelper.getPropertyId(propertyEntry.getKey(), categoryEntry.getKey()), propertyEntry.getValue());
       }
@@ -181,7 +180,7 @@ public class PropertyHelper {
    *
    * @param properties   the properties associated with the request; may be null
    */
-  public static Request getCreateRequest(Set<Map<PropertyId, String>> properties) {
+  public static Request getCreateRequest(Set<Map<PropertyId, Object>> properties) {
     return new RequestImpl(null,  properties);
   }
 
@@ -201,7 +200,7 @@ public class PropertyHelper {
    *
    * @param properties   the properties associated with the request; may be null
    */
-  public static Request getUpdateRequest(Map<PropertyId, String> properties) {
+  public static Request getUpdateRequest(Map<PropertyId, Object> properties) {
     return new RequestImpl(null,  Collections.singleton(properties));
   }
 

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/api/services/CreatePersistenceManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/api/services/CreatePersistenceManagerTest.java?rev=1398884&r1=1398883&r2=1398884&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/api/services/CreatePersistenceManagerTest.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/api/services/CreatePersistenceManagerTest.java Tue Oct 16 16:55:05 2012
@@ -51,7 +51,7 @@ public class CreatePersistenceManagerTes
     mapResourceIds.put(Resource.Type.Cluster, "clusterId");
     mapResourceIds.put(Resource.Type.Service, "serviceId");
 
-    Map<PropertyId, String> mapProperties = new HashMap<PropertyId, String>();
+    Map<PropertyId, Object> mapProperties = new HashMap<PropertyId, Object>();
     mapProperties.put(clusterId, "clusterId");
     mapProperties.put(serviceId, "serviceId");
     mapProperties.put(PropertyHelper.getPropertyId("bar", "foo"), "value");
@@ -80,10 +80,10 @@ public class CreatePersistenceManagerTes
 
     private ClusterController m_controller;
     private org.apache.ambari.server.controller.spi.Request m_request;
-    private Map<PropertyId, String> m_mapProperties;
+    private Map<PropertyId, Object> m_mapProperties;
 
     private TestCreatePersistenceManager(ClusterController controller,
-                                         Map<PropertyId, String> mapProperties,
+                                         Map<PropertyId, Object> mapProperties,
                                          org.apache.ambari.server.controller.spi.Request controllerRequest) {
       m_controller = controller;
       m_mapProperties = mapProperties;
@@ -96,7 +96,7 @@ public class CreatePersistenceManagerTes
     }
 
     @Override
-    protected org.apache.ambari.server.controller.spi.Request createControllerRequest(Map<PropertyId, String> properties) {
+    protected org.apache.ambari.server.controller.spi.Request createControllerRequest(Map<PropertyId, Object> properties) {
       assertEquals(m_mapProperties, properties);
       return m_request;
     }

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/api/services/UpdatePersistenceManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/api/services/UpdatePersistenceManagerTest.java?rev=1398884&r1=1398883&r2=1398884&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/api/services/UpdatePersistenceManagerTest.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/api/services/UpdatePersistenceManagerTest.java Tue Oct 16 16:55:05 2012
@@ -47,7 +47,7 @@ public class UpdatePersistenceManagerTes
     Predicate predicate = createMock(Predicate.class);
 
 
-    Map<PropertyId, String> mapProperties = new HashMap<PropertyId, String>();
+    Map<PropertyId, Object> mapProperties = new HashMap<PropertyId, Object>();
     mapProperties.put(PropertyHelper.getPropertyId("bar", "foo"), "value");
 
     //expectations
@@ -69,10 +69,10 @@ public class UpdatePersistenceManagerTes
 
     private ClusterController m_controller;
     private org.apache.ambari.server.controller.spi.Request m_request;
-    private Map<PropertyId, String> m_mapProperties;
+    private Map<PropertyId, Object> m_mapProperties;
 
     private TestUpdatePersistenceManager(ClusterController controller,
-                                         Map<PropertyId, String> mapProperties,
+                                         Map<PropertyId, Object> mapProperties,
                                          org.apache.ambari.server.controller.spi.Request controllerRequest) {
       m_controller = controller;
       m_mapProperties = mapProperties;
@@ -85,7 +85,7 @@ public class UpdatePersistenceManagerTes
     }
 
     @Override
-    protected org.apache.ambari.server.controller.spi.Request createControllerRequest(Map<PropertyId, String> properties) {
+    protected org.apache.ambari.server.controller.spi.Request createControllerRequest(Map<PropertyId, Object> properties) {
       assertEquals(m_mapProperties, properties);
       return m_request;
     }

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ResourceImplTest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ResourceImplTest.java?rev=1398884&r1=1398883&r2=1398884&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ResourceImplTest.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ResourceImplTest.java Tue Oct 16 16:55:05 2012
@@ -56,15 +56,15 @@ public class ResourceImplTest {
     Assert.assertEquals("foo", resource.getPropertyValue(propertyId));
 
     resource.setProperty(propertyId, 1);
-    Assert.assertEquals("1", resource.getPropertyValue(propertyId));
+    Assert.assertEquals(1, resource.getPropertyValue(propertyId));
 
     resource.setProperty(propertyId, (float) 1.99);
-    Assert.assertEquals("1.99", resource.getPropertyValue(propertyId));
+    Assert.assertEquals((float) 1.99, resource.getPropertyValue(propertyId));
 
     resource.setProperty(propertyId, 1.99);
-    Assert.assertEquals("1.99", resource.getPropertyValue(propertyId));
+    Assert.assertEquals(1.99, resource.getPropertyValue(propertyId));
 
     resource.setProperty(propertyId, 65L);
-    Assert.assertEquals("65", resource.getPropertyValue(propertyId));
+    Assert.assertEquals(65L, resource.getPropertyValue(propertyId));
   }
 }



Mime
View raw message