ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yus...@apache.org
Subject [24/29] ambari git commit: AMBARI-8269. Merge branch-windows-dev changes to trunk. (Jayush Luniya via yusaku)
Date Fri, 14 Nov 2014 02:20:06 GMT
http://git-wip-us.apache.org/repos/asf/ambari/blob/8de3425f/ambari-server/src/main/java/org/apache/ambari/server/controller/sql/HostInfoProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/sql/HostInfoProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/sql/HostInfoProvider.java
new file mode 100644
index 0000000..08bbe71
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/sql/HostInfoProvider.java
@@ -0,0 +1,63 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.controller.sql;
+
+import org.apache.ambari.server.controller.spi.SystemException;
+
+/**
+ * Provider of host information.
+ */
+public interface HostInfoProvider {
+
+  /**
+   * Get the host name for the given cluster name and component name.
+   *
+   * @param clusterName    the cluster name
+   * @param componentName  the component name
+   *
+   * @return the host name
+   *
+   * @throws SystemException if unable to get the host name
+   */
+  public String getHostName(String clusterName, String componentName)
+      throws SystemException;
+
+  /**
+   * Get the host name.
+   *
+   * @param id  the host identifier
+   *
+   * @return the host name
+   *
+   * @throws SystemException if unable to get the host name
+   */
+  public String getHostName(String id)
+      throws SystemException;
+
+  /**
+   * Get the host ip address.
+   *
+   * @param id  the host identifier
+   *
+   * @return the host ip address
+   *
+   * @throws SystemException if unable to get the host address
+   */
+  public String getHostAddress(String id)
+      throws SystemException;
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/8de3425f/ambari-server/src/main/java/org/apache/ambari/server/controller/sql/SQLPropertyProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/sql/SQLPropertyProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/sql/SQLPropertyProvider.java
new file mode 100644
index 0000000..30f82fe
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/sql/SQLPropertyProvider.java
@@ -0,0 +1,572 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.server.controller.sql;
+
+import org.apache.ambari.server.controller.internal.AbstractPropertyProvider;
+import org.apache.ambari.server.controller.internal.PropertyInfo;
+import org.apache.ambari.server.controller.jdbc.ConnectionFactory;
+import org.apache.ambari.server.controller.spi.Predicate;
+import org.apache.ambari.server.controller.spi.Request;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.controller.spi.SystemException;
+import org.apache.ambari.server.controller.spi.TemporalInfo;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.Serializable;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.text.NumberFormat;
+import java.text.ParsePosition;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * SQL based property/metrics provider required for ambari-scom.
+ */
+public class SQLPropertyProvider extends AbstractPropertyProvider {
+
+  private final HostInfoProvider hostProvider;
+
+  private final String clusterNamePropertyId;
+
+  private final String hostNamePropertyId;
+
+  private final String componentNamePropertyId;
+
+  private final String serviceNamePropertyId;
+
+  private final ConnectionFactory connectionFactory;
+
+
+  // ----- Constants ---------------------------------------------------------
+
+  private static final String GET_METRICS_STATEMENT =
+    "SELECT  s.RecordTypeContext, s.RecordTypeName, s.TagPairs, s.NodeName, s.ServiceName, mn.Name AS MetricName, s.RecordTimeStamp, mp.MetricValue\n" +
+      "FROM HadoopMetrics.dbo.MetricPair mp\n" +
+      "     INNER JOIN (\n" +
+      "         SELECT mr.RecordID AS RecordID, mr.RecordTimeStamp AS RecordTimeStamp, rt.Context AS RecordTypeContext, rt.Name AS RecordTypeName, ts.TagPairs AS TagPairs, nd.Name AS NodeName, sr.Name AS ServiceName\n" +
+      "         FROM HadoopMetrics.dbo.MetricRecord mr\n" +
+      "              INNER JOIN HadoopMetrics.dbo.RecordType rt ON (mr.RecordTypeId = rt.RecordTypeId)\n" +
+      "              INNER JOIN HadoopMetrics.dbo.TagSet ts ON (mr.TagSetID = ts.TagSetID)\n" +
+      "              INNER JOIN HadoopMetrics.dbo.Node nd ON (mr.NodeID = nd.NodeID)\n" +
+      "              INNER JOIN HadoopMetrics.dbo.Service sr ON (mr.ServiceID = sr.ServiceID)\n" +
+      "         WHERE rt.Context in (%s)\n" +
+      "               AND rt.Name in (%s)\n" +
+      "               AND (ts.TagPairs LIKE %s)\n" +
+      "               AND (nd.Name in (%s))\n" +
+      "               AND (sr.Name in (%s))\n" +
+      "               AND mr.RecordTimestamp >= %d\n" +
+      "               AND mr.RecordTimestamp <= %d\n" +
+      "     ) s ON (mp.RecordID = s.RecordID)\n" +
+      "     INNER JOIN HadoopMetrics.dbo.MetricName mn ON (mp.MetricID = mn.MetricID)\n" +
+      "WHERE (mn.Name in (%s))";
+
+  protected final static Logger LOG = LoggerFactory.getLogger(SQLPropertyProvider.class);
+
+
+  // ----- Constructors ------------------------------------------------------
+
+  public SQLPropertyProvider(
+    Map<String, Map<String, PropertyInfo>> componentPropertyInfoMap,
+    HostInfoProvider hostProvider,
+    String clusterNamePropertyId,
+    String hostNamePropertyId,
+    String componentNamePropertyId,
+    String serviceNamePropertyId,
+    ConnectionFactory connectionFactory) {
+    super(componentPropertyInfoMap);
+    this.hostProvider = hostProvider;
+    this.clusterNamePropertyId = clusterNamePropertyId;
+    this.hostNamePropertyId = hostNamePropertyId;
+    this.componentNamePropertyId = componentNamePropertyId;
+    this.serviceNamePropertyId = serviceNamePropertyId;
+    this.connectionFactory = connectionFactory;
+  }
+
+
+  // ----- PropertyProvider --------------------------------------------------
+
+  @Override
+  public Set<Resource> populateResources(Set<Resource> resources, Request request, Predicate predicate)
+    throws SystemException {
+    Set<Resource> keepers = new HashSet<Resource>();
+    try {
+      Connection connection = connectionFactory.getConnection();
+      try {
+        Statement statement = connection.createStatement();
+        try {
+          for (Resource resource : resources) {
+            if (populateResource(resource, request, predicate, statement)) {
+              keepers.add(resource);
+            }
+          }
+        } finally {
+          statement.close();
+        }
+      } finally {
+        connection.close();
+      }
+    } catch (SQLException e) {
+      if (LOG.isErrorEnabled()) {
+        LOG.error("Error during populateResources call.");
+        LOG.debug("Error during populateResources call : caught exception", e);
+      }
+    }
+    return keepers;
+  }
+
+
+  // ----- helper methods ----------------------------------------------------
+
+  // Populate the given resource
+  private boolean populateResource(Resource resource, Request request, Predicate predicate, Statement statement) throws SystemException {
+
+    Set<String> ids = getRequestPropertyIds(request, predicate);
+    if (ids.isEmpty()) {
+      // no properties requested ... nothing to do.
+      return true;
+    }
+
+    String componentName = (String) resource.getPropertyValue(componentNamePropertyId);
+    String serviceName = (String) resource.getPropertyValue(serviceNamePropertyId);
+
+    if (getComponentMetrics().get(componentName) == null) {
+      // no metrics defined for the given component ... nothing to do.
+      return true;
+    }
+
+    String clusterName = (String) resource.getPropertyValue(clusterNamePropertyId);
+    String hostName = getHost(resource, clusterName, componentName);
+
+    if (hostName == null) {
+      throw new SystemException(
+        "Unable to get metrics.  No host name for " + componentName, null);
+    }
+
+    Set<MetricDefinition> metricsDefinitionSet = new HashSet<MetricDefinition>();
+    for (String id : ids) {
+      Map<String, PropertyInfo> propertyInfoMap = getPropertyInfoMap(componentName, id);
+
+      for (Map.Entry<String, PropertyInfo> entry : propertyInfoMap.entrySet()) {
+        String propertyKey = entry.getKey();
+        PropertyInfo propertyInfo = entry.getValue();
+        if (containsArguments(propertyKey)) {
+          propertyInfo = updatePropertyInfo(propertyKey, id, propertyInfo);
+        }
+
+        String propertyId = propertyInfo.getPropertyId();
+        TemporalInfo temporalInfo = request.getTemporalInfo(id);
+
+        if ((propertyInfo.isPointInTime() && temporalInfo == null) ||
+          (propertyInfo.isTemporal() && temporalInfo != null)) {
+
+          long startTime;
+          long endTime;
+
+          if (temporalInfo != null) {
+            Long endTimeSeconds = temporalInfo.getEndTime();
+
+            endTime = endTimeSeconds != -1 ? endTimeSeconds * 1000 : Long.MAX_VALUE;
+            startTime = temporalInfo.getStartTime() * 1000;
+          } else {
+            startTime = 0L;
+            endTime = Long.MAX_VALUE;
+          }
+
+          String category = "";
+          String recordTypeContext = "";
+          String recordTypeName = "";
+          String metricName = "";
+          String tagPairsPattern = ",";
+          int dotIndex = propertyId.lastIndexOf('.');
+          if (dotIndex != -1) {
+            category = propertyId.substring(0, dotIndex);
+            metricName = propertyId.substring(dotIndex + 1);
+          }
+          String[] parts = category.split("\\.");
+          if (parts.length >= 2) {
+            recordTypeContext = parts[0];
+            recordTypeName = parts[1];
+            if (containsArguments(propertyKey) && parts.length > 2) {
+              tagPairsPattern = StringUtils.join(Arrays.copyOfRange(parts, 2, parts.length), ".");
+            }
+            metricsDefinitionSet.add(
+              new MetricDefinition(
+                startTime,
+                endTime,
+                recordTypeContext,
+                recordTypeName,
+                tagPairsPattern,
+                metricName,
+                serviceName != null && serviceName.toLowerCase().equals("hbase") ? serviceName.toLowerCase() : componentName.toLowerCase(),
+                hostName,
+                propertyKey,
+                id,
+                temporalInfo)
+            );
+          } else {
+            if (LOG.isWarnEnabled()) {
+              LOG.warn("Can't get metrics for " + id + " : " + propertyId);
+            }
+          }
+        }
+      }
+    }
+
+    Map<MetricDefinition, List<DataPoint>> results = getMetric(metricsDefinitionSet, statement);
+
+    for (MetricDefinition metricDefinition : metricsDefinitionSet) {
+      List<DataPoint> dataPoints = results.containsKey(metricDefinition) ? results.get(metricDefinition) : new ArrayList<DataPoint>();
+      TemporalInfo temporalInfo = metricDefinition.getTemporalInfo();
+      String propertyKey = metricDefinition.getPropertyKey();
+      String requestedPropertyKey = metricDefinition.getRequestedPropertyKey();
+      if (dataPoints != null) {
+        if (temporalInfo == null) {
+          // return the value of the last data point
+          int length = dataPoints.size();
+          Serializable value = length > 0 ? dataPoints.get(length - 1).getValue() : 0;
+          resource.setProperty(propertyKey, value);
+        } else {
+          Number[][] dp = new Number[dataPoints.size()][2];
+          for (int i = 0; i < dp.length; i++) {
+            dp[i][0] = dataPoints.get(i).getValue();
+            dp[i][1] = dataPoints.get(i).getTimestamp() / 1000;
+          }
+          if (containsArguments(propertyKey)) {
+            resource.setProperty(requestedPropertyKey, dp);
+          } else {
+            resource.setProperty(propertyKey, dp);
+          }
+        }
+      }
+    }
+
+    return true;
+  }
+
+  // get a metric from a sql connection
+  private Map<MetricDefinition, List<DataPoint>> getMetric(Set<MetricDefinition> metricDefinitionSet, Statement statement) throws SystemException {
+    Map<MetricDefinition, List<DataPoint>> results = new HashMap<MetricDefinition, List<DataPoint>>();
+    try {
+      StringBuilder query = new StringBuilder();
+      Set<String> recordTypeContexts = new HashSet<String>();
+      Set<String> recordTypeNamess = new HashSet<String>();
+      Set<String> tagPairsPatterns = new HashSet<String>();
+      Set<String> nodeNames = new HashSet<String>();
+      Set<String> serviceNames = new HashSet<String>();
+      Set<String> metricNames = new HashSet<String>();
+      long startTime = 0, endTime = 0;
+      for (MetricDefinition metricDefinition : metricDefinitionSet) {
+        if (metricDefinition.getRecordTypeContext() == null || metricDefinition.getRecordTypeName() == null || metricDefinition.getNodeName() == null) {
+          continue;
+        }
+
+        recordTypeContexts.add(metricDefinition.getRecordTypeContext());
+        recordTypeNamess.add(metricDefinition.getRecordTypeName());
+        tagPairsPatterns.add(metricDefinition.getTagPairsPattern());
+        nodeNames.add(metricDefinition.getNodeName());
+        serviceNames.add(metricDefinition.getServiceName());
+        metricNames.add(metricDefinition.getMetricName());
+        startTime = metricDefinition.getStartTime();
+        endTime = metricDefinition.getEndTime();
+      }
+
+      for (String tagPairsPattern : tagPairsPatterns) {
+        if (query.length() != 0) {
+          query.append("\nUNION\n");
+        }
+        query.append(String.format(GET_METRICS_STATEMENT,
+          "'" + StringUtils.join(recordTypeContexts, "','") + "'",
+          "'" + StringUtils.join(recordTypeNamess, "','") + "'",
+          "'%" + tagPairsPattern + "%'",
+          "'" + StringUtils.join(nodeNames, "','") + "'",
+          "'" + StringUtils.join(serviceNames, "','") + "'",
+          startTime,
+          endTime,
+          "'" + StringUtils.join(metricNames, "','") + "'"
+        ));
+      }
+
+      ResultSet rs = null;
+      if (query.length() != 0) {
+        rs = statement.executeQuery(query.toString());
+      }
+
+      if (rs != null) {
+        //(RecordTimeStamp bigint, MetricValue NVARCHAR(512))
+        while (rs.next()) {
+          MetricDefinition metricDefinition = null;
+          for (MetricDefinition md : metricDefinitionSet) {
+            if (md.getRecordTypeContext().equalsIgnoreCase(rs.getString("RecordTypeContext"))
+              && md.getRecordTypeName().equalsIgnoreCase(rs.getString("RecordTypeName"))
+              && md.getMetricName().equalsIgnoreCase(rs.getString("MetricName"))
+              && md.getServiceName().equalsIgnoreCase(rs.getString("ServiceName"))
+              && md.getNodeName().equalsIgnoreCase(rs.getString("NodeName"))
+              && rs.getString("TagPairs").contains(md.getTagPairsPattern())) {
+              metricDefinition = md;
+              break;
+            }
+          }
+          if (metricDefinition == null) {
+            LOG.error("Error during getMetric call : No metricdefinition found for  result");
+            continue;
+          }
+          ParsePosition parsePosition = new ParsePosition(0);
+          NumberFormat numberFormat = NumberFormat.getInstance();
+          Number parsedNumber = numberFormat.parse(rs.getString("MetricValue"), parsePosition);
+          if (results.containsKey(metricDefinition)) {
+            results.get(metricDefinition).add(new DataPoint(rs.getLong("RecordTimeStamp"), parsedNumber));
+          } else {
+            List<DataPoint> dataPoints = new ArrayList<DataPoint>();
+            dataPoints.add(new DataPoint(rs.getLong("RecordTimeStamp"), parsedNumber));
+            results.put(metricDefinition, dataPoints);
+          }
+        }
+      }
+    } catch (SQLException e) {
+      throw new SystemException("Error during getMetric call : caught exception - ", e);
+    }
+    return results;
+  }
+
+  // get the hostname for a given resource
+  private String getHost(Resource resource, String clusterName, String componentName) throws SystemException {
+    return hostNamePropertyId == null ?
+      hostProvider.getHostName(clusterName, componentName) :
+      hostProvider.getHostName((String) resource.getPropertyValue(hostNamePropertyId));
+  }
+
+
+  // ----- inner class : DataPoint -------------------------------------------
+
+  /**
+   * Structure to hold a single datapoint (value/timestamp pair) retrieved from the db.
+   */
+  private static class DataPoint {
+    private final long timestamp;
+    private final Number value;
+
+    // ----- Constructor -------------------------------------------------
+
+    /**
+     * Construct a data point from the given value and timestamp.
+     *
+     * @param timestamp the timestamp
+     * @param value     the value
+     */
+    private DataPoint(long timestamp, Number value) {
+      this.timestamp = timestamp;
+      this.value = value;
+    }
+
+    // ----- DataPoint ---------------------------------------------------
+
+    /**
+     * Get the timestamp value.
+     *
+     * @return the timestamp
+     */
+    public long getTimestamp() {
+      return timestamp;
+    }
+
+    /**
+     * Get the value.
+     *
+     * @return the value
+     */
+    public Number getValue() {
+      return value;
+    }
+
+    // ----- Object overrides --------------------------------------------
+
+    @Override
+    public String toString() {
+      return "{" + value + " : " + timestamp + "}";
+    }
+  }
+
+  private class MetricDefinition {
+    long startTime;
+    long endTime;
+
+    String recordTypeContext;
+    String recordTypeName;
+    String tagPairsPattern;
+    String metricName;
+    String serviceName;
+    String nodeName;
+
+    String propertyKey;
+    String requestedPropertyKey;
+    TemporalInfo temporalInfo;
+
+    private MetricDefinition(long startTime, long endTime, String recordTypeContext, String recordTypeName, String tagPairsPattern, String metricName, String serviceName, String nodeName, String propertyKey, String requestedPropertyKey, TemporalInfo temporalInfo) {
+      this.startTime = startTime;
+      this.endTime = endTime;
+      this.recordTypeContext = recordTypeContext;
+      this.recordTypeName = recordTypeName;
+      this.tagPairsPattern = tagPairsPattern;
+      this.metricName = metricName;
+      this.serviceName = serviceName;
+      this.nodeName = nodeName;
+      this.propertyKey = propertyKey;
+      this.requestedPropertyKey = requestedPropertyKey;
+      this.temporalInfo = temporalInfo;
+    }
+
+    private MetricDefinition(String recordTypeContext, String recordTypeName, String tagPairsPattern, String metricName, String serviceName, String nodeName) {
+      this.recordTypeContext = recordTypeContext;
+      this.recordTypeName = recordTypeName;
+      this.tagPairsPattern = tagPairsPattern;
+      this.metricName = metricName;
+      this.serviceName = serviceName;
+      this.nodeName = nodeName;
+    }
+
+    public long getStartTime() {
+      return startTime;
+    }
+
+    public void setStartTime(long startTime) {
+      this.startTime = startTime;
+    }
+
+    public long getEndTime() {
+      return endTime;
+    }
+
+    public void setEndTime(long endTime) {
+      this.endTime = endTime;
+    }
+
+    public String getRecordTypeContext() {
+      return recordTypeContext;
+    }
+
+    public void setRecordTypeContext(String recordTypeContext) {
+      this.recordTypeContext = recordTypeContext;
+    }
+
+    public String getRecordTypeName() {
+      return recordTypeName;
+    }
+
+    public void setRecordTypeName(String recordTypeName) {
+      this.recordTypeName = recordTypeName;
+    }
+
+    public String getTagPairsPattern() {
+      return tagPairsPattern;
+    }
+
+    public void getTagPairsPattern(String tagPairsPattern) {
+      this.tagPairsPattern = tagPairsPattern;
+    }
+
+    public String getMetricName() {
+      return metricName;
+    }
+
+    public void setMetricName(String metricName) {
+      this.metricName = metricName;
+    }
+
+    public String getServiceName() {
+      return serviceName;
+    }
+
+    public void setServiceName(String serviceName) {
+      this.serviceName = serviceName;
+    }
+
+    public String getNodeName() {
+      return nodeName;
+    }
+
+    public void setNodeName(String nodeName) {
+      this.nodeName = nodeName;
+    }
+
+    public String getPropertyKey() {
+      return propertyKey;
+    }
+
+    public void setPropertyKey(String propertyKey) {
+      this.propertyKey = propertyKey;
+    }
+
+    public String getRequestedPropertyKey() {
+      return requestedPropertyKey;
+    }
+
+    public void setRequestedPropertyKey(String requestedPropertyKey) {
+      this.requestedPropertyKey = requestedPropertyKey;
+    }
+
+    public TemporalInfo getTemporalInfo() {
+      return temporalInfo;
+    }
+
+    public void setTemporalInfo(TemporalInfo temporalInfo) {
+      this.temporalInfo = temporalInfo;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+      if (this == o) return true;
+      if (o == null || getClass() != o.getClass()) return false;
+
+      MetricDefinition that = (MetricDefinition) o;
+
+      if (metricName != null ? !metricName.equals(that.metricName) : that.metricName != null) return false;
+      if (nodeName != null ? !nodeName.equalsIgnoreCase(that.nodeName) : that.nodeName != null) return false;
+      if (recordTypeContext != null ? !recordTypeContext.equals(that.recordTypeContext) : that.recordTypeContext != null)
+        return false;
+      if (recordTypeName != null ? !recordTypeName.equals(that.recordTypeName) : that.recordTypeName != null)
+        return false;
+      if (serviceName != null ? !serviceName.equals(that.serviceName) : that.serviceName != null) return false;
+      if (tagPairsPattern != null ? !(tagPairsPattern.contains(that.tagPairsPattern) ||
+        that.tagPairsPattern.contains(tagPairsPattern)) : that.tagPairsPattern != null)
+        return false;
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      int result = recordTypeContext != null ? recordTypeContext.hashCode() : 0;
+      result = 31 * result + (recordTypeName != null ? recordTypeName.hashCode() : 0);
+      result = 31 * result + (metricName != null ? metricName.hashCode() : 0);
+      result = 31 * result + (serviceName != null ? serviceName.hashCode() : 0);
+      result = 31 * result + (nodeName != null ? nodeName.toLowerCase().hashCode() : 0);
+      return result;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/8de3425f/ambari-server/src/main/java/org/apache/ambari/server/controller/sql/SinkConnectionFactory.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/sql/SinkConnectionFactory.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/sql/SinkConnectionFactory.java
new file mode 100644
index 0000000..154926c
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/sql/SinkConnectionFactory.java
@@ -0,0 +1,132 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.server.controller.sql;
+
+import com.mchange.v2.c3p0.ComboPooledDataSource;
+import org.apache.ambari.server.configuration.Configuration;
+import org.apache.ambari.server.controller.jdbc.ConnectionFactory;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+
+/**
+ * Factory for the sink database connection.
+ */
+public class SinkConnectionFactory implements ConnectionFactory {
+
+  /**
+   * The database URL.
+   */
+  private String databaseUrl;
+
+  /**
+   * The database driver.
+   */
+  private String databaseDriver;
+
+  private String databaseUser;
+
+  private String databasePassword;
+
+  private boolean useIntegratedAuth;
+
+  /**
+   * Indicates whether or not the driver has been initialized
+   */
+  private boolean connectionInitialized = false;
+
+  private ComboPooledDataSource cpds;
+  /**
+   * The singleton.
+   */
+  private static SinkConnectionFactory singleton = new SinkConnectionFactory();
+
+  // ----- Constructor -------------------------------------------------------
+
+  protected SinkConnectionFactory() {
+    Configuration config = new Configuration();
+    this.databaseUrl    = config.getSinkDatabaseUrl();
+    this.databaseDriver = config.getSinkDatabaseDriver();
+    this.useIntegratedAuth = config.getSinkUseIntegratedAuth();
+    this.databaseUser = config.getSinkDatabaseUser();
+    this.databasePassword =  config.getSinkDatabasePassword();
+  }
+
+
+  // ----- SinkConnectionFactory ---------------------------------------------
+
+  /**
+   * Initialize.
+   */
+  public void init() {
+    this.cpds = new ComboPooledDataSource();
+    this.cpds.setJdbcUrl(this.databaseUrl);
+    if(!useIntegratedAuth) {
+      this.cpds.setUser(this.databaseUser);
+      this.cpds.setPassword(this.databasePassword);
+    }
+    this.cpds.setMaxPoolSize(5);
+  }
+
+  /**
+   * Get the singleton instance.
+   *
+   * @return the singleton instance
+   */
+  public static SinkConnectionFactory instance() {
+    return singleton;
+  }
+
+  /**
+   * Get the database URL.
+   *
+   * @return the database URL
+   */
+  public String getDatabaseUrl() {
+    return databaseUrl;
+  }
+
+  /**
+   * Get the database driver.
+   *
+   * @return the database driver
+   */
+  public String getDatabaseDriver() {
+    return databaseDriver;
+  }
+
+// ----- ConnectionFactory -----------------------------------------------
+
+  @Override
+  public Connection getConnection() throws SQLException {
+    synchronized (this) {
+      if (!connectionInitialized) {
+        try {
+          Class.forName(databaseDriver);
+        } catch (Exception e) {
+          throw new SQLException("Can't load the driver class.", e);
+        }
+        init();
+        connectionInitialized = true;
+      }
+    }
+    return this.cpds.getConnection();
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/8de3425f/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PropertyHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PropertyHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PropertyHelper.java
index d0226f1..3e2111e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PropertyHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PropertyHelper.java
@@ -44,6 +44,7 @@ public class PropertyHelper {
 
   private static final String PROPERTIES_FILE = "properties.json";
   private static final String GANGLIA_PROPERTIES_FILE = "ganglia_properties.json";
+  private static final String SQLSERVER_PROPERTIES_FILE = "sqlserver_properties.json";
   private static final String JMX_PROPERTIES_FILE = "jmx_properties.json";
   private static final String KEY_PROPERTIES_FILE = "key_properties.json";
   private static final char EXTERNAL_PATH_SEP = '/';
@@ -51,6 +52,7 @@ public class PropertyHelper {
   private static final Map<Resource.InternalType, Set<String>> PROPERTY_IDS = readPropertyIds(PROPERTIES_FILE);
   private static final Map<Resource.InternalType, Map<String, Map<String, PropertyInfo>>> JMX_PROPERTY_IDS = readPropertyProviderIds(JMX_PROPERTIES_FILE);
   private static final Map<Resource.InternalType, Map<String, Map<String, PropertyInfo>>> GANGLIA_PROPERTY_IDS = readPropertyProviderIds(GANGLIA_PROPERTIES_FILE);
+    private static final Map<Resource.InternalType, Map<String, Map<String, PropertyInfo>>> SQLSERVER_PROPERTY_IDS = readPropertyProviderIds(SQLSERVER_PROPERTIES_FILE);
   private static final Map<Resource.InternalType, Map<Resource.Type, String>> KEY_PROPERTY_IDS = readKeyPropertyIds(KEY_PROPERTIES_FILE);
 
   /**
@@ -114,6 +116,10 @@ public class PropertyHelper {
     return GANGLIA_PROPERTY_IDS.get(resourceType.getInternalType());
   }
 
+  public static Map<String, Map<String, PropertyInfo>> getSQLServerPropertyIds(Resource.Type resourceType) {
+    return SQLSERVER_PROPERTY_IDS.get(resourceType.getInternalType());
+  }
+
   public static Map<String, Map<String, PropertyInfo>> getJMXPropertyIds(Resource.Type resourceType) {
     return JMX_PROPERTY_IDS.get(resourceType.getInternalType());
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/8de3425f/ambari-server/src/main/java/org/apache/ambari/server/resources/ResourceManager.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/resources/ResourceManager.java b/ambari-server/src/main/java/org/apache/ambari/server/resources/ResourceManager.java
index f17564f..9f4e708 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/resources/ResourceManager.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/resources/ResourceManager.java
@@ -41,7 +41,7 @@ public class ResourceManager {
   */
   public File getResource(String resourcePath) {
     String resDir = configs.getConfigsMap().get(Configuration.RESOURCES_DIR_KEY);
-    String resourcePathIndep = resourcePath.replaceAll("/", File.separator);
+    String resourcePathIndep = resourcePath.replace("/", File.separator);
     File resourceFile = new File(resDir + File.separator + resourcePathIndep);
     if (LOG.isDebugEnabled()) {
       LOG.debug("Resource requested from ResourceManager"

http://git-wip-us.apache.org/repos/asf/ambari/blob/8de3425f/ambari-server/src/main/java/org/apache/ambari/server/security/CertificateManager.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/CertificateManager.java b/ambari-server/src/main/java/org/apache/ambari/server/security/CertificateManager.java
index 1dbc064..b698ef3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/security/CertificateManager.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/security/CertificateManager.java
@@ -17,6 +17,14 @@
  */
 package org.apache.ambari.server.security;
 
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import org.apache.ambari.server.configuration.Configuration;
+import org.apache.ambari.server.utils.ShellCommandUtil;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.IOException;
@@ -25,15 +33,6 @@ import java.nio.charset.Charset;
 import java.text.MessageFormat;
 import java.util.Map;
 
-import org.apache.ambari.server.utils.ShellCommandUtil;
-import org.apache.ambari.server.configuration.Configuration;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-
 /**
  * Ambari security.
  * Manages server and agent certificates
@@ -47,22 +46,22 @@ public class CertificateManager {
 
 
   private static final String GEN_SRVR_KEY = "openssl genrsa -des3 " +
-      "-passout pass:{0} -out {1}/{2} 4096 ";
+      "-passout pass:{0} -out {1}" + File.separator + "{2} 4096 ";
   private static final String GEN_SRVR_REQ = "openssl req -passin pass:{0} " +
-      "-new -key {1}/{2} -out {1}/{5} -batch";
+      "-new -key {1}" + File.separator + "{2} -out {1}" + File.separator + "{5} -batch";
   private static final String SIGN_SRVR_CRT = "openssl ca -create_serial " +
-    "-out {1}/{3} -days 365 -keyfile {1}/{2} -key {0} -selfsign " +
-    "-extensions jdk7_ca -config {1}/ca.config -batch " +
-    "-infiles {1}/{5}";
+    "-out {1}" + File.separator + "{3} -days 365 -keyfile {1}" + File.separator + "{2} -key {0} -selfsign " +
+    "-extensions jdk7_ca -config {1}" + File.separator + "ca.config -batch " +
+    "-infiles {1}" + File.separator + "{5}";
   private static final String EXPRT_KSTR = "openssl pkcs12 -export" +
-      " -in {1}/{3} -inkey {1}/{2} -certfile {1}/{3} -out {1}/{4} " +
+      " -in {1}" + File.separator + "{3} -inkey {1}" + File.separator + "{2} -certfile {1}" + File.separator + "{3} -out {1}" + File.separator + "{4} " +
       "-password pass:{0} -passin pass:{0} \n";
   private static final String REVOKE_AGENT_CRT = "openssl ca " +
-      "-config {0}/ca.config -keyfile {0}/{4} -revoke {0}/{2} -batch " +
-      "-passin pass:{3} -cert {0}/{5}";
+      "-config {0}" + File.separator + "ca.config -keyfile {0}" + File.separator + "{4} -revoke {0}" + File.separator + "{2} -batch " +
+      "-passin pass:{3} -cert {0}" + File.separator + "{5}";
   private static final String SIGN_AGENT_CRT = "openssl ca -config " +
-      "{0}/ca.config -in {0}/{1} -out {0}/{2} -batch -passin pass:{3} " +
-      "-keyfile {0}/{4} -cert {0}/{5}"; /**
+      "{0}" + File.separator + "ca.config -in {0}" + File.separator + "{1} -out {0}" + File.separator + "{2} -batch -passin pass:{3} " +
+      "-keyfile {0}" + File.separator + "{4} -cert {0}" + File.separator + "{5}"; /**
        * Verify that root certificate exists, generate it otherwise.
        */
   public void initRootCert() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/8de3425f/ambari-server/src/main/package/msi/ambari-server.wxs
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/package/msi/ambari-server.wxs b/ambari-server/src/main/package/msi/ambari-server.wxs
new file mode 100644
index 0000000..4a1afe8
--- /dev/null
+++ b/ambari-server/src/main/package/msi/ambari-server.wxs
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
+<?define Version = "${ambariVersion}" ?>
+<?define UpgradeCode = "c8f5c145-c0aa-4d50-b1f5-ac9bc4055fb8" ?>
+  <Product Id="*" Name="Ambari Server ${ambariVersion}-SNAPSHOT" Language="1033"
+           Version="$(var.Version)" Manufacturer="Apache Software Foundation"
+           UpgradeCode="$(var.UpgradeCode)">
+    <Package Description="Ambari Server for Windows" Comments="Ambari Server for Windows" InstallerVersion="200"
+             Compressed="yes" Platform="x64"/>
+
+    <!-- upgrade rules -->
+    <Upgrade Id="$(var.UpgradeCode)">
+      <UpgradeVersion Minimum="$(var.Version)" IncludeMinimum="no" OnlyDetect="yes" Property="NEWERVERSIONDETECTED" />
+      <UpgradeVersion Minimum="0.0.0.0" Maximum="$(var.Version)" IncludeMinimum="yes" IncludeMaximum="yes" Property="OLDERVERSIONBEINGUPGRADED" />
+    </Upgrade>
+
+    <InstallExecuteSequence>
+      <RemoveExistingProducts After="InstallInitialize" />
+      <Custom Action="NewerVersion" After="FindRelatedProducts">NEWERVERSIONDETECTED</Custom>
+      <Custom Action="BackupConfiguration" After='InstallInitialize'>OLDERVERSIONBEINGUPGRADED</Custom>
+    </InstallExecuteSequence>
+
+    <CustomAction Id="NewerVersion" Error="A later version of Ambari Server is already installed." />
+    <!-- backup ambari.properties before installing new bits-->
+    <CustomAction Id="BackupConfiguration"
+                  Directory="AMBARI_SERVER_MSI"
+                  ExeCommand='cmd.exe /c copy conf\ambari.properties conf\ambari.properties.backup'
+                  Return="check" />
+
+    <Media Id="1" Cabinet="simple.cab" EmbedCab="yes"/>
+    <Directory Id="TARGETDIR" Name="SourceDir">
+      <Directory Id="ProgramFiles64Folder">
+        <Directory Id="AMBARI_SERVER_MSI" Name="ambari-server">
+        </Directory>
+      </Directory>
+    </Directory>
+    <Feature Id="DefaultFeature" Title="Main Feature" Level="1">
+      <ComponentGroupRef Id="AmbariServerGroup"/>
+    </Feature>
+    <UI/>
+    <Property Id="WIXUI_INSTALLDIR" Value="AMBARI_SERVER_MSI"/>
+    <UIRef Id="WixUI_InstallDir"/>
+  </Product>
+</Wix>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/8de3425f/ambari-server/src/main/python/ambari-server-windows.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari-server-windows.py b/ambari-server/src/main/python/ambari-server-windows.py
new file mode 100644
index 0000000..039069c
--- /dev/null
+++ b/ambari-server/src/main/python/ambari-server-windows.py
@@ -0,0 +1,601 @@
+#!/usr/bin/env python
+
+'''
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+'''
+
+import optparse
+
+from ambari_commons.ambari_service import AmbariService
+from ambari_commons.logging_utils import *
+from ambari_commons.os_utils import remove_file
+from ambari_commons.os_windows import SvcStatusCallback
+
+from ambari_server import utils
+from ambari_server.dbConfiguration import DBMSConfig
+from ambari_server.resourceFilesKeeper import ResourceFilesKeeper, KeeperException
+from ambari_server.serverConfiguration import *
+from ambari_server.serverSetup import setup, reset, is_server_running, upgrade
+from ambari_server.setupActions import *
+from ambari_server.setupSecurity import *
+from ambari_server.serverSetup_windows import SERVICE_PASSWORD_KEY, SERVICE_USERNAME_KEY
+
+# debug settings
+SERVER_START_DEBUG = False
+SUSPEND_START_MODE = False
+
+# server commands
+ambari_provider_module_option = ""
+ambari_provider_module = os.environ.get('AMBARI_PROVIDER_MODULE')
+
+#Common setup or upgrade message
+SETUP_OR_UPGRADE_MSG = "- If this is a new setup, then run the \"ambari-server setup\" command to create the user\n" \
+"- If this is an upgrade of an existing setup, run the \"ambari-server upgrade\" command.\n" \
+"Refer to the Ambari documentation for more information on setup and upgrade."
+
+AMBARI_SERVER_DIE_MSG = "Ambari Server java process died with exitcode {0}. Check {1} for more information."
+
+if ambari_provider_module is not None:
+  ambari_provider_module_option = "-Dprovider.module.class=" +\
+                                  ambari_provider_module + " "
+
+SERVER_START_CMD = \
+                 "-server -XX:NewRatio=3 "\
+                 "-XX:+UseConcMarkSweepGC " +\
+                 "-XX:-UseGCOverheadLimit -XX:CMSInitiatingOccupancyFraction=60 " +\
+                 ambari_provider_module_option +\
+                 os.getenv('AMBARI_JVM_ARGS', '-Xms512m -Xmx2048m') +\
+                 " -cp {0}" +\
+                 " org.apache.ambari.server.controller.AmbariServer"
+SERVER_START_CMD_DEBUG = \
+                       "-server -XX:NewRatio=2 -XX:+UseConcMarkSweepGC " +\
+                       ambari_provider_module_option +\
+                       os.getenv('AMBARI_JVM_ARGS', '-Xms512m -Xmx2048m') +\
+                       " -Xdebug -Xrunjdwp:transport=dt_socket,address=5005,"\
+                       "server=y,suspend={1} -cp {0}" +\
+                       " org.apache.ambari.server.controller.AmbariServer"
+SERVER_SEARCH_PATTERN = "org.apache.ambari.server.controller.AmbariServer"
+
+SERVER_INIT_TIMEOUT = 5
+SERVER_START_TIMEOUT = 10
+
+PID_NAME = "ambari-server.pid"
+EXITCODE_NAME = "ambari-server.exitcode"
+
+SERVER_VERSION_FILE_PATH = "server.version.file"
+
+# linux open-file limit
+ULIMIT_OPEN_FILES_KEY = 'ulimit.open.files'
+ULIMIT_OPEN_FILES_DEFAULT = 10000
+
+
+class AmbariServerService(AmbariService):
+  AmbariService._svc_name_ = "Ambari Server"
+  AmbariService._svc_display_name_ = "Ambari Server"
+  AmbariService._svc_description_ = "Ambari Server"
+
+  AmbariService._AdjustServiceVersion()
+
+  def SvcDoRun(self):
+    scmStatus = SvcStatusCallback(self)
+
+    properties = get_ambari_properties()
+    self.options.verbose = get_value_from_properties(properties, VERBOSE_OUTPUT_KEY, self.options.verbose)
+    self.options.debug = get_value_from_properties(properties, DEBUG_MODE_KEY, self.options.debug)
+    self.options.suspend_start = get_value_from_properties(properties, SUSPEND_START_MODE_KEY, self.options.suspend_start)
+
+    self.redirect_output_streams()
+
+    childProc = server_process_main(self.options, scmStatus)
+
+    if not self._StopOrWaitForChildProcessToFinish(childProc):
+      return
+
+    pid_file_path = PID_DIR + os.sep + PID_NAME
+    remove_file(pid_file_path)
+    pass
+
+  def _InitOptionsParser(self):
+    return init_options_parser()
+
+  def redirect_output_streams(self):
+    properties = get_ambari_properties()
+
+    outFilePath = properties[SERVER_OUT_FILE_KEY]
+    if (outFilePath is None or outFilePath == ""):
+      outFilePath = SERVER_OUT_FILE
+
+    self._RedirectOutputStreamsToFile(outFilePath)
+    pass
+
+def ctrlHandler(ctrlType):
+  AmbariServerService.DefCtrlCHandler()
+  return True
+
+def svcsetup():
+  AmbariServerService.set_ctrl_c_handler(ctrlHandler)
+  # we don't save password between 'setup' runs, so we can't run Install every time. We run 'setup' only if user and
+  # password provided or if service not installed
+  if (SERVICE_USERNAME_KEY in os.environ and SERVICE_PASSWORD_KEY in os.environ):
+    AmbariServerService.Install(username=os.environ[SERVICE_USERNAME_KEY], password=os.environ[SERVICE_PASSWORD_KEY])
+  elif AmbariServerService.QueryStatus() == "not installed":
+    AmbariServerService.Install()
+  pass
+
+#
+# Starts the Ambari Server as a standalone process.
+# args:
+#  <no arguments> = start the server as a process. For now, there is no restrictions for the number of server instances
+#     that can run like this.
+#  -s, --single-instance = Reserved for future use. When starting the server as a process, ensure only one instance of the process is running.
+#     If this is the second instance of the process, the function fails.
+#
+def start(options):
+  AmbariServerService.set_ctrl_c_handler(ctrlHandler)
+
+  #Run as a normal process. Invoke the ServiceMain directly.
+  childProc = server_process_main(options)
+
+  childProc.wait()
+
+  pid_file_path = PID_DIR + os.sep + PID_NAME
+  remove_file(pid_file_path)
+
+#
+# Starts the Ambari Server as a service.
+# Start the server in normal mode, as a Windows service. If the Ambari server is
+#     not registered as a service, the function fails. By default, only one instance of the service can
+#     possibly run.
+#
+def svcstart():
+  AmbariServerService.Start()
+  pass
+
+def server_process_main(options, scmStatus=None):
+  # set verbose
+  try:
+    global VERBOSE
+    VERBOSE = options.verbose
+  except AttributeError:
+    pass
+
+  # set silent
+  try:
+    global SILENT
+    SILENT = options.silent
+  except AttributeError:
+    pass
+
+  # debug mode
+  try:
+    global DEBUG_MODE
+    DEBUG_MODE = options.debug
+  except AttributeError:
+    pass
+
+  # stop Java process at startup?
+  try:
+    global SUSPEND_START_MODE
+    SUSPEND_START_MODE = options.suspend_start
+  except AttributeError:
+    pass
+
+  if not utils.check_reverse_lookup():
+    print_warning_msg("The hostname was not found in the reverse DNS lookup. "
+                      "This may result in incorrect behavior. "
+                      "Please check the DNS setup and fix the issue.")
+
+  properties = get_ambari_properties()
+
+  print_info_msg("Ambari Server is not running...")
+
+  conf_dir = get_conf_dir()
+  jdk_path = find_jdk()
+  if jdk_path is None:
+    err = "No JDK found, please run the \"ambari-server setup\" " \
+                    "command to install a JDK automatically or install any " \
+                    "JDK manually to " + JDK_INSTALL_DIR
+    raise FatalException(1, err)
+
+  # Preparations
+
+  result = ensure_dbms_is_running(options, properties, scmStatus)
+  if result == -1:
+    raise FatalException(-1, "Unable to connect to the database")
+
+  if scmStatus is not None:
+    scmStatus.reportStartPending()
+
+  ensure_resources_are_organized(properties)
+
+  if scmStatus is not None:
+    scmStatus.reportStartPending()
+
+  environ = os.environ.copy()
+  ensure_server_security_is_configured(properties, environ)
+
+  if scmStatus is not None:
+    scmStatus.reportStartPending()
+
+  conf_dir = os.path.abspath(conf_dir) + os.pathsep + get_ambari_classpath()
+  if conf_dir.find(' ') != -1:
+    conf_dir = '"' + conf_dir + '"'
+
+  java_exe = jdk_path + os.sep + JAVA_EXE_SUBPATH
+  pidfile = PID_DIR + os.sep + PID_NAME
+  command_base = SERVER_START_CMD_DEBUG if (DEBUG_MODE or SERVER_START_DEBUG) else SERVER_START_CMD
+  suspend_mode = 'y' if SUSPEND_START_MODE else 'n'
+  command = command_base.format(conf_dir, suspend_mode)
+  if not os.path.exists(PID_DIR):
+    os.makedirs(PID_DIR, 0755)
+
+  set_open_files_limit(get_ulimit_open_files());
+
+  #Ignore the requirement to run as root. In Windows, by default the child process inherits the security context
+  # and the environment from the parent process.
+  param_list = java_exe + " " + command
+
+  print_info_msg("Running server: " + str(param_list))
+  procJava = subprocess.Popen(param_list, env=environ)
+
+  #wait for server process for SERVER_START_TIMEOUT seconds
+  print "Waiting for server start..."
+
+  pidJava = procJava.pid
+  if pidJava <= 0:
+    procJava.terminate()
+    exitcode = procJava.returncode
+    exitfile = os.path.join(PID_DIR, EXITCODE_NAME)
+    utils.save_pid(exitcode, exitfile)
+
+    if scmStatus is not None:
+      scmStatus.reportStopPending()
+
+    raise FatalException(-1, AMBARI_SERVER_DIE_MSG.format(exitcode, SERVER_OUT_FILE))
+  else:
+    utils.save_pid(pidJava, pidfile)
+    print "Server PID at: "+pidfile
+    print "Server out at: "+SERVER_OUT_FILE
+    print "Server log at: "+SERVER_LOG_FILE
+
+  if scmStatus is not None:
+    scmStatus.reportStarted()
+
+  return procJava
+
+#Check the JDBC driver status
+#If not found abort
+#Get SQL Server service status from SCM
+#If 'stopped' then start it
+#Wait until the status is 'started' or a configured timeout elapses
+#If the timeout has been reached, bail out with exception
+def ensure_dbms_is_running(options, properties, scmStatus):
+  dbms = DBMSConfig.create(options, properties, "Ambari")
+  if not dbms._is_jdbc_driver_installed(properties):
+    raise FatalException(-1, "JDBC driver is not installed. Run ambari-server setup and try again.")
+
+  dbms.ensure_dbms_is_running(options, properties, scmStatus)
+
+  dbms2 = DBMSConfig.create(options, properties, "Metrics")
+  if dbms2.database_host.lower() != dbms.database_host.lower():
+    dbms2.ensure_dbms_is_running(options, properties, scmStatus)
+  pass
+
+def ensure_resources_are_organized(properties):
+  resources_location = get_resources_location(properties)
+  resource_files_keeper = ResourceFilesKeeper(resources_location)
+  try:
+    print "Organizing resource files at {0}...".format(resources_location,
+                                                       verbose=VERBOSE)
+    resource_files_keeper.perform_housekeeping()
+  except KeeperException, ex:
+    msg = "Can not organize resource files at {0}: {1}".format(
+      resources_location, str(ex))
+    raise FatalException(-1, msg)
+
+
+def ensure_server_security_is_configured(properties, environ):
+  pass
+
+
+#
+# Stops the Ambari Server.
+#
+def svcstop():
+  AmbariServerService.Stop()
+
+
+### Stack upgrade ###
+
+#def upgrade_stack(args, stack_id, repo_url=None, repo_url_os=None):
+
+
+def get_resources_location(properties):
+  res_location = properties[RESOURCES_DIR_PROPERTY]
+  if res_location is None:
+    res_location = RESOURCES_DIR_DEFAULT
+  return res_location
+#  pass
+
+def get_stack_location(properties):
+  stack_location = properties[STACK_LOCATION_KEY]
+  if stack_location is None:
+    stack_location = STACK_LOCATION_DEFAULT
+  return stack_location
+#  pass
+
+
+#
+# The Ambari Server status.
+#
+def svcstatus(options):
+  options.exit_message = None
+
+  statusStr = AmbariServerService.QueryStatus()
+  print "Ambari Server is " + statusStr
+
+
+def get_ulimit_open_files():
+  properties = get_ambari_properties()
+  if properties == -1:
+    print "Error reading ambari properties"
+    return None
+
+  open_files = int(properties[ULIMIT_OPEN_FILES_KEY])
+  if open_files > 0:
+    return open_files
+  else:
+    return ULIMIT_OPEN_FILES_DEFAULT
+
+
+def init_options_parser():
+  parser = optparse.OptionParser(usage="usage: %prog action [options] [stack_id os]", )
+  #parser.add_option('-i', '--create-db-script-file', dest="create_db_script_file",
+  #                  default="resources" + os.sep + "Ambari-DDL-SQLServer-CREATELOCAL.sql",
+  #                  help="File with database creation script")
+  parser.add_option('-f', '--init-script-file', dest="init_db_script_file",
+                    default="resources" + os.sep + "Ambari-DDL-SQLServer-CREATE.sql",
+                    help="File with database setup script")
+  parser.add_option('-r', '--drop-script-file', dest="cleanup_db_script_file",
+                    default="resources" + os.sep + "Ambari-DDL-SQLServer-DROP.sql",
+                    help="File with database cleanup script")
+  parser.add_option('-j', '--java-home', dest="java_home", default=None,
+                    help="Use specified java_home.  Must be valid on all hosts")
+  parser.add_option("-v", "--verbose",
+                    action="store_true", dest="verbose", default=False,
+                    help="Print verbose status messages")
+  parser.add_option("-s", "--silent",
+                    action="store_true", dest="silent", default=False,
+                    help="Silently accepts default prompt values")
+  parser.add_option('-g', '--debug', action="store_true", dest='debug', default=False,
+                    help="Start ambari-server in debug mode")
+  parser.add_option('-y', '--suspend-start', action="store_true", dest='suspend_start', default=False,
+                    help="Freeze ambari-server Java process at startup in debug mode")
+
+  parser.add_option('-a', '--databasehost', dest="database_host", default=None,
+                    help="Hostname of database server")
+  parser.add_option('-n', '--databaseport', dest="database_port", default=None,
+                    help="Database server listening port")
+  parser.add_option('-d', '--databasename', dest="database_name", default=None,
+                    help="Database/Schema/Service name or ServiceID")
+  parser.add_option('-w', '--windowsauth', action="store_true", dest="database_windows_auth", default=None,
+                    help="Integrated Windows authentication")
+  parser.add_option('-u', '--databaseusername', dest="database_username", default=None,
+                    help="Database user login")
+  parser.add_option('-p', '--databasepassword', dest="database_password", default=None,
+                    help="Database user password")
+
+  parser.add_option('-t', '--init-metrics-script-file', dest="init_metrics_db_script_file", default=None,
+                    help="File with metrics database setup script")
+  parser.add_option('-c', '--drop-metrics-script-file', dest="cleanup_metrics_db_script_file", default=None,
+                    help="File with metrics database cleanup script")
+
+  parser.add_option('-m', '--metricsdatabasehost', dest="metrics_database_host", default=None,
+                    help="Hostname of metrics database server")
+  parser.add_option('-o', '--metricsdatabaseport', dest="metrics_database_port", default=None,
+                    help="Metrics database server listening port")
+  parser.add_option('-e', '--metricsdatabasename', dest="metrics_database_name", default=None,
+                    help="Metrics database/Schema/Service name or ServiceID")
+  parser.add_option('-z', '--metricswindowsauth', action="store_true", dest="metrics_database_windows_auth", default=None,
+                    help="Integrated Windows authentication for the metrics database")
+  parser.add_option('-q', '--metricsdatabaseusername', dest="metrics_database_username", default=None,
+                    help="Metrics database user login")
+  parser.add_option('-l', '--metricsdatabasepassword', dest="metrics_database_password", default=None,
+                    help="Metrics database user password")
+
+  parser.add_option('--jdbc-driver', default=None, dest="jdbc_driver",
+                    help="Specifies the path to the JDBC driver JAR file for the " \
+                         "database type specified with the --jdbc-db option. Used only with --jdbc-db option.")
+  # -b, -i, -k and -x the remaining available short options
+  # -h reserved for help
+  return parser
+
+def are_cmd_line_db_args_blank(options):
+  if (options.database_host is None \
+    and options.database_name is None \
+    and options.database_windows_auth is None \
+    and options.database_username is None \
+    and options.database_password is None \
+    and options.metrics_database_host is None \
+    and options.metrics_database_name is None \
+    and options.metrics_database_windows_auth is None \
+    and options.metrics_database_username is None \
+    and options.metrics_database_password is None):
+    return True
+  return False
+
+
+def are_db_auth_options_ok(db_windows_auth, db_username, db_password):
+  if db_windows_auth is True:
+    return True
+  else:
+    if db_username is not None and db_username is not "" and db_password is not None and db_password is not "":
+      return True
+  return False
+
+def are_cmd_line_db_args_valid(options):
+  if (options.database_host is not None and options.database_host is not "" \
+      #and options.database_name is not None \         # ambari by default is ok
+      and are_db_auth_options_ok(options.database_windows_auth,
+                               options.database_username,
+                               options.database_password) \
+    and options.metrics_database_host is not None and options.metrics_database_host is not "" \
+    #and options.metrics_database_name is not None \  # HadoopMetrics by default is ok
+    and are_db_auth_options_ok(options.metrics_database_windows_auth,
+                               options.metrics_database_username,
+                               options.metrics_database_password)):
+    return True
+  return False
+
+
+def setup_security(args):
+  need_restart = True
+  #Print menu options
+  print '=' * 75
+  print 'Choose one of the following options: '
+  print '  [1] Enable HTTPS for Ambari server.'
+  print '  [2] Encrypt passwords stored in ambari.properties file.'
+  print '  [3] Setup Ambari kerberos JAAS configuration.'
+  print '=' * 75
+  choice = get_validated_string_input('Enter choice, (1-3): ', '0', '[1-3]',
+                                      'Invalid choice', False, False)
+
+  if choice == '1':
+    need_restart = setup_https(args)
+  elif choice == '2':
+    setup_master_key()
+  elif choice == '3':
+    setup_ambari_krb5_jaas()
+  else:
+    raise FatalException('Unknown option for setup-security command.')
+
+  return need_restart
+
+#
+# Main.
+#
+def main():
+  parser = init_options_parser()
+  (options, args) = parser.parse_args()
+
+  #perform checks
+  options.warnings = []
+  options.must_set_database_options = False
+
+  if are_cmd_line_db_args_blank(options):
+    options.must_set_database_options = True
+    #TODO Silent is invalid here, right?
+
+  elif not are_cmd_line_db_args_valid(options):
+    parser.error('All database options should be set. Please see help for the options.')
+
+  ## jdbc driver and db options validation
+  #if options.jdbc_driver is None and options.jdbc_db is not None:
+  #  parser.error("Option --jdbc-db is used only in pair with --jdbc-driver")
+  #elif options.jdbc_driver is not None and options.jdbc_db is None:
+  #  parser.error("Option --jdbc-driver is used only in pair with --jdbc-db")
+
+  if options.debug:
+    sys.frozen = 'windows_exe' # Fake py2exe so we can debug
+
+  if len(args) == 0:
+    print parser.print_help()
+    parser.error("No action entered")
+
+  action = args[0]
+
+  if action == UPGRADE_STACK_ACTION:
+    possible_args_numbers = [2,4] # OR
+  else:
+    possible_args_numbers = [1]
+
+  matches = 0
+  for args_number_required in possible_args_numbers:
+    matches += int(len(args) == args_number_required)
+
+  if matches == 0:
+    print parser.print_help()
+    possible_args = ' or '.join(str(x) for x in possible_args_numbers)
+    parser.error("Invalid number of arguments. Entered: " + str(len(args)) + ", required: " + possible_args)
+
+  options.exit_message = "Ambari Server '%s' completed successfully." % action
+  need_restart = True
+  try:
+    if action == SETUP_ACTION:
+      setup(options)
+      svcsetup()
+    elif action == START_ACTION:
+      svcstart()
+    elif action == PSTART_ACTION:
+      start(options)
+    elif action == STOP_ACTION:
+      svcstop()
+    elif action == RESET_ACTION:
+      reset(options, AmbariServerService)
+    elif action == STATUS_ACTION:
+      svcstatus(options)
+    elif action == UPGRADE_ACTION:
+      upgrade(options)
+#    elif action == UPGRADE_STACK_ACTION:
+#      stack_id = args[1]
+#      repo_url = None
+#      repo_url_os = None
+#
+#      if len(args) > 2:
+#        repo_url = args[2]
+#      if len(args) > 3:
+#        repo_url_os = args[3]
+#
+#      upgrade_stack(options, stack_id, repo_url, repo_url_os)
+    elif action == LDAP_SETUP_ACTION:
+      setup_ldap()
+    elif action == SETUP_SECURITY_ACTION:
+      need_restart = setup_security(options)
+    else:
+      parser.error("Invalid action")
+
+    if action in ACTION_REQUIRE_RESTART and need_restart:
+      status, stateDesc = is_server_running(AmbariServerService)
+      if status:
+        print 'NOTE: Restart Ambari Server to apply changes' + \
+              ' ("ambari-server restart|stop|start")'
+
+    if options.warnings:
+      for warning in options.warnings:
+        print_warning_msg(warning)
+        pass
+      options.exit_message = "Ambari Server '%s' completed with warnings." % action
+      pass
+  except FatalException as e:
+    if e.reason is not None:
+      print_error_msg("Exiting with exit code {0}. \nREASON: {1}".format(e.code, e.reason))
+    sys.exit(e.code)
+  except NonFatalException as e:
+    options.exit_message = "Ambari Server '%s' completed with warnings." % action
+    if e.reason is not None:
+      print_warning_msg(e.reason)
+
+  if options.exit_message is not None:
+    print options.exit_message
+
+
+if __name__ == "__main__":
+  try:
+    main()
+  except (KeyboardInterrupt, EOFError):
+    print("\nAborting ... Keyboard Interrupt.")
+    sys.exit(1)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/8de3425f/ambari-server/src/main/python/ambari-server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari-server.py b/ambari-server/src/main/python/ambari-server.py
index 19b875d..91deb74 100755
--- a/ambari-server/src/main/python/ambari-server.py
+++ b/ambari-server/src/main/python/ambari-server.py
@@ -758,9 +758,9 @@ def check_reverse_lookup():
   Check if host fqdn resolves to current host ip
   """
   try:
-    host_name = socket.gethostname()
+    host_name = socket.gethostname().lower()
     host_ip = socket.gethostbyname(host_name)
-    host_fqdn = socket.getfqdn()
+    host_fqdn = socket.getfqdn().lower()
     fqdn_ip = socket.gethostbyname(host_fqdn)
     return host_ip == fqdn_ip
   except socket.herror:
@@ -1317,7 +1317,7 @@ def store_remote_properties(args):
   # to the jdbc hostname since its passed onto the agents for RCA
   jdbc_hostname = args.database_host
   if (args.database_host == "localhost"):
-    jdbc_hostname = socket.getfqdn()
+    jdbc_hostname = socket.getfqdn().lower()
 
   connectionStringFormat = DATABASE_CONNECTION_STRINGS
   if args.sid_or_sname == "sid":
@@ -2944,7 +2944,7 @@ def upgrade(args):
       if os.path.lexists(jdbc_symlink):
         os.remove(jdbc_symlink)
       os.symlink(os.path.join(resources_dir,JDBC_DB_DEFAULT_DRIVER[db_name]), jdbc_symlink)
-  
+
   # check if ambari has obsolete LDAP configuration
   if properties.get_property(LDAP_PRIMARY_URL_PROPERTY) and not properties.get_property(IS_LDAP_CONFIGURED):
     args.warnings.append("Existing LDAP configuration is detected. You must run the \"ambari-server setup-ldap\" command to adjust existing LDAP configuration.")
@@ -3528,7 +3528,7 @@ def setup_master_key():
     if not is_alias_string(ldap_password) and os.path.isfile(ldap_password):
       with open(ldap_password, 'r') as passwdfile:
         ldap_password = passwdfile.read()
-  
+
   ts_password = properties.get_property(SSL_TRUSTSTORE_PASSWORD_PROPERTY)
   resetKey = False
   masterKey = None
@@ -4293,7 +4293,7 @@ def get_fqdn():
     handle.close()
     return str
   except Exception:
-    return socket.getfqdn()
+    return socket.getfqdn().lower()
 
 
 def get_ulimit_open_files():

http://git-wip-us.apache.org/repos/asf/ambari/blob/8de3425f/ambari-server/src/main/python/ambari_server/dbConfiguration.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari_server/dbConfiguration.py b/ambari-server/src/main/python/ambari_server/dbConfiguration.py
new file mode 100644
index 0000000..b9d4e4e
--- /dev/null
+++ b/ambari-server/src/main/python/ambari_server/dbConfiguration.py
@@ -0,0 +1,213 @@
+#!/usr/bin/env python
+
+'''
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+'''
+
+from ambari_commons import OSCheck
+from ambari_commons.exceptions import FatalException
+from ambari_commons.logging_utils import print_error_msg
+from ambari_server.setupSecurity import SECURITY_IS_ENCRYPTION_ENABLED
+from serverConfiguration import get_ambari_properties
+
+
+#Database settings
+DB_STATUS_RUNNING_DEFAULT = "running"
+
+SETUP_DB_CONNECT_TIMEOUT = 5
+SETUP_DB_CONNECT_ATTEMPTS = 3
+
+DATABASE_INDEX = 0
+USERNAME_PATTERN = "^[a-zA-Z_][a-zA-Z0-9_\-]*$"
+PASSWORD_PATTERN = "^[a-zA-Z0-9_-]*$"
+DATABASE_NAMES = ["postgres", "oracle", "mysql"]
+DATABASE_STORAGE_NAMES = ["Database", "Service", "Database"]
+DATABASE_PORTS = ["5432", "1521", "3306"]
+DATABASE_DRIVER_NAMES = ["org.postgresql.Driver", "oracle.jdbc.driver.OracleDriver", "com.mysql.jdbc.Driver"]
+DATABASE_CONNECTION_STRINGS = [
+                  "jdbc:postgresql://{0}:{1}/{2}",
+                  "jdbc:oracle:thin:@{0}:{1}/{2}",
+                  "jdbc:mysql://{0}:{1}/{2}"]
+DATABASE_CONNECTION_STRINGS_ALT = [
+                  "jdbc:postgresql://{0}:{1}/{2}",
+                  "jdbc:oracle:thin:@{0}:{1}:{2}",
+                  "jdbc:mysql://{0}:{1}/{2}"]
+ORACLE_SID_PATTERN = "jdbc:oracle:thin:@.+:.+/.+"
+ORACLE_SNAME_PATTERN = "jdbc:oracle:thin:@.+:.+:.+"
+
+DATABASE_CLI_TOOLS = [["psql"], ["sqlplus", "sqlplus64"], ["mysql"]]
+DATABASE_CLI_TOOLS_DESC = ["psql", "sqlplus", "mysql"]
+DATABASE_CLI_TOOLS_USAGE = ['su -postgres --command=psql -f {0} -v username=\'"{1}"\' -v password="\'{2}\'"',
+                            'sqlplus {1}/{2} < {0} ',
+                            'mysql --user={1} --password={2} {3}<{0}']
+
+MYSQL_INIT_SCRIPT = '/var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql'
+DATABASE_INIT_SCRIPTS = ['/var/lib/ambari-server/resources/Ambari-DDL-Postgres-CREATE.sql',
+                         '/var/lib/ambari-server/resources/Ambari-DDL-Oracle-CREATE.sql',
+                         MYSQL_INIT_SCRIPT]
+DATABASE_DROP_SCRIPTS = ['/var/lib/ambari-server/resources/Ambari-DDL-Postgres-DROP.sql',
+                         '/var/lib/ambari-server/resources/Ambari-DDL-Oracle-DROP.sql',
+                         '/var/lib/ambari-server/resources/Ambari-DDL-MySQL-DROP.sql']
+#
+# Database configuration base class
+#
+class DBMSConfig(object):
+  def __init__(self, options, properties):
+    """
+    #Just load the defaults. The derived classes will be able to modify them later
+    """
+    self.persistence_type = 'remote'
+    self.dbms = ""
+    self.driver_name = ""
+    self.database_host = ""
+    self.database_port = ""
+    self.database_name = ""
+    self.database_username = ""
+    self.password_file = None
+
+    self.silent = options.silent
+
+    isSecureProp = properties.get_property(SECURITY_IS_ENCRYPTION_ENABLED)
+    self.isSecure = True if isSecureProp and isSecureProp.lower() == 'true' else False
+    pass
+
+
+  @staticmethod
+  # properties = property bag that will ultimately define the type of database. Since
+  #   right now in Windows we only support SQL Server, this argument is not yet used.
+  # dbId = additional information, that helps distinguish between various database connections
+  #   (Ambari vs. Metrics is a prime example)
+  def create(options, properties, dbId = "Ambari"):
+    #if OSCheck.is_windows_os():
+    if dbId == "Ambari":
+      return SQLServerAmbariDBConfig(options, properties)
+    elif dbId == "Metrics":
+      return SQLServerMetricsDBConfig(options, properties)
+    else:
+      raise FatalException(-1, "Invalid database requested: " + str(dbId))
+    #else:
+    #  go the classic Linux way
+    #return PGConfig(properties, dbId)
+    #return MySQLConfig(properties, dbId)
+    #return OracleConfig(properties, dbId)
+
+
+  #
+  # Public methods
+  #
+
+  #
+  # Main method. Configures the database according to the options and the existing properties.
+  #
+  def configure_database(self, args, properties):
+    result = self._prompt_db_properties()
+    if result:
+      #DB setup should be done last after doing any setup.
+      if self._is_local_database():
+        self._setup_local_server(properties)
+      else:
+        self._setup_remote_server(properties)
+    return result
+
+  def setup_database(self):
+    print 'Configuring {} database...'.format(self.db_title)
+
+    #DB setup should be done last after doing any setup.
+    if self._is_local_database():
+      self._setup_local_database()
+    else:
+      self._setup_remote_database()
+    pass
+
+  def reset_database(self):
+    print 'Resetting {} database...'.format(self.db_title)
+
+    if self._is_local_database():
+      self._reset_local_database()
+    else:
+      self._reset_remote_database()
+    pass
+
+  def ensure_jdbc_driver_installed(self, args, properties):
+    result = self._is_jdbc_driver_installed(properties)
+    if result == -1:
+      (result, msg) = self._prompt_jdbc_driver_install(properties)
+      if result == -1:
+        print_error_msg(msg)
+        raise FatalException(-1, msg)
+
+    if result != 1:
+      if self._install_jdbc_driver(args, properties):
+        return True
+    return False
+
+
+  #
+  # Private implementation
+  #
+
+  #
+  # Checks if options determine local DB configuration
+  #
+  def _is_local_database(self):
+    return self.persistence_type == 'local'
+
+  def _is_jdbc_driver_installed(self, properties):
+    return 1
+
+  def configure_database_password(showDefault=True):
+    pass
+
+  def _prompt_db_properties(self):
+    #if WINDOWS
+    #  prompt for SQL Server host and instance name
+    #else
+    #  go the classic Linux way
+    #linux_prompt_db_properties(args)
+    return False
+
+  def _setup_local_server(self, properties):
+    pass
+
+  def _setup_local_database(self):
+    pass
+
+  def _reset_local_database(self):
+    pass
+
+  def _setup_remote_server(self, properties):
+    pass
+
+  def _setup_remote_database(self):
+    pass
+
+  def _reset_remote_database(self):
+    pass
+
+  def _prompt_jdbc_driver_install(self, properties):
+    return (False, "")
+
+  def _install_jdbc_driver(self, options, properties):
+    return False
+
+  def ensure_dbms_is_running(self, options, properties, scmStatus=None):
+    pass
+
+if OSCheck.is_windows_os():
+  from ambari_server.dbConfiguration_windows import SQLServerAmbariDBConfig, SQLServerMetricsDBConfig
+#else:
+#  from ambari_server.dbConfiguration_linux import PostgreSQLConfig #and potentially MySQLConfig, OracleConfig


Mime
View raw message