[rhq] etc/dev-utils
by Larry O'Leary
etc/dev-utils/TestLdapSettings.java | 102 +++++++++++++++++++++++++++++++++++-
1 file changed, 100 insertions(+), 2 deletions(-)
New commits:
commit 0517e453381aec1d30b6aaa62bec63a322dfa350
Author: Larry O'Leary <loleary(a)redhat.com>
Date: Fri Jul 19 19:05:25 2013 -0500
Updated TestLdapSettings to include changes/fixes introduced from the following BZs:
Bug 707047 - LDAP Group Member search doesn't escape special characters
Bug 981015 - LDAP auth fails if user's DN contains a backslash
Also includes a fix in where the user auth test would fail to switch back to the directory bind account and result in ACL failures on the following group lookup steps.
diff --git a/etc/dev-utils/TestLdapSettings.java b/etc/dev-utils/TestLdapSettings.java
index 4df79dc..2e29b3d 100644
--- a/etc/dev-utils/TestLdapSettings.java
+++ b/etc/dev-utils/TestLdapSettings.java
@@ -10,12 +10,14 @@ import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.PrintWriter;
import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
+import javax.naming.CompositeName;
import javax.naming.Context;
import javax.naming.NamingEnumeration;
import javax.naming.directory.Attribute;
@@ -257,7 +259,17 @@ public class TestLdapSettings extends JFrame {
SearchResult si = (SearchResult) answer.next();
// Construct the UserDN
- userDN = si.getName() + "," + baseDNs[x];
+ userDN = null;
+
+ try {
+ userDN = si.getNameInNamespace();
+ } catch (UnsupportedOperationException use) {
+ userDN = new CompositeName(si.getName()).get(0);
+ if (si.isRelative()) {
+ userDN += "," + baseDNs[x];
+ }
+ }
+
msg = "STEP-2:PASS: The test user '"
+ testUserName
+ "' was succesfully located, and the following userDN will be used in authorization check:\n";
@@ -288,6 +300,21 @@ public class TestLdapSettings extends JFrame {
log(msg);
proceed=false;
}
+ try {
+ ctx.addToEnvironment(Context.SECURITY_PRINCIPAL, bindUserName);
+ ctx.addToEnvironment(Context.SECURITY_CREDENTIALS, bindPassword);
+ ctx.addToEnvironment(Context.SECURITY_AUTHENTICATION, "simple");
+ ctx.reconnect(null);
+ } catch (Exception ex) {
+ msg = "STEP-2:WARN: There was an error when switching back to the bind user '"
+ + bindUserName + "'\n";
+ msg += ex.getMessage();
+ if(enableVerboseDebugging.isSelected()){
+ msg = appendStacktraceToMsg(msg, ex);
+ }
+ log(msg);
+ }
+
}
// with authentication completed, now check authorization.
// validate filter components to list all available groups
@@ -433,7 +460,7 @@ public class TestLdapSettings extends JFrame {
Set<Map<String, String>> ret = new HashSet<Map<String, String>>();
String filter = String.format("(&(%s)(%s=%s))",
groupSearchFilter, groupMemberFilter,
- userDN);
+ LDAPStringUtil.encodeForFilter(userDN));
msg = "STEP-4:TESTING: about to do ldap search with filter \n'"
+ filter
+ "'\n to locate groups that test user IS authorized to access.";
@@ -638,3 +665,74 @@ public class TestLdapSettings extends JFrame {
return constraints;
}
}
+
+class LDAPStringUtil {
+
+ /**
+ * <p>Encode a string so that it can be used in an LDAP search filter.</p>
+ *
+ * <p>The following table shows the characters that are encoded and their
+ * encoded version.</p>
+ *
+ * <table>
+ * <tr><th align="center">Character</th><th>Encoded As</th></tr>
+ * <tr><td align="center">*</td><td>\2a</td></tr>
+ * <tr><td align="center">(</td><td>\28</td></tr>
+ * <tr><td align="center">)</td><td>\29</td></tr>
+ * <tr><td align="center">\</td><td>\5c</td></tr>
+ * <tr><td align="center"><code>null</code></td><td>\00</td></tr>
+ * </table>
+ *
+ * <p>In addition to encoding the above characters, any non-ASCII character
+ * (any character with a hex value greater then <code>0x7f</code>) is also
+ * encoded and rewritten as a UTF-8 character or sequence of characters in
+ * hex notation.</p>
+ *
+ * @param filterString a string that is to be encoded
+ * @return the encoded version of <code>filterString</code> suitable for use
+ * in a LDAP search filter
+ * @see <a href="http://tools.ietf.org/html/rfc4515">RFC 4515</a>
+ */
+ public static String encodeForFilter(final String filterString) {
+ if (filterString != null && filterString.length() > 0) {
+ StringBuilder encString = new StringBuilder(filterString.length());
+ for (int i = 0; i < filterString.length(); i++) {
+ char ch = filterString.charAt(i);
+ switch (ch) {
+ case '*': // encode a wildcard * character
+ encString.append("\\2a");
+ break;
+ case '(': // encode a open parenthesis ( character
+ encString.append("\\28");
+ break;
+ case ')': // encode a close parenthesis ) character
+ encString.append("\\29");
+ break;
+ case '\\': // encode a backslash \ character
+ encString.append("\\5c");
+ break;
+ case '\u0000': // encode a null character
+ encString.append("\\00");
+ break;
+ default:
+ if (ch <= 0x7f) { // an ASCII character
+ encString.append(ch);
+ } else if (ch >= 0x80) { // encode to UTF-8
+ try {
+ byte[] utf8bytes = String.valueOf(ch).getBytes("UTF8");
+ for (byte b : utf8bytes) {
+ encString.append(String.format("\\%02x", b));
+ }
+ } catch (UnsupportedEncodingException e) {
+ // ignore
+ }
+ }
+ }
+ }
+ return encString.toString();
+ }
+ return filterString;
+ }
+
+}
+
10 years, 10 months
[rhq] modules/common
by John Sanda
modules/common/cassandra-installer/src/test/resources/rhq48/storage/conf/cassandra-env.sh | 247 +++
modules/common/cassandra-installer/src/test/resources/rhq48/storage/conf/cassandra.yaml | 690 ++++++++++
modules/common/cassandra-installer/src/test/resources/rhq48/storage/conf/log4j-server.properties | 45
3 files changed, 982 insertions(+)
New commits:
commit 5d3b55ed04d5da4eab12704c8391872cd93421ad
Author: John Sanda <jsanda(a)redhat.com>
Date: Fri Jul 19 15:35:34 2013 -0400
forgot to include new test resources in previous commit
diff --git a/modules/common/cassandra-installer/src/test/resources/rhq48/storage/conf/cassandra-env.sh b/modules/common/cassandra-installer/src/test/resources/rhq48/storage/conf/cassandra-env.sh
new file mode 100644
index 0000000..cd415b3
--- /dev/null
+++ b/modules/common/cassandra-installer/src/test/resources/rhq48/storage/conf/cassandra-env.sh
@@ -0,0 +1,247 @@
+# 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.
+
+calculate_heap_sizes()
+{
+ case "`uname`" in
+ Linux)
+ system_memory_in_mb=`free -m | awk '/Mem:/ {print $2}'`
+ system_cpu_cores=`egrep -c 'processor([[:space:]]+):.*' /proc/cpuinfo`
+ ;;
+ FreeBSD)
+ system_memory_in_bytes=`sysctl hw.physmem | awk '{print $2}'`
+ system_memory_in_mb=`expr $system_memory_in_bytes / 1024 / 1024`
+ system_cpu_cores=`sysctl hw.ncpu | awk '{print $2}'`
+ ;;
+ SunOS)
+ system_memory_in_mb=`prtconf | awk '/Memory size:/ {print $3}'`
+ system_cpu_cores=`psrinfo | wc -l`
+ ;;
+ Darwin)
+ system_memory_in_bytes=`sysctl hw.memsize | awk '{print $2}'`
+ system_memory_in_mb=`expr $system_memory_in_bytes / 1024 / 1024`
+ system_cpu_cores=`sysctl hw.ncpu | awk '{print $2}'`
+ ;;
+ *)
+ # assume reasonable defaults for e.g. a modern desktop or
+ # cheap server
+ system_memory_in_mb="2048"
+ system_cpu_cores="2"
+ ;;
+ esac
+
+ # some systems like the raspberry pi don't report cores, use at least 1
+ if [ "$system_cpu_cores" -lt "1" ]
+ then
+ system_cpu_cores="1"
+ fi
+
+ # set max heap size based on the following
+ # max(min(1/2 ram, 1024MB), min(1/4 ram, 8GB))
+ # calculate 1/2 ram and cap to 1024MB
+ # calculate 1/4 ram and cap to 8192MB
+ # pick the max
+ half_system_memory_in_mb=`expr $system_memory_in_mb / 2`
+ quarter_system_memory_in_mb=`expr $half_system_memory_in_mb / 2`
+ if [ "$half_system_memory_in_mb" -gt "1024" ]
+ then
+ half_system_memory_in_mb="1024"
+ fi
+ if [ "$quarter_system_memory_in_mb" -gt "8192" ]
+ then
+ quarter_system_memory_in_mb="8192"
+ fi
+ if [ "$half_system_memory_in_mb" -gt "$quarter_system_memory_in_mb" ]
+ then
+ max_heap_size_in_mb="$half_system_memory_in_mb"
+ else
+ max_heap_size_in_mb="$quarter_system_memory_in_mb"
+ fi
+ MAX_HEAP_SIZE="${max_heap_size_in_mb}M"
+
+ # Young gen: min(max_sensible_per_modern_cpu_core * num_cores, 1/4 * heap size)
+ max_sensible_yg_per_core_in_mb="100"
+ max_sensible_yg_in_mb=`expr $max_sensible_yg_per_core_in_mb "*" $system_cpu_cores`
+
+ desired_yg_in_mb=`expr $max_heap_size_in_mb / 4`
+
+ if [ "$desired_yg_in_mb" -gt "$max_sensible_yg_in_mb" ]
+ then
+ HEAP_NEWSIZE="${max_sensible_yg_in_mb}M"
+ else
+ HEAP_NEWSIZE="${desired_yg_in_mb}M"
+ fi
+}
+
+# Determine the sort of JVM we'll be running on.
+
+java_ver_output=`"${JAVA:-java}" -version 2>&1`
+
+jvmver=`echo "$java_ver_output" | awk -F'"' 'NR==1 {print $2}'`
+JVM_VERSION=${jvmver%_*}
+JVM_PATCH_VERSION=${jvmver#*_}
+
+jvm=`echo "$java_ver_output" | awk 'NR==2 {print $1}'`
+case "$jvm" in
+ OpenJDK)
+ JVM_VENDOR=OpenJDK
+ # this will be "64-Bit" or "32-Bit"
+ JVM_ARCH=`echo "$java_ver_output" | awk 'NR==3 {print $2}'`
+ ;;
+ "Java(TM)")
+ JVM_VENDOR=Oracle
+ # this will be "64-Bit" or "32-Bit"
+ JVM_ARCH=`echo "$java_ver_output" | awk 'NR==3 {print $3}'`
+ ;;
+ *)
+ # Help fill in other JVM values
+ JVM_VENDOR=other
+ JVM_ARCH=unknown
+ ;;
+esac
+
+
+# Override these to set the amount of memory to allocate to the JVM at
+# start-up. For production use you may wish to adjust this for your
+# environment. MAX_HEAP_SIZE is the total amount of memory dedicated
+# to the Java heap; HEAP_NEWSIZE refers to the size of the young
+# generation. Both MAX_HEAP_SIZE and HEAP_NEWSIZE should be either set
+# or not (if you set one, set the other).
+#
+# The main trade-off for the young generation is that the larger it
+# is, the longer GC pause times will be. The shorter it is, the more
+# expensive GC will be (usually).
+#
+# The example HEAP_NEWSIZE assumes a modern 8-core+ machine for decent pause
+# times. If in doubt, and if you do not particularly want to tweak, go with
+# 100 MB per physical CPU core.
+
+#MAX_HEAP_SIZE="4G"
+#HEAP_NEWSIZE="800M"
+
+if [ "x$MAX_HEAP_SIZE" = "x" ] && [ "x$HEAP_NEWSIZE" = "x" ]; then
+ calculate_heap_sizes
+else
+ if [ "x$MAX_HEAP_SIZE" = "x" ] || [ "x$HEAP_NEWSIZE" = "x" ]; then
+ echo "please set or unset MAX_HEAP_SIZE and HEAP_NEWSIZE in pairs (see cassandra-env.sh)"
+ exit 1
+ fi
+fi
+
+# Specifies the default port over which Cassandra will be available for
+# JMX connections.
+JMX_PORT="7399"
+
+
+# Here we create the arguments that will get passed to the jvm when
+# starting cassandra.
+
+# enable assertions. disabling this in production will give a modest
+# performance benefit (around 5%).
+JVM_OPTS="$JVM_OPTS -ea"
+
+# add the jamm javaagent
+if [ "$JVM_VENDOR" != "OpenJDK" -o "$JVM_VERSION" \> "1.6.0" ] \
+ || [ "$JVM_VERSION" = "1.6.0" -a "$JVM_PATCH_VERSION" -ge 23 ]
+then
+ JVM_OPTS="$JVM_OPTS -javaagent:$CASSANDRA_HOME/lib/jamm-0.2.5.jar"
+fi
+
+# enable thread priorities, primarily so we can give periodic tasks
+# a lower priority to avoid interfering with client workload
+JVM_OPTS="$JVM_OPTS -XX:+UseThreadPriorities"
+# allows lowering thread priority without being root. see
+# http://tech.stolsvik.com/2010/01/linux-java-thread-priorities-workaround....
+JVM_OPTS="$JVM_OPTS -XX:ThreadPriorityPolicy=42"
+
+# min and max heap sizes should be set to the same value to avoid
+# stop-the-world GC pauses during resize, and so that we can lock the
+# heap in memory on startup to prevent any of it from being swapped
+# out.
+JVM_OPTS="$JVM_OPTS -Xms512M"
+JVM_OPTS="$JVM_OPTS -Xmx512M"
+JVM_OPTS="$JVM_OPTS -Xmn128M"
+JVM_OPTS="$JVM_OPTS -XX:+HeapDumpOnOutOfMemoryError"
+
+# set jvm HeapDumpPath with CASSANDRA_HEAPDUMP_DIR
+if [ "x$CASSANDRA_HEAPDUMP_DIR" != "x" ]; then
+ JVM_OPTS="$JVM_OPTS -XX:HeapDumpPath=$CASSANDRA_HEAPDUMP_DIR/cassandra-`date +%s`-pid$$.hprof"
+fi
+
+
+startswith() { [ "${1#$2}" != "$1" ]; }
+
+if [ "`uname`" = "Linux" ] ; then
+ # reduce the per-thread stack size to minimize the impact of Thrift
+ # thread-per-client. (Best practice is for client connections to
+ # be pooled anyway.) Only do so on Linux where it is known to be
+ # supported.
+ # u34 and greater need 180k
+ JVM_OPTS="$JVM_OPTS -Xss180k"
+fi
+echo "xss = $JVM_OPTS"
+
+# GC tuning options
+JVM_OPTS="$JVM_OPTS -XX:+UseParNewGC"
+JVM_OPTS="$JVM_OPTS -XX:+UseConcMarkSweepGC"
+JVM_OPTS="$JVM_OPTS -XX:+CMSParallelRemarkEnabled"
+JVM_OPTS="$JVM_OPTS -XX:SurvivorRatio=8"
+JVM_OPTS="$JVM_OPTS -XX:MaxTenuringThreshold=1"
+JVM_OPTS="$JVM_OPTS -XX:CMSInitiatingOccupancyFraction=75"
+JVM_OPTS="$JVM_OPTS -XX:+UseCMSInitiatingOccupancyOnly"
+JVM_OPTS="$JVM_OPTS -XX:+UseTLAB"
+# note: bash evals '1.7.x' as > '1.7' so this is really a >= 1.7 jvm check
+if [ "$JVM_VERSION" \> "1.7" ] ; then
+ JVM_OPTS="$JVM_OPTS -XX:+UseCondCardMark"
+fi
+
+# GC logging options -- uncomment to enable
+# JVM_OPTS="$JVM_OPTS -XX:+PrintGCDetails"
+# JVM_OPTS="$JVM_OPTS -XX:+PrintGCDateStamps"
+# JVM_OPTS="$JVM_OPTS -XX:+PrintHeapAtGC"
+# JVM_OPTS="$JVM_OPTS -XX:+PrintTenuringDistribution"
+# JVM_OPTS="$JVM_OPTS -XX:+PrintGCApplicationStoppedTime"
+# JVM_OPTS="$JVM_OPTS -XX:+PrintPromotionFailure"
+# JVM_OPTS="$JVM_OPTS -XX:PrintFLSStatistics=1"
+# JVM_OPTS="$JVM_OPTS -Xloggc:/var/log/cassandra/gc-`date +%s`.log"
+# If you are using JDK 6u34 7u2 or later you can enable GC log rotation
+# don't stick the date in the log name if rotation is on.
+# JVM_OPTS="$JVM_OPTS -Xloggc:/var/log/cassandra/gc.log"
+# JVM_OPTS="$JVM_OPTS -XX:+UseGCLogFileRotation"
+# JVM_OPTS="$JVM_OPTS -XX:NumberOfGCLogFiles=10"
+# JVM_OPTS="$JVM_OPTS -XX:GCLogFileSize=10M"
+
+# uncomment to have Cassandra JVM listen for remote debuggers/profilers on port 1414
+# JVM_OPTS="$JVM_OPTS -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1414"
+
+# Prefer binding to IPv4 network intefaces (when net.ipv6.bindv6only=1). See
+# http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6342561 (short version:
+# comment out this entry to enable IPv6 support).
+JVM_OPTS="$JVM_OPTS -Djava.net.preferIPv4Stack=true"
+
+# jmx: metrics and administration interface
+#
+# add this if you're having trouble connecting:
+# JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=<public name>"
+#
+# see
+# https://blogs.oracle.com/jmxetc/entry/troubleshooting_connection_problems...
+# for more on configuring JMX through firewalls, etc. (Short version:
+# get it working with no firewall first.)
+JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.port=$JMX_PORT"
+JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.ssl=false"
+JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
+JVM_OPTS="$JVM_OPTS $JVM_EXTRA_OPTS"
diff --git a/modules/common/cassandra-installer/src/test/resources/rhq48/storage/conf/cassandra.yaml b/modules/common/cassandra-installer/src/test/resources/rhq48/storage/conf/cassandra.yaml
new file mode 100644
index 0000000..8c9c68c
--- /dev/null
+++ b/modules/common/cassandra-installer/src/test/resources/rhq48/storage/conf/cassandra.yaml
@@ -0,0 +1,690 @@
+# Cassandra storage config YAML
+
+# NOTE:
+# See http://wiki.apache.org/cassandra/StorageConfiguration for
+# full explanations of configuration directives
+# /NOTE
+
+# The name of the cluster. This is mainly used to prevent machines in
+# one logical cluster from joining another.
+cluster_name: rhq
+
+# This defines the number of tokens randomly assigned to this node on the ring
+# The more tokens, relative to other nodes, the larger the proportion of data
+# that this node will store. You probably want all nodes to have the same number
+# of tokens assuming they have equal hardware capability.
+#
+# If you leave this unspecified, Cassandra will use the default of 1 token for legacy compatibility,
+# and will use the initial_token as described below.
+#
+# Specifying initial_token will override this setting.
+#
+# If you already have a cluster with 1 token per node, and wish to migrate to
+# multiple tokens per node, see http://wiki.apache.org/cassandra/Operations
+num_tokens: 256
+
+# If you haven't specified num_tokens, or have set it to the default of 1 then
+# you should always specify InitialToken when setting up a production
+# cluster for the first time, and often when adding capacity later.
+# The principle is that each node should be given an equal slice of
+# the token ring; see http://wiki.apache.org/cassandra/Operations
+# for more details.
+#
+# If blank, Cassandra will request a token bisecting the range of
+# the heaviest-loaded existing node. If there is no load information
+# available, such as is the case with a new cluster, it will pick
+# a random token, which will lead to hot spots.
+#initial_token:
+
+# See http://wiki.apache.org/cassandra/HintedHandoff
+hinted_handoff_enabled: true
+# this defines the maximum amount of time a dead host will have hints
+# generated. After it has been dead this long, new hints for it will not be
+# created until it has been seen alive and gone down again.
+max_hint_window_in_ms: 10800000 # 3 hours
+# throttle in KB's per second, per delivery thread
+hinted_handoff_throttle_in_kb: 1024
+# Number of threads with which to deliver hints;
+# Consider increasing this number when you have multi-dc deployments, since
+# cross-dc handoff tends to be slower
+max_hints_delivery_threads: 2
+
+# The following setting populates the page cache on memtable flush and compaction
+# WARNING: Enable this setting only when the whole node's data fits in memory.
+# Defaults to: false
+# populate_io_cache_on_flush: false
+
+# Authentication backend, implementing IAuthenticator; used to identify users
+# Out of the box, Cassandra provides org.apache.cassandra.auth.{AllowAllAuthenticator,
+# PasswordAuthenticator}.
+#
+# - AllowAllAuthenticator performs no checks - set it to disable authentication.
+# - PasswordAuthenticator relies on username/password pairs to authenticate
+# users. It keeps usernames and hashed passwords in system_auth.credentials table.
+# Please increase system_auth keyspace replication factor if you use this authenticator.
+authenticator: org.apache.cassandra.auth.PasswordAuthenticator
+
+# Authorization backend, implementing IAuthorizer; used to limit access/provide permissions
+# Out of the box, Cassandra provides org.apache.cassandra.auth.{AllowAllAuthorizer,
+# CassandraAuthorizer}.
+#
+# - AllowAllAuthorizer allows any action to any user - set it to disable authorization.
+# - CassandraAuthorizer stores permissions in system_auth.permissions table. Please
+# increase system_auth keyspace replication factor if you use this authorizer.
+authorizer: org.apache.cassandra.auth.CassandraAuthorizer
+
+# Validity period for permissions cache (fetching permissions can be an
+# expensive operation depending on the authorizer, CassandraAuthorizer is
+# one example). Defaults to 2000, set to 0 to disable.
+# Will be disabled automatically for AllowAllAuthorizer.
+permissions_validity_in_ms: 2000
+
+# The partitioner is responsible for distributing rows (by key) across
+# nodes in the cluster. Any IPartitioner may be used, including your
+# own as long as it is on the classpath. Out of the box, Cassandra
+# provides org.apache.cassandra.dht.{Murmur3Partitioner, RandomPartitioner
+# ByteOrderedPartitioner, OrderPreservingPartitioner (deprecated)}.
+#
+# - RandomPartitioner distributes rows across the cluster evenly by md5.
+# This is the default prior to 1.2 and is retained for compatibility.
+# - Murmur3Partitioner is similar to RandomPartioner but uses Murmur3_128
+# Hash Function instead of md5. When in doubt, this is the best option.
+# - ByteOrderedPartitioner orders rows lexically by key bytes. BOP allows
+# scanning rows in key order, but the ordering can generate hot spots
+# for sequential insertion workloads.
+# - OrderPreservingPartitioner is an obsolete form of BOP, that stores
+# - keys in a less-efficient format and only works with keys that are
+# UTF8-encoded Strings.
+# - CollatingOPP colates according to EN,US rules rather than lexical byte
+# ordering. Use this as an example if you need custom collation.
+#
+# See http://wiki.apache.org/cassandra/Operations for more on
+# partitioners and token selection.
+partitioner: org.apache.cassandra.dht.Murmur3Partitioner
+
+# directories where Cassandra should store data on disk.
+data_file_directories:
+ - target/rhq48/rhq-storage/data
+
+# commit log
+commitlog_directory: target/rhq48/rhq-storage/commit_log
+
+# policy for data disk failures:
+# stop: shut down gossip and Thrift, leaving the node effectively dead, but
+# still inspectable via JMX.
+# best_effort: stop using the failed disk and respond to requests based on
+# remaining available sstables. This means you WILL see obsolete
+# data at CL.ONE!
+# ignore: ignore fatal errors and let requests fail, as in pre-1.2 Cassandra
+disk_failure_policy: stop
+
+# Maximum size of the key cache in memory.
+#
+# Each key cache hit saves 1 seek and each row cache hit saves 2 seeks at the
+# minimum, sometimes more. The key cache is fairly tiny for the amount of
+# time it saves, so it's worthwhile to use it at large numbers.
+# The row cache saves even more time, but must store the whole values of
+# its rows, so it is extremely space-intensive. It's best to only use the
+# row cache if you have hot rows or static rows.
+#
+# NOTE: if you reduce the size, you may not get you hottest keys loaded on startup.
+#
+# Default value is empty to make it "auto" (min(5% of Heap (in MB), 100MB)). Set to 0 to disable key cache.
+key_cache_size_in_mb:
+
+# Duration in seconds after which Cassandra should
+# safe the keys cache. Caches are saved to saved_caches_directory as
+# specified in this configuration file.
+#
+# Saved caches greatly improve cold-start speeds, and is relatively cheap in
+# terms of I/O for the key cache. Row cache saving is much more expensive and
+# has limited use.
+#
+# Default is 14400 or 4 hours.
+key_cache_save_period: 14400
+
+# Number of keys from the key cache to save
+# Disabled by default, meaning all keys are going to be saved
+# key_cache_keys_to_save: 100
+
+# Maximum size of the row cache in memory.
+# NOTE: if you reduce the size, you may not get you hottest keys loaded on startup.
+#
+# Default value is 0, to disable row caching.
+row_cache_size_in_mb: 0
+
+# Duration in seconds after which Cassandra should
+# safe the row cache. Caches are saved to saved_caches_directory as specified
+# in this configuration file.
+#
+# Saved caches greatly improve cold-start speeds, and is relatively cheap in
+# terms of I/O for the key cache. Row cache saving is much more expensive and
+# has limited use.
+#
+# Default is 0 to disable saving the row cache.
+row_cache_save_period: 0
+
+# Number of keys from the row cache to save
+# Disabled by default, meaning all keys are going to be saved
+# row_cache_keys_to_save: 100
+
+# The provider for the row cache to use.
+#
+# Supported values are: ConcurrentLinkedHashCacheProvider, SerializingCacheProvider
+#
+# SerializingCacheProvider serialises the contents of the row and stores
+# it in native memory, i.e., off the JVM Heap. Serialized rows take
+# significantly less memory than "live" rows in the JVM, so you can cache
+# more rows in a given memory footprint. And storing the cache off-heap
+# means you can use smaller heap sizes, reducing the impact of GC pauses.
+#
+# It is also valid to specify the fully-qualified class name to a class
+# that implements org.apache.cassandra.cache.IRowCacheProvider.
+#
+# Defaults to SerializingCacheProvider
+row_cache_provider: SerializingCacheProvider
+
+# saved caches
+saved_caches_directory: target/rhq48/rhq-storage/saved_caches
+
+# commitlog_sync may be either "periodic" or "batch."
+# When in batch mode, Cassandra won't ack writes until the commit log
+# has been fsynced to disk. It will wait up to
+# commitlog_sync_batch_window_in_ms milliseconds for other writes, before
+# performing the sync.
+#
+# commitlog_sync: batch
+# commitlog_sync_batch_window_in_ms: 50
+#
+# the other option is "periodic" where writes may be acked immediately
+# and the CommitLog is simply synced every commitlog_sync_period_in_ms
+# milliseconds.
+commitlog_sync: periodic
+commitlog_sync_period_in_ms: 10000
+
+# The size of the individual commitlog file segments. A commitlog
+# segment may be archived, deleted, or recycled once all the data
+# in it (potentally from each columnfamily in the system) has been
+# flushed to sstables.
+#
+# The default size is 32, which is almost always fine, but if you are
+# archiving commitlog segments (see commitlog_archiving.properties),
+# then you probably want a finer granularity of archiving; 8 or 16 MB
+# is reasonable.
+commitlog_segment_size_in_mb: 32
+
+# any class that implements the SeedProvider interface and has a
+# constructor that takes a Map<String, String> of parameters will do.
+seed_provider:
+ # Addresses of hosts that are deemed contact points.
+ # Cassandra nodes use this list of hosts to find each other and learn
+ # the topology of the ring. You must change this if you are running
+ # multiple nodes!
+ - class_name: org.apache.cassandra.locator.SimpleSeedProvider
+ parameters:
+ # seeds is actually a comma-delimited list of addresses.
+ # Ex: "<ip1>,<ip2>,<ip3>"
+ - seeds: "127.0.0.1"
+
+# emergency pressure valve: each time heap usage after a full (CMS)
+# garbage collection is above this fraction of the max, Cassandra will
+# flush the largest memtables.
+#
+# Set to 1.0 to disable. Setting this lower than
+# CMSInitiatingOccupancyFraction is not likely to be useful.
+#
+# RELYING ON THIS AS YOUR PRIMARY TUNING MECHANISM WILL WORK POORLY:
+# it is most effective under light to moderate load, or read-heavy
+# workloads; under truly massive write load, it will often be too
+# little, too late.
+flush_largest_memtables_at: 0.75
+
+# emergency pressure valve #2: the first time heap usage after a full
+# (CMS) garbage collection is above this fraction of the max,
+# Cassandra will reduce cache maximum _capacity_ to the given fraction
+# of the current _size_. Should usually be set substantially above
+# flush_largest_memtables_at, since that will have less long-term
+# impact on the system.
+#
+# Set to 1.0 to disable. Setting this lower than
+# CMSInitiatingOccupancyFraction is not likely to be useful.
+reduce_cache_sizes_at: 0.85
+reduce_cache_capacity_to: 0.6
+
+# For workloads with more data than can fit in memory, Cassandra's
+# bottleneck will be reads that need to fetch data from
+# disk. "concurrent_reads" should be set to (16 * number_of_drives) in
+# order to allow the operations to enqueue low enough in the stack
+# that the OS and drives can reorder them.
+#
+# On the other hand, since writes are almost never IO bound, the ideal
+# number of "concurrent_writes" is dependent on the number of cores in
+# your system; (8 * number_of_cores) is a good rule of thumb.
+concurrent_reads: 32
+concurrent_writes: 32
+
+# Total memory to use for memtables. Cassandra will flush the largest
+# memtable when this much memory is used.
+# If omitted, Cassandra will set it to 1/3 of the heap.
+# memtable_total_space_in_mb: 2048
+
+# Total space to use for commitlogs. Since commitlog segments are
+# mmapped, and hence use up address space, the default size is 32
+# on 32-bit JVMs, and 1024 on 64-bit JVMs.
+#
+# If space gets above this value (it will round up to the next nearest
+# segment multiple), Cassandra will flush every dirty CF in the oldest
+# segment and remove it. So a small total commitlog space will tend
+# to cause more flush activity on less-active columnfamilies.
+# commitlog_total_space_in_mb: 4096
+
+# This sets the amount of memtable flush writer threads. These will
+# be blocked by disk io, and each one will hold a memtable in memory
+# while blocked. If you have a large heap and many data directories,
+# you can increase this value for better flush performance.
+# By default this will be set to the amount of data directories defined.
+#memtable_flush_writers: 1
+
+# the number of full memtables to allow pending flush, that is,
+# waiting for a writer thread. At a minimum, this should be set to
+# the maximum number of secondary indexes created on a single CF.
+memtable_flush_queue_size: 4
+
+# Whether to, when doing sequential writing, fsync() at intervals in
+# order to force the operating system to flush the dirty
+# buffers. Enable this to avoid sudden dirty buffer flushing from
+# impacting read latencies. Almost always a good idea on SSD:s; not
+# necessarily on platters.
+trickle_fsync: false
+trickle_fsync_interval_in_kb: 10240
+
+# TCP port, for commands and data
+storage_port: 7100
+
+# SSL port, for encrypted communication. Unused unless enabled in
+# encryption_options
+ssl_storage_port: 7101
+
+# Address to bind to and tell other Cassandra nodes to connect to. You
+# _must_ change this if you want multiple nodes to be able to
+# communicate!
+#
+# Leaving it blank leaves it up to InetAddress.getLocalHost(). This
+# will always do the Right Thing *if* the node is properly configured
+# (hostname, name resolution, etc), and the Right Thing is to use the
+# address associated with the hostname (it might not be).
+#
+# Setting this to 0.0.0.0 is always wrong.
+listen_address: 127.0.0.1
+
+# Address to broadcast to other Cassandra nodes
+# Leaving this blank will set it to the same value as listen_address
+# broadcast_address: 1.2.3.4
+
+# Internode authentication backend, implementing IInternodeAuthenticator;
+# used to allow/disallow connections from peer nodes.
+# internode_authenticator: org.apache.cassandra.auth.AllowAllInternodeAuthenticator
+
+# Whether to start the native transport server.
+# Currently, only the thrift server is started by default because the native
+# transport is considered beta.
+# Please note that the address on which the native transport is bound is the
+# same as the rpc_address. The port however is different and specified below.
+start_native_transport: true
+# port for the CQL native transport to listen for clients on
+native_transport_port: 9142
+# The minimum and maximum threads for handling requests when the native
+# transport is used. The meaning is those is similar to the one of
+# rpc_min_threads and rpc_max_threads, though the default differ slightly and
+# are the ones below:
+# native_transport_min_threads: 16
+native_transport_max_threads: 128
+
+
+# Whether to start the thrift rpc server.
+start_rpc: false
+# The address to bind the Thrift RPC service to -- clients connect
+# here. Unlike ListenAddress above, you *can* specify 0.0.0.0 here if
+# you want Thrift to listen on all interfaces.
+#
+# Leaving this blank has the same effect it does for ListenAddress,
+# (i.e. it will be based on the configured hostname of the node).
+rpc_address: 127.0.0.1
+# port for Thrift to listen for clients on
+rpc_port: 9160
+
+# enable or disable keepalive on rpc connections
+rpc_keepalive: true
+
+# Cassandra provides three out-of-the-box options for the RPC Server:
+#
+# sync -> One thread per thrift connection. For a very large number of clients, memory
+# will be your limiting factor. On a 64 bit JVM, 128KB is the minimum stack size
+# per thread, and that will correspond to your use of virtual memory (but physical memory
+# may be limited depending on use of stack space).
+#
+# hsha -> Stands for "half synchronous, half asynchronous." All thrift clients are handled
+# asynchronously using a small number of threads that does not vary with the amount
+# of thrift clients (and thus scales well to many clients). The rpc requests are still
+# synchronous (one thread per active request).
+#
+# The default is sync because on Windows hsha is about 30% slower. On Linux,
+# sync/hsha performance is about the same, with hsha of course using less memory.
+#
+# Alternatively, can provide your own RPC server by providing the fully-qualified class name
+# of an o.a.c.t.TServerFactory that can create an instance of it.
+rpc_server_type: sync
+
+# Uncomment rpc_min|max_thread to set request pool size limits.
+#
+# Regardless of your choice of RPC server (see above), the number of maximum requests in the
+# RPC thread pool dictates how many concurrent requests are possible (but if you are using the sync
+# RPC server, it also dictates the number of clients that can be connected at all).
+#
+# The default is unlimited and thus provide no protection against clients overwhelming the server. You are
+# encouraged to set a maximum that makes sense for you in production, but do keep in mind that
+# rpc_max_threads represents the maximum number of client requests this server may execute concurrently.
+#
+# rpc_min_threads: 16
+# rpc_max_threads: 2048
+
+# uncomment to set socket buffer sizes on rpc connections
+# rpc_send_buff_size_in_bytes:
+# rpc_recv_buff_size_in_bytes:
+
+# uncomment to set socket buffer size for internode communication
+# Note that when setting this, the buffer size is limited by net.core.wmem_max
+# and when not setting it it is defined by net.ipv4.tcp_wmem
+# See:
+# /proc/sys/net/core/wmem_max
+# /proc/sys/net/core/rmem_max
+# /proc/sys/net/ipv4/tcp_wmem
+# /proc/sys/net/ipv4/tcp_wmem
+# and: man tcp
+# internode_send_buff_size_in_bytes:
+# internode_recv_buff_size_in_bytes:
+
+# Frame size for thrift (maximum field length).
+thrift_framed_transport_size_in_mb: 15
+
+# The max length of a thrift message, including all fields and
+# internal thrift overhead.
+thrift_max_message_length_in_mb: 16
+
+# Set to true to have Cassandra create a hard link to each sstable
+# flushed or streamed locally in a backups/ subdirectory of the
+# Keyspace data. Removing these links is the operator's
+# responsibility.
+incremental_backups: false
+
+# Whether or not to take a snapshot before each compaction. Be
+# careful using this option, since Cassandra won't clean up the
+# snapshots for you. Mostly useful if you're paranoid when there
+# is a data format change.
+snapshot_before_compaction: false
+
+# Whether or not a snapshot is taken of the data before keyspace truncation
+# or dropping of column families. The STRONGLY advised default of true
+# should be used to provide data safety. If you set this flag to false, you will
+# lose data on truncation or drop.
+auto_snapshot: true
+
+# Add column indexes to a row after its contents reach this size.
+# Increase if your column values are large, or if you have a very large
+# number of columns. The competing causes are, Cassandra has to
+# deserialize this much of the row to read a single column, so you want
+# it to be small - at least if you do many partial-row reads - but all
+# the index data is read for each access, so you don't want to generate
+# that wastefully either.
+column_index_size_in_kb: 64
+
+# Size limit for rows being compacted in memory. Larger rows will spill
+# over to disk and use a slower two-pass compaction process. A message
+# will be logged specifying the row key.
+in_memory_compaction_limit_in_mb: 64
+
+# Number of simultaneous compactions to allow, NOT including
+# validation "compactions" for anti-entropy repair. Simultaneous
+# compactions can help preserve read performance in a mixed read/write
+# workload, by mitigating the tendency of small sstables to accumulate
+# during a single long running compactions. The default is usually
+# fine and if you experience problems with compaction running too
+# slowly or too fast, you should look at
+# compaction_throughput_mb_per_sec first.
+#
+# concurrent_compactors defaults to the number of cores.
+# Uncomment to make compaction mono-threaded, the pre-0.8 default.
+#concurrent_compactors: 1
+
+# Multi-threaded compaction. When enabled, each compaction will use
+# up to one thread per core, plus one thread per sstable being merged.
+# This is usually only useful for SSD-based hardware: otherwise,
+# your concern is usually to get compaction to do LESS i/o (see:
+# compaction_throughput_mb_per_sec), not more.
+multithreaded_compaction: false
+
+# Throttles compaction to the given total throughput across the entire
+# system. The faster you insert data, the faster you need to compact in
+# order to keep the sstable count down, but in general, setting this to
+# 16 to 32 times the rate you are inserting data is more than sufficient.
+# Setting this to 0 disables throttling. Note that this account for all types
+# of compaction, including validation compaction.
+compaction_throughput_mb_per_sec: 16
+
+# Track cached row keys during compaction, and re-cache their new
+# positions in the compacted sstable. Disable if you use really large
+# key caches.
+compaction_preheat_key_cache: true
+
+# Throttles all outbound streaming file transfers on this node to the
+# given total throughput in Mbps. This is necessary because Cassandra does
+# mostly sequential IO when streaming data during bootstrap or repair, which
+# can lead to saturating the network connection and degrading rpc performance.
+# When unset, the default is 200 Mbps or 25 MB/s.
+# stream_throughput_outbound_megabits_per_sec: 200
+
+# How long the coordinator should wait for read operations to complete
+read_request_timeout_in_ms: 20000
+# How long the coordinator should wait for seq or index scans to complete
+range_request_timeout_in_ms: 20000
+# How long the coordinator should wait for writes to complete
+write_request_timeout_in_ms: 20000
+# How long the coordinator should wait for truncates to complete
+# (This can be much longer, because we need to flush all CFs
+# to make sure we can clear out anythink in the commitlog that could
+# cause truncated data to reappear.)
+truncate_request_timeout_in_ms: 60000
+# The default timeout for other, miscellaneous operations
+request_timeout_in_ms: 20000
+
+# Enable operation timeout information exchange between nodes to accurately
+# measure request timeouts, If disabled cassandra will assuming the request
+# was forwarded to the replica instantly by the coordinator
+#
+# Warning: before enabling this property make sure to ntp is installed
+# and the times are synchronized between the nodes.
+cross_node_timeout: false
+
+# Enable socket timeout for streaming operation.
+# When a timeout occurs during streaming, streaming is retried from the start
+# of the current file. This *can* involve re-streaming an important amount of
+# data, so you should avoid setting the value too low.
+# Default value is 0, which never timeout streams.
+# streaming_socket_timeout_in_ms: 0
+
+# phi value that must be reached for a host to be marked down.
+# most users should never need to adjust this.
+# phi_convict_threshold: 8
+
+# endpoint_snitch -- Set this to a class that implements
+# IEndpointSnitch. The snitch has two functions:
+# - it teaches Cassandra enough about your network topology to route
+# requests efficiently
+# - it allows Cassandra to spread replicas around your cluster to avoid
+# correlated failures. It does this by grouping machines into
+# "datacenters" and "racks." Cassandra will do its best not to have
+# more than one replica on the same "rack" (which may not actually
+# be a physical location)
+#
+# IF YOU CHANGE THE SNITCH AFTER DATA IS INSERTED INTO THE CLUSTER,
+# YOU MUST RUN A FULL REPAIR, SINCE THE SNITCH AFFECTS WHERE REPLICAS
+# ARE PLACED.
+#
+# Out of the box, Cassandra provides
+# - SimpleSnitch:
+# Treats Strategy order as proximity. This improves cache locality
+# when disabling read repair, which can further improve throughput.
+# Only appropriate for single-datacenter deployments.
+# - PropertyFileSnitch:
+# Proximity is determined by rack and data center, which are
+# explicitly configured in cassandra-topology.properties.
+# - GossipingPropertyFileSnitch
+# The rack and datacenter for the local node are defined in
+# cassandra-rackdc.properties and propagated to other nodes via gossip. If
+# cassandra-topology.properties exists, it is used as a fallback, allowing
+# migration from the PropertyFileSnitch.
+# - RackInferringSnitch:
+# Proximity is determined by rack and data center, which are
+# assumed to correspond to the 3rd and 2nd octet of each node's
+# IP address, respectively. Unless this happens to match your
+# deployment conventions (as it did Facebook's), this is best used
+# as an example of writing a custom Snitch class.
+# - Ec2Snitch:
+# Appropriate for EC2 deployments in a single Region. Loads Region
+# and Availability Zone information from the EC2 API. The Region is
+# treated as the Datacenter, and the Availability Zone as the rack.
+# Only private IPs are used, so this will not work across multiple
+# Regions.
+# - Ec2MultiRegionSnitch:
+# Uses public IPs as broadcast_address to allow cross-region
+# connectivity. (Thus, you should set seed addresses to the public
+# IP as well.) You will need to open the storage_port or
+# ssl_storage_port on the public IP firewall. (For intra-Region
+# traffic, Cassandra will switch to the private IP after
+# establishing a connection.)
+#
+# You can use a custom Snitch by setting this to the full class name
+# of the snitch, which will be assumed to be on your classpath.
+endpoint_snitch: SimpleSnitch
+
+# controls how often to perform the more expensive part of host score
+# calculation
+dynamic_snitch_update_interval_in_ms: 100
+# controls how often to reset all host scores, allowing a bad host to
+# possibly recover
+dynamic_snitch_reset_interval_in_ms: 600000
+# if set greater than zero and read_repair_chance is < 1.0, this will allow
+# 'pinning' of replicas to hosts in order to increase cache capacity.
+# The badness threshold will control how much worse the pinned host has to be
+# before the dynamic snitch will prefer other replicas over it. This is
+# expressed as a double which represents a percentage. Thus, a value of
+# 0.2 means Cassandra would continue to prefer the static snitch values
+# until the pinned host was 20% worse than the fastest.
+dynamic_snitch_badness_threshold: 0.1
+
+# request_scheduler -- Set this to a class that implements
+# RequestScheduler, which will schedule incoming client requests
+# according to the specific policy. This is useful for multi-tenancy
+# with a single Cassandra cluster.
+# NOTE: This is specifically for requests from the client and does
+# not affect inter node communication.
+# org.apache.cassandra.scheduler.NoScheduler - No scheduling takes place
+# org.apache.cassandra.scheduler.RoundRobinScheduler - Round robin of
+# client requests to a node with a separate queue for each
+# request_scheduler_id. The scheduler is further customized by
+# request_scheduler_options as described below.
+request_scheduler: org.apache.cassandra.scheduler.NoScheduler
+
+# Scheduler Options vary based on the type of scheduler
+# NoScheduler - Has no options
+# RoundRobin
+# - throttle_limit -- The throttle_limit is the number of in-flight
+# requests per client. Requests beyond
+# that limit are queued up until
+# running requests can complete.
+# The value of 80 here is twice the number of
+# concurrent_reads + concurrent_writes.
+# - default_weight -- default_weight is optional and allows for
+# overriding the default which is 1.
+# - weights -- Weights are optional and will default to 1 or the
+# overridden default_weight. The weight translates into how
+# many requests are handled during each turn of the
+# RoundRobin, based on the scheduler id.
+#
+# request_scheduler_options:
+# throttle_limit: 80
+# default_weight: 5
+# weights:
+# Keyspace1: 1
+# Keyspace2: 5
+
+# request_scheduler_id -- An identifer based on which to perform
+# the request scheduling. Currently the only valid option is keyspace.
+# request_scheduler_id: keyspace
+
+# index_interval controls the sampling of entries from the primrary
+# row index in terms of space versus time. The larger the interval,
+# the smaller and less effective the sampling will be. In technicial
+# terms, the interval coresponds to the number of index entries that
+# are skipped between taking each sample. All the sampled entries
+# must fit in memory. Generally, a value between 128 and 512 here
+# coupled with a large key cache size on CFs results in the best trade
+# offs. This value is not often changed, however if you have many
+# very small rows (many to an OS page), then increasing this will
+# often lower memory usage without a impact on performance.
+index_interval: 128
+
+# Enable or disable inter-node encryption
+# Default settings are TLS v1, RSA 1024-bit keys (it is imperative that
+# users generate their own keys) TLS_RSA_WITH_AES_128_CBC_SHA as the cipher
+# suite for authentication, key exchange and encryption of the actual data transfers.
+# NOTE: No custom encryption options are enabled at the moment
+# The available internode options are : all, none, dc, rack
+#
+# If set to dc cassandra will encrypt the traffic between the DCs
+# If set to rack cassandra will encrypt the traffic between the racks
+#
+# The passwords used in these options must match the passwords used when generating
+# the keystore and truststore. For instructions on generating these files, see:
+# http://download.oracle.com/javase/6/docs/technotes/guides/security/jsse/J...
+#
+server_encryption_options:
+ internode_encryption: none
+ keystore: conf/.keystore
+ keystore_password: cassandra
+ truststore: conf/.truststore
+ truststore_password: cassandra
+ # More advanced defaults below:
+ # protocol: TLS
+ # algorithm: SunX509
+ # store_type: JKS
+ # cipher_suites: [TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA]
+ # require_client_auth: false
+
+# enable or disable client/server encryption.
+client_encryption_options:
+ enabled: false
+ keystore: conf/.keystore
+ keystore_password: cassandra
+ # require_client_auth: false
+ # Set trustore and truststore_password if require_client_auth is true
+ # truststore: conf/.truststore
+ # truststore_password: cassandra
+ # More advanced defaults below:
+ # protocol: TLS
+ # algorithm: SunX509
+ # store_type: JKS
+ # cipher_suites: [TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA]
+
+# internode_compression controls whether traffic between nodes is
+# compressed.
+# can be: all - all traffic is compressed
+# dc - traffic between different datacenters is compressed
+# none - nothing is compressed.
+internode_compression: all
+
+# Enable or disable tcp_nodelay for inter-dc communication.
+# Disabling it will result in larger (but fewer) network packets being sent,
+# reducing overhead from the TCP protocol itself, at the cost of increasing
+# latency if you block for cross-datacenter responses.
+inter_dc_tcp_nodelay: true
diff --git a/modules/common/cassandra-installer/src/test/resources/rhq48/storage/conf/log4j-server.properties b/modules/common/cassandra-installer/src/test/resources/rhq48/storage/conf/log4j-server.properties
new file mode 100644
index 0000000..c2e6dab
--- /dev/null
+++ b/modules/common/cassandra-installer/src/test/resources/rhq48/storage/conf/log4j-server.properties
@@ -0,0 +1,45 @@
+# 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.
+
+# for production, you should probably set pattern to %c instead of %l.
+# (%l is slower.)
+
+# output messages into a rolling log file as well as stdout
+log4j.rootLogger=INFO,stdout,R
+
+# stdout
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%5p %d{HH:mm:ss,SSS} %m%n
+
+# rolling log file
+log4j.appender.R=org.apache.log4j.RollingFileAppender
+log4j.appender.R.maxFileSize=20MB
+log4j.appender.R.maxBackupIndex=50
+log4j.appender.R.layout=org.apache.log4j.PatternLayout
+log4j.appender.R.layout.ConversionPattern=%5p [%t] %d{ISO8601} %F (line %L) %m%n
+# Edit the next line to point to your logs directory
+log4j.appender.R.File=target/rhq48/rhq-storage/logs/rhq-storage.log
+log4j.appender.R.Threshold=INFO
+
+# Application logging options
+#log4j.logger.org.apache.cassandra=DEBUG
+#log4j.logger.org.apache.cassandra.db=DEBUG
+#log4j.logger.org.apache.cassandra.service.StorageProxy=DEBUG
+
+# Adding this to avoid thrift logging disconnect errors.
+log4j.logger.org.apache.thrift.server.TNonblockingServer=ERROR
+
10 years, 10 months
[rhq] Branch 'mtho11/consolidated-metrics' - modules/enterprise
by mike thompson
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/MetricGraphData.java | 2 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MetricsTableView.java | 9 +++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
New commits:
commit 1f2c7d34cf5a29faf13044df5a09c7b50c0d4f4b
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Fri Jul 19 12:02:59 2013 -0700
Decrease sensitivity of when to show average line on graphs. Average line not showing up in many cases now.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/MetricGraphData.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/MetricGraphData.java
index dc054fc..5ae392f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/MetricGraphData.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/MetricGraphData.java
@@ -389,8 +389,8 @@ public class MetricGraphData implements JsonMetricProducer {
* @see StackedBarMetricGraphImpl
*/
public boolean showBarAvgTrendLine() {
+ int numberOfAggBars = 0;
for (MeasurementDataNumericHighLowComposite measurement : metricData) {
- int numberOfAggBars = 0;
boolean noValuesInCurrentBarUndefined = (!Double.isNaN(measurement.getValue()) && !Double.isNaN(measurement.getHighValue()) && !Double.isNaN(measurement.getLowValue()));
boolean foundAggregateBar = (measurement.getValue() != measurement.getHighValue() || measurement.getHighValue() != measurement.getLowValue());
// if there exists a even one aggregate bar then I can short circuit this and exit
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MetricsTableView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MetricsTableView.java
index 77aeda6..d6bcbaa 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MetricsTableView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MetricsTableView.java
@@ -44,6 +44,8 @@ import com.smartgwt.client.widgets.grid.events.RecordCollapseEvent;
import com.smartgwt.client.widgets.grid.events.RecordCollapseHandler;
import com.smartgwt.client.widgets.grid.events.RecordExpandEvent;
import com.smartgwt.client.widgets.grid.events.RecordExpandHandler;
+import com.smartgwt.client.widgets.grid.events.SortChangedHandler;
+import com.smartgwt.client.widgets.grid.events.SortEvent;
import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.measurement.MeasurementData;
@@ -282,6 +284,13 @@ public class MetricsTableView extends Table<MetricsViewDataSource> implements Re
redrawGraphs();
}
});
+ addSortChangedHandler(new SortChangedHandler() {
+ @Override
+ public void onSortChanged(SortEvent sortEvent) {
+ Log.debug("SortChangeHandler");
+ redrawGraphs();
+ }
+ });
}
@Override
10 years, 10 months
[rhq] modules/common
by John Sanda
modules/common/cassandra-ccm/cassandra-ccm-core/pom.xml | 1
modules/common/cassandra-ccm/cassandra-ccm-core/src/main/bundle/cassandra/bin/cassandra | 3
modules/common/cassandra-ccm/cassandra-ccm-core/src/main/bundle/cassandra/conf/rhq.cassandra-env.sh | 247 ----------
modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java | 77 ++-
modules/common/cassandra-installer/src/test/java/org/rhq/storage/installer/StorageInstallerTest.java | 93 +++
5 files changed, 163 insertions(+), 258 deletions(-)
New commits:
commit 656cc6066250f46ff51e16230c0f7c8263f55435
Author: John Sanda <jsanda(a)redhat.com>
Date: Fri Jul 19 13:43:46 2013 -0400
[BZ 983226] fixing upgrade regression introduced by use of cassandra-jvm.properties
This commit removes cassandra-env.sh from our Cassandra distro since we are no
longer using that script. The storage installer upgrade has been cleaned up
some so that it will get the jmx port from cassandra-env.sh for 4.8 installs
and then update cassandra-jvm.properties.
diff --git a/modules/common/cassandra-ccm/cassandra-ccm-core/pom.xml b/modules/common/cassandra-ccm/cassandra-ccm-core/pom.xml
index 42f6c8b..2bde394 100644
--- a/modules/common/cassandra-ccm/cassandra-ccm-core/pom.xml
+++ b/modules/common/cassandra-ccm/cassandra-ccm-core/pom.xml
@@ -171,6 +171,7 @@
<move file="${project.build.outputDirectory}/cassandra/bin/cassandra" todir="${cassandra.dir}/bin"/>
<delete dir="${project.build.outputDirectory}/cassandra"/>
<delete dir="${cassandra.dir}/javadoc"/>
+ <delete file="${cassandra.dir}/conf/cassandra-env.sh"/>
<zip basedir="${cassandra.dir}" destfile="${cassandra.distro.zip}"/>
<delete dir="${cassandra.dir}"/>
diff --git a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/bundle/cassandra/bin/cassandra b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/bundle/cassandra/bin/cassandra
index 742d9c0..ddbc099 100755
--- a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/bundle/cassandra/bin/cassandra
+++ b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/bundle/cassandra/bin/cassandra
@@ -106,8 +106,7 @@ if [ -z "$CASSANDRA_CONF" -o -z "$CLASSPATH" ]; then
exit 1
fi
-if [ -f "$CASSANDRA_CONF/cassandra-env.sh" ]; then
- #. "$CASSANDRA_CONF/cassandra-env.sh"
+if [ -f "$CASSANDRA_CONF/cassandra-jvm.properties" ]; then
. "$CASSANDRA_CONF/cassandra-jvm.properties"
fi
diff --git a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/bundle/cassandra/conf/rhq.cassandra-env.sh b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/bundle/cassandra/conf/rhq.cassandra-env.sh
deleted file mode 100644
index 99b3128..0000000
--- a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/bundle/cassandra/conf/rhq.cassandra-env.sh
+++ /dev/null
@@ -1,247 +0,0 @@
-# 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.
-
-calculate_heap_sizes()
-{
- case "`uname`" in
- Linux)
- system_memory_in_mb=`free -m | awk '/Mem:/ {print $2}'`
- system_cpu_cores=`egrep -c 'processor([[:space:]]+):.*' /proc/cpuinfo`
- ;;
- FreeBSD)
- system_memory_in_bytes=`sysctl hw.physmem | awk '{print $2}'`
- system_memory_in_mb=`expr $system_memory_in_bytes / 1024 / 1024`
- system_cpu_cores=`sysctl hw.ncpu | awk '{print $2}'`
- ;;
- SunOS)
- system_memory_in_mb=`prtconf | awk '/Memory size:/ {print $3}'`
- system_cpu_cores=`psrinfo | wc -l`
- ;;
- Darwin)
- system_memory_in_bytes=`sysctl hw.memsize | awk '{print $2}'`
- system_memory_in_mb=`expr $system_memory_in_bytes / 1024 / 1024`
- system_cpu_cores=`sysctl hw.ncpu | awk '{print $2}'`
- ;;
- *)
- # assume reasonable defaults for e.g. a modern desktop or
- # cheap server
- system_memory_in_mb="2048"
- system_cpu_cores="2"
- ;;
- esac
-
- # some systems like the raspberry pi don't report cores, use at least 1
- if [ "$system_cpu_cores" -lt "1" ]
- then
- system_cpu_cores="1"
- fi
-
- # set max heap size based on the following
- # max(min(1/2 ram, 1024MB), min(1/4 ram, 8GB))
- # calculate 1/2 ram and cap to 1024MB
- # calculate 1/4 ram and cap to 8192MB
- # pick the max
- half_system_memory_in_mb=`expr $system_memory_in_mb / 2`
- quarter_system_memory_in_mb=`expr $half_system_memory_in_mb / 2`
- if [ "$half_system_memory_in_mb" -gt "1024" ]
- then
- half_system_memory_in_mb="1024"
- fi
- if [ "$quarter_system_memory_in_mb" -gt "8192" ]
- then
- quarter_system_memory_in_mb="8192"
- fi
- if [ "$half_system_memory_in_mb" -gt "$quarter_system_memory_in_mb" ]
- then
- max_heap_size_in_mb="$half_system_memory_in_mb"
- else
- max_heap_size_in_mb="$quarter_system_memory_in_mb"
- fi
- MAX_HEAP_SIZE="\${max_heap_size_in_mb}M"
-
- # Young gen: min(max_sensible_per_modern_cpu_core * num_cores, 1/4 * heap size)
- max_sensible_yg_per_core_in_mb="100"
- max_sensible_yg_in_mb=`expr $max_sensible_yg_per_core_in_mb "*" $system_cpu_cores`
-
- desired_yg_in_mb=`expr $max_heap_size_in_mb / 4`
-
- if [ "$desired_yg_in_mb" -gt "$max_sensible_yg_in_mb" ]
- then
- HEAP_NEWSIZE="\${max_sensible_yg_in_mb}M"
- else
- HEAP_NEWSIZE="\${desired_yg_in_mb}M"
- fi
-}
-
-# Determine the sort of JVM we'll be running on.
-
-java_ver_output=`"\${JAVA:-java}" -version 2>&1`
-
-jvmver=`echo "$java_ver_output" | awk -F'"' 'NR==1 {print $2}'`
-JVM_VERSION=\${jvmver%_*}
-JVM_PATCH_VERSION=\${jvmver#*_}
-
-jvm=`echo "$java_ver_output" | awk 'NR==2 {print $1}'`
-case "$jvm" in
- OpenJDK)
- JVM_VENDOR=OpenJDK
- # this will be "64-Bit" or "32-Bit"
- JVM_ARCH=`echo "$java_ver_output" | awk 'NR==3 {print $2}'`
- ;;
- "Java(TM)")
- JVM_VENDOR=Oracle
- # this will be "64-Bit" or "32-Bit"
- JVM_ARCH=`echo "$java_ver_output" | awk 'NR==3 {print $3}'`
- ;;
- *)
- # Help fill in other JVM values
- JVM_VENDOR=other
- JVM_ARCH=unknown
- ;;
-esac
-
-
-# Override these to set the amount of memory to allocate to the JVM at
-# start-up. For production use you may wish to adjust this for your
-# environment. MAX_HEAP_SIZE is the total amount of memory dedicated
-# to the Java heap; HEAP_NEWSIZE refers to the size of the young
-# generation. Both MAX_HEAP_SIZE and HEAP_NEWSIZE should be either set
-# or not (if you set one, set the other).
-#
-# The main trade-off for the young generation is that the larger it
-# is, the longer GC pause times will be. The shorter it is, the more
-# expensive GC will be (usually).
-#
-# The example HEAP_NEWSIZE assumes a modern 8-core+ machine for decent pause
-# times. If in doubt, and if you do not particularly want to tweak, go with
-# 100 MB per physical CPU core.
-
-#MAX_HEAP_SIZE="4G"
-#HEAP_NEWSIZE="800M"
-
-if [ "x$MAX_HEAP_SIZE" = "x" ] && [ "x$HEAP_NEWSIZE" = "x" ]; then
- calculate_heap_sizes
-else
- if [ "x$MAX_HEAP_SIZE" = "x" ] || [ "x$HEAP_NEWSIZE" = "x" ]; then
- echo "please set or unset MAX_HEAP_SIZE and HEAP_NEWSIZE in pairs (see cassandra-env.sh)"
- exit 1
- fi
-fi
-
-# Specifies the default port over which Cassandra will be available for
-# JMX connections.
-JMX_PORT="${rhq.cassandra.jmx.port}"
-
-
-# Here we create the arguments that will get passed to the jvm when
-# starting cassandra.
-
-# enable assertions. disabling this in production will give a modest
-# performance benefit (around 5%).
-JVM_OPTS="$JVM_OPTS -ea"
-
-# add the jamm javaagent
-if [ "$JVM_VENDOR" != "OpenJDK" -o "$JVM_VERSION" \\> "1.6.0" ] \\
- || [ "$JVM_VERSION" = "1.6.0" -a "$JVM_PATCH_VERSION" -ge 23 ]
-then
- JVM_OPTS="$JVM_OPTS -javaagent:$CASSANDRA_HOME/lib/jamm-0.2.5.jar"
-fi
-
-# enable thread priorities, primarily so we can give periodic tasks
-# a lower priority to avoid interfering with client workload
-JVM_OPTS="$JVM_OPTS -XX:+UseThreadPriorities"
-# allows lowering thread priority without being root. see
-# http://tech.stolsvik.com/2010/01/linux-java-thread-priorities-workaround....
-JVM_OPTS="$JVM_OPTS -XX:ThreadPriorityPolicy=42"
-
-# min and max heap sizes should be set to the same value to avoid
-# stop-the-world GC pauses during resize, and so that we can lock the
-# heap in memory on startup to prevent any of it from being swapped
-# out.
-JVM_OPTS="$JVM_OPTS -Xms${rhq.cassandra.max.heap.size}"
-JVM_OPTS="$JVM_OPTS -Xmx${rhq.cassandra.max.heap.size}"
-JVM_OPTS="$JVM_OPTS -Xmn${rhq.cassandra.heap.new.size}"
-JVM_OPTS="$JVM_OPTS -XX:+HeapDumpOnOutOfMemoryError"
-
-# set jvm HeapDumpPath with CASSANDRA_HEAPDUMP_DIR
-if [ "x$CASSANDRA_HEAPDUMP_DIR" != "x" ]; then
- JVM_OPTS="$JVM_OPTS -XX:HeapDumpPath=$CASSANDRA_HEAPDUMP_DIR/cassandra-`date +%s`-pid$$.hprof"
-fi
-
-
-startswith() { [ "\${1#$2}" != "$1" ]; }
-
-if [ "`uname`" = "Linux" ] ; then
- # reduce the per-thread stack size to minimize the impact of Thrift
- # thread-per-client. (Best practice is for client connections to
- # be pooled anyway.) Only do so on Linux where it is known to be
- # supported.
- # u34 and greater need 180k
- JVM_OPTS="$JVM_OPTS -Xss${rhq.cassandra.stack.size}"
-fi
-echo "xss = $JVM_OPTS"
-
-# GC tuning options
-JVM_OPTS="$JVM_OPTS -XX:+UseParNewGC"
-JVM_OPTS="$JVM_OPTS -XX:+UseConcMarkSweepGC"
-JVM_OPTS="$JVM_OPTS -XX:+CMSParallelRemarkEnabled"
-JVM_OPTS="$JVM_OPTS -XX:SurvivorRatio=8"
-JVM_OPTS="$JVM_OPTS -XX:MaxTenuringThreshold=1"
-JVM_OPTS="$JVM_OPTS -XX:CMSInitiatingOccupancyFraction=75"
-JVM_OPTS="$JVM_OPTS -XX:+UseCMSInitiatingOccupancyOnly"
-JVM_OPTS="$JVM_OPTS -XX:+UseTLAB"
-# note: bash evals '1.7.x' as > '1.7' so this is really a >= 1.7 jvm check
-if [ "$JVM_VERSION" \\> "1.7" ] ; then
- JVM_OPTS="$JVM_OPTS -XX:+UseCondCardMark"
-fi
-
-# GC logging options -- uncomment to enable
-# JVM_OPTS="$JVM_OPTS -XX:+PrintGCDetails"
-# JVM_OPTS="$JVM_OPTS -XX:+PrintGCDateStamps"
-# JVM_OPTS="$JVM_OPTS -XX:+PrintHeapAtGC"
-# JVM_OPTS="$JVM_OPTS -XX:+PrintTenuringDistribution"
-# JVM_OPTS="$JVM_OPTS -XX:+PrintGCApplicationStoppedTime"
-# JVM_OPTS="$JVM_OPTS -XX:+PrintPromotionFailure"
-# JVM_OPTS="$JVM_OPTS -XX:PrintFLSStatistics=1"
-# JVM_OPTS="$JVM_OPTS -Xloggc:/var/log/cassandra/gc-`date +%s`.log"
-# If you are using JDK 6u34 7u2 or later you can enable GC log rotation
-# don't stick the date in the log name if rotation is on.
-# JVM_OPTS="$JVM_OPTS -Xloggc:/var/log/cassandra/gc.log"
-# JVM_OPTS="$JVM_OPTS -XX:+UseGCLogFileRotation"
-# JVM_OPTS="$JVM_OPTS -XX:NumberOfGCLogFiles=10"
-# JVM_OPTS="$JVM_OPTS -XX:GCLogFileSize=10M"
-
-# uncomment to have Cassandra JVM listen for remote debuggers/profilers on port 1414
-# JVM_OPTS="$JVM_OPTS -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1414"
-
-# Prefer binding to IPv4 network intefaces (when net.ipv6.bindv6only=1). See
-# http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6342561 (short version:
-# comment out this entry to enable IPv6 support).
-JVM_OPTS="$JVM_OPTS -Djava.net.preferIPv4Stack=true"
-
-# jmx: metrics and administration interface
-#
-# add this if you're having trouble connecting:
-# JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=<public name>"
-#
-# see
-# https://blogs.oracle.com/jmxetc/entry/troubleshooting_connection_problems...
-# for more on configuring JMX through firewalls, etc. (Short version:
-# get it working with no firewall first.)
-JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.port=$JMX_PORT"
-JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.ssl=false"
-JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
-JVM_OPTS="$JVM_OPTS $JVM_EXTRA_OPTS"
diff --git a/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java b/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java
index 63282e4..5c5ac4e 100644
--- a/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java
+++ b/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java
@@ -25,8 +25,10 @@
package org.rhq.storage.installer;
+import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileReader;
import java.io.IOException;
import java.net.InetAddress;
import java.util.ArrayList;
@@ -250,15 +252,32 @@ public class StorageInstaller {
File oldConfDir = new File(existingStorageDir, "conf");
File newConfDir = new File(storageBasedir, "conf");
+ File cassandraEnvFile = new File(oldConfDir, "cassandra-env.sh");
+
String cassandraYaml = "cassandra.yaml";
String cassandraJvmProps = "cassandra-jvm.properties";
File cassandraJvmPropsFile = new File(newConfDir, cassandraJvmProps);
String log4j = "log4j-server.properties";
replaceFile(new File(oldConfDir, cassandraYaml), new File(newConfDir, cassandraYaml));
- replaceFile(new File(oldConfDir, cassandraJvmProps), cassandraJvmPropsFile);
replaceFile(new File(oldConfDir, log4j), new File(newConfDir, log4j));
+ if (cassandraEnvFile.exists()) {
+ // Then this is an RHQ 4.8 install
+ jmxPort = parseJmxPortFromCassandrEnv(cassandraEnvFile);
+ Properties jvmProps = new Properties();
+ jvmProps.load(new FileInputStream(cassandraJvmPropsFile));
+ PropertiesFileUpdate propertiesUpdater = new PropertiesFileUpdate(
+ cassandraJvmPropsFile.getAbsolutePath());
+ jvmProps.setProperty("jmx_port", Integer.toString(jmxPort));
+
+ propertiesUpdater.update(jvmProps);
+
+ } else {
+ jmxPort = parseJmxPort(cassandraJvmPropsFile);
+ replaceFile(new File(oldConfDir, cassandraJvmProps), cassandraJvmPropsFile);
+ }
+
log.info("Finished installing RHQ Storage Node.");
log.info("Updating rhq-server.properties...");
@@ -268,8 +287,6 @@ public class StorageInstaller {
Map<String, Object> config = (Map<String, Object>) yaml.load(new FileInputStream(yamlFile));
hostname = (String) config.get("listen_address");
-
- jmxPort = parseJmxPort(cassandraJvmPropsFile);
} else {
if (cmdLine.hasOption("dir")) {
File basedir = new File(cmdLine.getOptionValue("dir"));
@@ -661,6 +678,60 @@ public class StorageInstaller {
}
}
+ private int parseJmxPortFromCassandrEnv(File cassandraEnvFile) {
+ Integer port = null;
+ if (isWindows()) {
+ // TODO
+ return defaultJmxPort;
+ } else {
+ BufferedReader reader = null;
+ try {
+ reader = new BufferedReader(new FileReader(cassandraEnvFile));
+ String line = reader.readLine();
+
+ while (line != null) {
+ if (line.startsWith("JMX_PORT")) {
+ int startIndex = "JMX_PORT=\"".length();
+ int endIndex = line.lastIndexOf("\"");
+
+ if (startIndex == -1 || endIndex == -1) {
+ log.error("Failed to parse the JMX port. Make sure that you have the JMX port defined on its "
+ + "own line as follows, JMX_PORT=\"<jmx-port>\"");
+ throw new RuntimeException("Cannot determine JMX port");
+ }
+ try {
+ port = Integer.parseInt(line.substring(startIndex, endIndex));
+ } catch (NumberFormatException e) {
+ log.error("The JMX port must be an integer. [" + port + "] is an invalid value");
+ throw new RuntimeException("The JMX port has an invalid value");
+ }
+ return port;
+ }
+ line = reader.readLine();
+ }
+ log.error("Failed to parse the JMX port. Make sure that you have the JMX port defined on its "
+ + "own line as follows, JMX_PORT=\"<jmx-port>\"");
+ throw new RuntimeException("Cannot determine JMX port");
+ } catch (IOException e) {
+ log.error("Failed to parse JMX port. There was an unexpected IO error", e);
+ throw new RuntimeException("Failed to parse JMX port due to IO error: " + e.getMessage());
+ } finally {
+ try {
+ if (reader != null) {
+ reader.close();
+ }
+ } catch (IOException e) {
+ if (log.isDebugEnabled()) {
+ log.debug("An error occurred closing the " + BufferedReader.class.getName() + " used to "
+ + "parse the JMX port", e);
+ } else {
+ log.warn("There was error closing the reader used to parse the JMX port: " + e.getMessage());
+ }
+ }
+ }
+ }
+ }
+
private int parseJmxPort(File cassandraJvmOptsFile) {
Integer port = null;
if (isWindows()) {
diff --git a/modules/common/cassandra-installer/src/test/java/org/rhq/storage/installer/StorageInstallerTest.java b/modules/common/cassandra-installer/src/test/java/org/rhq/storage/installer/StorageInstallerTest.java
index 3fd13c7..a7921c0 100644
--- a/modules/common/cassandra-installer/src/test/java/org/rhq/storage/installer/StorageInstallerTest.java
+++ b/modules/common/cassandra-installer/src/test/java/org/rhq/storage/installer/StorageInstallerTest.java
@@ -2,11 +2,13 @@ package org.rhq.storage.installer;
import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.Properties;
@@ -20,41 +22,53 @@ import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.rhq.cassandra.CassandraClusterManager;
+import org.rhq.core.util.MessageDigestGenerator;
import org.rhq.core.util.file.FileUtil;
+import org.rhq.core.util.stream.StreamUtil;
/**
* @author John Sanda
*/
public class StorageInstallerTest {
+ private MessageDigestGenerator digestGenerator;
+
private File basedir;
+ private File serverDir;
+
private File storageDir;
private StorageInstaller installer;
@BeforeMethod
public void initDirs(Method test) throws Exception {
+ digestGenerator = new MessageDigestGenerator(MessageDigestGenerator.SHA_256);
+
File dir = new File(getClass().getResource(".").toURI());
basedir = new File(dir, getClass().getSimpleName() + "/" + test.getName());
FileUtil.purge(basedir, true);
basedir.mkdirs();
- System.setProperty("rhq.server.basedir", basedir.getAbsolutePath());
+ serverDir = new File(basedir, "rhq-server");
- File serverPropsFile = new File(basedir, "rhq-server.properties");
+ System.setProperty("rhq.server.basedir", serverDir.getAbsolutePath());
+
+ File serverPropsFile = new File(serverDir, "rhq-server.properties");
FileUtils.touch(serverPropsFile);
System.setProperty("rhq.server.properties-file", serverPropsFile.getAbsolutePath());
- storageDir = new File(basedir, "rhq-storage");
+ storageDir = new File(serverDir, "rhq-storage");
installer = new StorageInstaller();
}
@AfterMethod
public void shutdownStorageNode() throws Exception {
- CassandraClusterManager ccm = new CassandraClusterManager();
- ccm.killNode(storageDir);
+ if (FileUtils.getFile(storageDir, "bin", "cassandra.pid").exists()) {
+ CassandraClusterManager ccm = new CassandraClusterManager();
+ ccm.killNode(storageDir);
+ }
}
@Test
@@ -97,6 +111,65 @@ public class StorageInstallerTest {
assertTrue(savedCachesDir.exists(), "Expected to find saved_caches directory at " + savedCachesDir);
}
+ @Test
+ public void upgradeFromRHQ48Install() throws Exception {
+ File rhq48ServerDir = new File(basedir, "rhq48-server");
+ File rhq48StorageDir = new File(rhq48ServerDir, "rhq-storage");
+ File rhq48StorageConfDir = new File(rhq48StorageDir, "conf");
+
+ File oldCassandraYamlFile = new File(rhq48StorageConfDir, "cassandra.yaml");
+ File oldCassandraEnvFile = new File(rhq48StorageConfDir, "cassandra-env.sh");
+ File oldLog4JFile = new File(rhq48StorageConfDir, "log4j-server.properties");
+
+ rhq48StorageConfDir.mkdirs();
+ StreamUtil.copy(getClass().getResourceAsStream("/rhq48/storage/conf/cassandra.yaml"),
+ new FileOutputStream(oldCassandraYamlFile), true);
+ StreamUtil.copy(getClass().getResourceAsStream("/rhq48/storage/conf/cassandra-env.sh"),
+ new FileOutputStream(oldCassandraEnvFile));
+ StreamUtil.copy(getClass().getResourceAsStream("/rhq48/storage/conf/log4j-server.properties"),
+ new FileOutputStream(oldLog4JFile));
+
+ CommandLineParser parser = new PosixParser();
+
+ String[] args = {
+ "--upgrade", rhq48ServerDir.getAbsolutePath(),
+ "--dir", storageDir.getAbsolutePath()
+ };
+
+ CommandLine cmdLine = parser.parse(installer.getOptions(), args);
+ int status = installer.run(cmdLine);
+
+ assertEquals(status, 0, "Expected to get back a status code of 0 for a successful upgrade");
+ assertNodeIsRunning();
+
+ File binDir = new File(storageDir, "bin");
+ assertTrue(binDir.exists(), "Expected to find bin directory at " + binDir);
+
+ File libDir = new File(storageDir, "lib");
+ assertTrue(libDir.exists(), "Expected to find lib directory at " + libDir);
+
+ File confDir = new File(storageDir, "conf");
+ assertTrue(confDir.exists(), "Expected to find conf directory at " + confDir);
+
+ File newCassandraYamlFile = new File(confDir, "cassandra.yaml");
+ assertEquals(sha256(oldCassandraYamlFile), sha256(newCassandraYamlFile), newCassandraYamlFile +
+ " does not match the original version");
+
+ File newLog4JFile = new File(confDir, "log4j-server.properties");
+ assertEquals(sha256(oldLog4JFile), sha256(newLog4JFile), newLog4JFile + " does not match the original version");
+
+ assertFalse(new File(confDir, "cassandra-env.sh").exists(), "cassandra-env.sh should not be used after RHQ 4.8.0");
+
+ File cassandraJvmPropsFile = new File(confDir, "cassandra-jvm.properties");
+ Properties properties = new Properties();
+ properties.load(new FileInputStream(cassandraJvmPropsFile));
+
+ // If this check fails, make sure that the expected value matches the value in
+ // src/test/resources/rhq48/storage/conf/cassandra-env.sh
+ assertEquals(properties.getProperty("jmx_port"), "7399", "Failed to update the JMX port in " +
+ cassandraJvmPropsFile);
+ }
+
private void assertNodeIsRunning() {
try {
installer.verifyNodeIsUp("127.0.0.1", 7299, 3, 1000);
@@ -106,7 +179,7 @@ public class StorageInstallerTest {
}
private void assertRhqServerPropsUpdated() {
- File serverPropsFile = new File(basedir, "rhq-server.properties");
+ File serverPropsFile = new File(serverDir, "rhq-server.properties");
Properties properties = new Properties();
try {
@@ -120,4 +193,12 @@ public class StorageInstallerTest {
assertEquals(seeds, "127.0.0.1|7299|9142");
}
+ private String sha256(File file) {
+ try {
+ return digestGenerator.calcDigestString(file);
+ } catch (IOException e) {
+ throw new RuntimeException("Failed to calculate SHA-256 hash for " + file.getPath(), e);
+ }
+ }
+
}
10 years, 10 months
[rhq] modules/helpers
by Heiko W. Rupp
modules/helpers/pluginAnnotations/src/main/java/org/rhq/helpers/pluginAnnotations/agent/ConfigProperty.java | 49 +++
modules/helpers/pluginGen/src/main/java/org/rhq/helpers/pluginGen/AnnotationProcessor.java | 126 +++++++++-
modules/helpers/pluginGen/src/main/java/org/rhq/helpers/pluginGen/Props.java | 104 +-------
modules/helpers/pluginGen/src/main/resources/descriptorMain.ftl | 14 -
modules/helpers/pluginGen/src/test/java/org/rhq/helpers/pluginGen/test/FooBean.java | 11
5 files changed, 208 insertions(+), 96 deletions(-)
New commits:
commit 8ad6e86b9ba704eb468646fd7fffcf5dd082e2c4
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri Jul 19 18:13:31 2013 +0200
Add annotation and processing for configuration properties. Also shuffle some classes around.
diff --git a/modules/helpers/pluginAnnotations/src/main/java/org/rhq/helpers/pluginAnnotations/agent/ConfigProperty.java b/modules/helpers/pluginAnnotations/src/main/java/org/rhq/helpers/pluginAnnotations/agent/ConfigProperty.java
new file mode 100644
index 0000000..4b5a3ab
--- /dev/null
+++ b/modules/helpers/pluginAnnotations/src/main/java/org/rhq/helpers/pluginAnnotations/agent/ConfigProperty.java
@@ -0,0 +1,49 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2013 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+package org.rhq.helpers.pluginAnnotations.agent;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * A configuration property for resource or plugin config.
+ * Currently only property simple are supported.
+ * @author Heiko W. Rupp
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD})
+public @interface ConfigProperty {
+
+ public Scope scope() default Scope.PLUGIN;
+ String property() default "";
+ String displayName() default "";
+ String description() default "";
+ boolean readOnly() default false;
+ String defaultValue() default "";
+ RhqType rhqType() default RhqType.VOID;
+
+
+ public enum Scope {
+ PLUGIN,
+ RESOURCE;
+ }
+}
diff --git a/modules/helpers/pluginGen/src/main/java/org/rhq/helpers/pluginGen/AnnotationProcessor.java b/modules/helpers/pluginGen/src/main/java/org/rhq/helpers/pluginGen/AnnotationProcessor.java
index 3c90b7b..16ec437 100644
--- a/modules/helpers/pluginGen/src/main/java/org/rhq/helpers/pluginGen/AnnotationProcessor.java
+++ b/modules/helpers/pluginGen/src/main/java/org/rhq/helpers/pluginGen/AnnotationProcessor.java
@@ -19,15 +19,23 @@
package org.rhq.helpers.pluginGen;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
import java.util.List;
+import org.rhq.helpers.pluginAnnotations.agent.ConfigProperty;
+import org.rhq.helpers.pluginAnnotations.agent.Metric;
+import org.rhq.helpers.pluginAnnotations.agent.Operation;
+import org.rhq.helpers.pluginAnnotations.agent.Parameter;
+import org.rhq.helpers.pluginAnnotations.agent.RhqType;
+
/**
* Processor that scans a directory for annotated classes and generates metrics etc. from them.
* @author Heiko W. Rupp
*/
public class AnnotationProcessor {
- private List<Class> classList;
private final DirectoryClassLoader classLoader;
public AnnotationProcessor(String baseDirectory) {
@@ -36,9 +44,119 @@ public class AnnotationProcessor {
}
public void populate(Props props) {
- classList = classLoader.findClasses();
+ List<Class> classList = classLoader.findClasses();
+
+ populateMetrics(props, classList);
+ populateOperations(props, classList);
+ populateConfigurations(props, classList);
+ }
+
+ public void populateMetrics(Props props, List<Class> classes) {
+ for (Class<?> clazz : classes) {
+ for (Field field : clazz.getDeclaredFields()) {
+ Metric metricAnnot = field.getAnnotation(Metric.class);
+ addMetric(props, metricAnnot, field.getName());
+ }
+
+ for (Method method : clazz.getDeclaredMethods()) {
+ Metric metricAnnot = method.getAnnotation(Metric.class);
+ addMetric(props, metricAnnot, method.getName());
+ }
+ }
+ }
+
+ public void populateOperations(Props props, List<Class> classes) {
+ for (Class<?> clazz : classes) {
+ for (Method method : clazz.getDeclaredMethods()) {
+ Operation operationAnnot = method.getAnnotation(Operation.class);
+ if (operationAnnot != null) {
+ String property = operationAnnot.name();
+ if (property.isEmpty()) {
+ property = method.getName();
+ }
+ Props.OperationProps op = new Props.OperationProps(property);
+ op.setDisplayName(operationAnnot.displayName());
+ op.setDescription(operationAnnot.description());
+ RhqType type = RhqType.findType(method.getReturnType());
+ if (type != RhqType.VOID) {
+ Props.SimpleProperty simpleProperty = new Props.SimpleProperty(type.getRhqName());
+ op.setResult(simpleProperty);
+ }
- props.populateMetrics(classList);
- props.populateOperations(classList);
+ Class[] types = method.getParameterTypes();
+ int i=0;
+ for (Annotation[] annotations : method.getParameterAnnotations() ) {
+ for (Annotation annotation : annotations) {
+ if (annotation instanceof Parameter) {
+ Parameter parameter = (Parameter) annotation;
+ Props.SimpleProperty simpleProperty = new Props.SimpleProperty(parameter.name());
+ simpleProperty.setDescription(parameter.description());
+ Class typeClass = types[i];
+ RhqType rhqType = RhqType.findType(typeClass);
+ if (parameter.type()!=RhqType.VOID){
+ rhqType = parameter.type();
+ }
+ simpleProperty.setType(rhqType.getRhqName());
+ op.getParams().add(simpleProperty);
+ }
+ }
+ i++;
+ }
+ props.getOperations().add(op);
+ }
+
+ }
+ }
+ }
+
+ public void populateConfigurations(Props props, List<Class> classes) {
+ for (Class<?> clazz : classes) {
+ for (Field field : clazz.getDeclaredFields()) {
+ ConfigProperty configProperty = field.getAnnotation(ConfigProperty.class);
+ if (configProperty!=null) {
+ String name = configProperty.property();
+ if(name.isEmpty()) {
+ name = field.getName();
+ }
+ Props.SimpleProperty property = new Props.SimpleProperty(name);
+ property.setDescription(configProperty.description());
+ property.setDisplayName(configProperty.displayName());
+ Class type = field.getType();
+ RhqType rhqType = RhqType.findType(type);
+ if (configProperty.rhqType()!=RhqType.VOID) {
+ rhqType = configProperty.rhqType();
+ }
+ property.setType(rhqType.getRhqName());
+
+ switch (configProperty.scope()){
+ case PLUGIN:
+ props.getPluginConfig().add(property);
+ break;
+ case RESOURCE:
+ props.getResourceConfig().add(property);
+ break;
+ default:
+ throw new IllegalStateException("Unknown scope: " +configProperty.scope().name());
+ }
+ }
+ }
+ }
}
+
+ private void addMetric(Props props, Metric metricAnnot, String name) {
+ if (metricAnnot != null) {
+ String property = metricAnnot.property();
+ if (property.isEmpty()) {
+ property = name;
+ }
+ Props.MetricProps metric = new Props.MetricProps(property);
+ metric.setDisplayName(metricAnnot.displayName());
+ metric.setDisplayType(metricAnnot.displayType());
+ metric.setDataType(metricAnnot.dataType());
+ metric.setDescription(metricAnnot.description());
+ metric.setUnits(metricAnnot.units());
+ props.getMetrics().add(metric);
+ }
+ }
+
}
diff --git a/modules/helpers/pluginGen/src/main/java/org/rhq/helpers/pluginGen/Props.java b/modules/helpers/pluginGen/src/main/java/org/rhq/helpers/pluginGen/Props.java
index 95be574..c88fbc0 100644
--- a/modules/helpers/pluginGen/src/main/java/org/rhq/helpers/pluginGen/Props.java
+++ b/modules/helpers/pluginGen/src/main/java/org/rhq/helpers/pluginGen/Props.java
@@ -18,20 +18,12 @@
*/
package org.rhq.helpers.pluginGen;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
import java.util.HashSet;
import java.util.LinkedHashSet;
-import java.util.List;
import java.util.Set;
import org.rhq.helpers.pluginAnnotations.agent.DataType;
import org.rhq.helpers.pluginAnnotations.agent.DisplayType;
-import org.rhq.helpers.pluginAnnotations.agent.Metric;
-import org.rhq.helpers.pluginAnnotations.agent.Operation;
-import org.rhq.helpers.pluginAnnotations.agent.Parameter;
-import org.rhq.helpers.pluginAnnotations.agent.RhqType;
import org.rhq.helpers.pluginAnnotations.agent.Units;
/**
@@ -94,7 +86,8 @@ public class Props {
/** Embedded children */
private Set<Props> children = new HashSet<Props>();
- private Set<SimpleProperty> simpleProps = new LinkedHashSet<SimpleProperty>();
+ private Set<SimpleProperty> pluginConfig = new LinkedHashSet<SimpleProperty>();
+ private Set<SimpleProperty> resourceConfig = new LinkedHashSet<SimpleProperty>();
private Set<Template> templates = new HashSet<Template>();
@@ -291,12 +284,12 @@ public class Props {
this.rhqVersion = rhqVersion;
}
- public Set<SimpleProperty> getSimpleProps() {
- return simpleProps;
+ public Set<SimpleProperty> getPluginConfig() {
+ return pluginConfig;
}
- public void setSimpleProps(Set<SimpleProperty> simpleProps) {
- this.simpleProps = simpleProps;
+ public void setPluginConfig(Set<SimpleProperty> pluginConfig) {
+ this.pluginConfig = pluginConfig;
}
public Set<Template> getTemplates() {
@@ -307,7 +300,15 @@ public class Props {
this.templates = templates;
}
- public Set<MetricProps> getMetrics() {
+ public Set<SimpleProperty> getResourceConfig() {
+ return resourceConfig;
+ }
+
+ public void setResourceConfig(Set<SimpleProperty> resourceConfig) {
+ this.resourceConfig = resourceConfig;
+ }
+
+ public Set<MetricProps> getMetrics() {
return metrics;
}
@@ -363,79 +364,6 @@ public class Props {
this.scanForAnnotations = scanForAnnotations;
}
- public void populateMetrics(List<Class> classes) {
- for (Class<?> clazz : classes) {
- for (Field field : clazz.getDeclaredFields()) {
- Metric metricAnnot = field.getAnnotation(Metric.class);
- addMetric(metricAnnot, field.getName());
- }
-
- for (Method method : clazz.getDeclaredMethods()) {
- Metric metricAnnot = method.getAnnotation(Metric.class);
- addMetric(metricAnnot, method.getName());
- }
- }
- }
-
- public void populateOperations(List<Class> classes) {
- for (Class<?> clazz : classes) {
- for (Method method : clazz.getDeclaredMethods()) {
- Operation operationAnnot = method.getAnnotation(Operation.class);
- if (operationAnnot != null) {
- String property = operationAnnot.name();
- if (property.isEmpty()) {
- property = method.getName();
- }
- OperationProps op = new OperationProps(property);
- op.setDisplayName(operationAnnot.displayName());
- op.setDescription(operationAnnot.description());
- RhqType type = RhqType.findType(method.getReturnType());
- if (type != RhqType.VOID) {
- SimpleProperty simpleProperty = new SimpleProperty(type.getRhqName());
- op.setResult(simpleProperty);
- }
-
- Class[] types = method.getParameterTypes();
- int i=0;
- for (Annotation[] annotations : method.getParameterAnnotations() ) {
- for (Annotation annotation : annotations) {
- if (annotation instanceof Parameter) {
- Parameter parameter = (Parameter) annotation;
- SimpleProperty simpleProperty = new SimpleProperty(parameter.name());
- simpleProperty.setDescription(parameter.description());
- Class typeClass = types[i];
- RhqType rhqType = RhqType.findType(typeClass);
- if (parameter.type()!=RhqType.VOID){
- rhqType = parameter.type();
- }
- simpleProperty.setType(rhqType.getRhqName());
- op.getParams().add(simpleProperty);
- }
- }
- i++;
- }
- operations.add(op);
- }
-
- }
- }
- }
-
- private void addMetric(Metric metricAnnot, String name) {
- if (metricAnnot != null) {
- String property = metricAnnot.property();
- if (property.isEmpty()) {
- property = name;
- }
- MetricProps metric = new MetricProps(property);
- metric.setDisplayName(metricAnnot.displayName());
- metric.setDisplayType(metricAnnot.displayType());
- metric.setDataType(metricAnnot.dataType());
- metric.setDescription(metricAnnot.description());
- metric.setUnits(metricAnnot.units());
- metrics.add(metric);
- }
- }
@Override
public String toString() {
@@ -466,7 +394,7 @@ public class Props {
sb.append(", dependsOnJmxPlugin=").append(dependsOnJmxPlugin);
sb.append(", rhqVersion='").append(rhqVersion).append('\'');
sb.append(", children=").append(children);
- sb.append(", simpleProps=").append(simpleProps);
+ sb.append(", simpleProps=").append(pluginConfig);
sb.append(", templates=").append(templates);
sb.append(", runsInsides=").append(runsInsides);
sb.append('}');
diff --git a/modules/helpers/pluginGen/src/main/resources/descriptorMain.ftl b/modules/helpers/pluginGen/src/main/resources/descriptorMain.ftl
index 5579806..ce35ebe 100644
--- a/modules/helpers/pluginGen/src/main/resources/descriptorMain.ftl
+++ b/modules/helpers/pluginGen/src/main/resources/descriptorMain.ftl
@@ -45,9 +45,9 @@ name="${props.name}"
</runs-inside>
</#if>
- <#if props.simpleProps?has_content>
+ <#if props.pluginConfig?has_content>
<plugin-configuration>
- <#list props.simpleProps as simpleProps>
+ <#list props.pluginConfig as simpleProps>
<c:simple-property name="${simpleProps.name}" description="${simpleProps.description}" <#if simpleProps.type??>type="${simpleProps.type}"</#if> <#if simpleProps.readOnly>readOnly="true"</#if>/>
</#list>
<!-- The template section is only for manual resource additions, and default parameters and the ones presented to the user. -->
@@ -106,4 +106,12 @@ name="${props.name}"
<!-- TODO supply your configuration parameters -->
<c:simple-property name="dummy"/>
</resource-configuration>
- </#if>
\ No newline at end of file
+ </#if>
+
+<#if props.resourceConfig?has_content>
+ <resource-configuration>
+ <#list props.resourceConfig as simpleProps>
+ <c:simple-property name="${simpleProps.name}" description="${simpleProps.description}" <#if simpleProps.type??>type="${simpleProps.type}"</#if> <#if simpleProps.readOnly>readOnly="true"</#if>/>
+ </#list>
+ </resource-configuration>
+</#if>
diff --git a/modules/helpers/pluginGen/src/test/java/org/rhq/helpers/pluginGen/test/FooBean.java b/modules/helpers/pluginGen/src/test/java/org/rhq/helpers/pluginGen/test/FooBean.java
index fbc571b..5027dbb 100644
--- a/modules/helpers/pluginGen/src/test/java/org/rhq/helpers/pluginGen/test/FooBean.java
+++ b/modules/helpers/pluginGen/src/test/java/org/rhq/helpers/pluginGen/test/FooBean.java
@@ -19,6 +19,7 @@
package org.rhq.helpers.pluginGen.test;
+import org.rhq.helpers.pluginAnnotations.agent.ConfigProperty;
import org.rhq.helpers.pluginAnnotations.agent.DataType;
import org.rhq.helpers.pluginAnnotations.agent.DisplayType;
import org.rhq.helpers.pluginAnnotations.agent.MeasurementType;
@@ -26,6 +27,7 @@ import org.rhq.helpers.pluginAnnotations.agent.Metric;
import org.rhq.helpers.pluginAnnotations.agent.Operation;
import org.rhq.helpers.pluginAnnotations.agent.Parameter;
import org.rhq.helpers.pluginAnnotations.agent.RhqType;
+import org.rhq.helpers.pluginAnnotations.agent.Units;
/**
* Just a sample
@@ -34,7 +36,8 @@ import org.rhq.helpers.pluginAnnotations.agent.RhqType;
public class FooBean {
- @Metric(description = "How often was this bean invoked", displayType = DisplayType.SUMMARY, measurementType = MeasurementType.DYNAMIC)
+ @Metric(description = "How often was this bean invoked", displayType = DisplayType.SUMMARY, measurementType = MeasurementType.DYNAMIC,
+ units = Units.SECONDS)
int invocationCount;
@Metric(description = "Just a foo", dataType = DataType.TRAIT)
@@ -51,5 +54,11 @@ public class FooBean {
invocationCount -= by;
}
+ @ConfigProperty(scope = ConfigProperty.Scope.PLUGIN, displayName="The Password",
+ readOnly = false, property="thePassword",description = "A password", rhqType = RhqType.PASSWORD)
+ String password;
+
+ @ConfigProperty(scope = ConfigProperty.Scope.RESOURCE)
+ int defaultSteps;
}
10 years, 10 months
[rhq] modules/core
by Jiri Kremser
modules/core/domain/intentional-api-changes-since-4.8.0.xml | 8 ++++++++
1 file changed, 8 insertions(+)
New commits:
commit 039a42a2e696bb1bb0b170bec87ed95fe13921e2
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Fri Jul 19 16:40:48 2013 +0200
API Checks - Changing StorageNode.QUERY_FIND_BY_ADDRESS. The constants for native queries shouldn't be part of the public API.
diff --git a/modules/core/domain/intentional-api-changes-since-4.8.0.xml b/modules/core/domain/intentional-api-changes-since-4.8.0.xml
index f21a45f..a8a77b4 100644
--- a/modules/core/domain/intentional-api-changes-since-4.8.0.xml
+++ b/modules/core/domain/intentional-api-changes-since-4.8.0.xml
@@ -1,3 +1,11 @@
<?xml version="1.0"?>
<differences>
+ <difference>
+ <className>org/rhq/core/domain/cloud/StorageNode</className>
+ <differenceType>6003</differenceType><!-- Value of compile-time constant has changed -->
+ <field>QUERY_FIND_BY_ADDRESS</field>
+ <justification>
+ Changing StorageNode.QUERY_FIND_BY_ADDRESS. The constants for native queries shouldn't be part of the public API.
+ </justification>
+ </difference>
</differences>
10 years, 10 months
[rhq] modules/core modules/enterprise
by Jiri Kremser
modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementUnits.java | 13 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ConditionEditor.java | 38 ++++++++++
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 3
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties | 3
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties | 3
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties | 3
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties | 3
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties | 3
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties | 3
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties | 3
10 files changed, 75 insertions(+)
New commits:
commit 78eb557ae8f799b628769d76ccece61b6cb452a4
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Fri Jul 19 16:17:53 2013 +0200
[BZ 959587] - Alert definition should display units when entering a value; e.g. 'seconds' or 'megabytes' - Adding "BaseUnits" field to the popup form. The tooltip displays all allowed units from the same MeasurementUnits.Family.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementUnits.java b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementUnits.java
index 31811ab..d66f23b 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementUnits.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementUnits.java
@@ -22,6 +22,9 @@
*/
package org.rhq.core.domain.measurement;
+import java.util.ArrayList;
+import java.util.List;
+
import org.rhq.core.domain.measurement.util.MeasurementConversionException;
/**
@@ -117,6 +120,16 @@ public enum MeasurementUnits {
return null;
}
+
+ public List<MeasurementUnits> getFamilyUnits() {
+ List<MeasurementUnits> returnList = new ArrayList<MeasurementUnits>();
+ for (MeasurementUnits units : MeasurementUnits.values()) {
+ if (units.family == family) {
+ returnList.add(units);
+ }
+ }
+ return returnList;
+ }
public boolean isComparableTo(MeasurementUnits other) {
return family == other.family;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ConditionEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ConditionEditor.java
index 870140d..f4fbcad 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ConditionEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ConditionEditor.java
@@ -44,6 +44,8 @@ import com.smartgwt.client.widgets.form.fields.SelectItem;
import com.smartgwt.client.widgets.form.fields.SpacerItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.form.fields.TextItem;
+import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
+import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.toolbar.ToolStrip;
@@ -613,6 +615,7 @@ public class ConditionEditor extends EnhancedVLayout {
}
absoluteValue.setShowIfCondition(ifFunc);
formItems.add(absoluteValue);
+ formItems.add(buildBaseUnitsItem(metricDropDownMenu, ifFunc, editMode));
} else {
String noMetricsStr = MSG.view_alert_definition_condition_editor_metric_nometrics();
StaticTextItem noMetrics = buildHelpTextItem(THRESHOLD_NO_METRICS_ITEMNAME, noMetricsStr, ifFunc);
@@ -663,6 +666,7 @@ public class ConditionEditor extends EnhancedVLayout {
formItems.add(absoluteLowValue);
formItems.add(absoluteHighValue);
+ formItems.add(buildBaseUnitsItem(metricDropDownMenu, ifFunc, editMode));
} else {
String noMetricsStr = MSG.view_alert_definition_condition_editor_metric_nometrics();
StaticTextItem noMetrics = buildHelpTextItem(RANGE_NO_METRICS_ITEMNAME, noMetricsStr, ifFunc);
@@ -1220,6 +1224,40 @@ public class ConditionEditor extends EnhancedVLayout {
return comparatorSelection;
}
+ private StaticTextItem buildBaseUnitsItem(final SelectItem metricDropDownMenu, FormItemIfFunction ifFunc,
+ boolean editMode) {
+ String baseUnits = MSG.view_alert_definition_condition_editor_common_baseUnits();
+ final StaticTextItem baseUnitsItem = new StaticTextItem("baseUnits", baseUnits);
+ baseUnitsItem.setHoverWidth(200);
+ baseUnitsItem.setShowIfCondition(ifFunc);
+
+ metricDropDownMenu.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ MeasurementDefinition measDef = getMeasurementDefinition(form.getValueAsString(metricDropDownMenu
+ .getName()));
+ baseUnitsItem.setValue(measDef.getUnits() == MeasurementUnits.NONE ? MSG
+ .view_alert_definition_condition_editor_common_baseUnits_none()
+ : measDef.getUnits() == MeasurementUnits.MILLISECONDS ? MeasurementUnits.SECONDS : measDef
+ .getUnits());
+ List<MeasurementUnits> availableUnits = measDef.getUnits().getFamilyUnits();
+ baseUnitsItem.setTooltip(MSG.view_alert_definition_condition_editor_common_baseUnits_availableUnits()
+ + (availableUnits.isEmpty() || availableUnits.get(0) == MeasurementUnits.NONE ? MSG
+ .view_alert_definition_condition_editor_common_baseUnits_none() : availableUnits));
+ }
+ });
+ // initialize the field with proper value
+ MeasurementUnits units = editMode ? existingCondition.getMeasurementDefinition().getUnits()
+ : ConditionEditor.this.resourceType.getMetricDefinitions().iterator().next().getUnits();
+ baseUnitsItem.setValue(units == MeasurementUnits.NONE ? MSG
+ .view_alert_definition_condition_editor_common_baseUnits_none()
+ : units == MeasurementUnits.MILLISECONDS ? MeasurementUnits.SECONDS : units);
+ List<MeasurementUnits> availableUnits = units.getFamilyUnits();
+ baseUnitsItem.setTooltip(MSG.view_alert_definition_condition_editor_common_baseUnits_availableUnits()
+ + (availableUnits.isEmpty() || availableUnits.get(0) == MeasurementUnits.NONE ? MSG
+ .view_alert_definition_condition_editor_common_baseUnits_none() : availableUnits));
+ return baseUnitsItem;
+ }
+
private StaticTextItem buildHelpTextItem(String itemName, String helpText, FormItemIfFunction ifFunc) {
StaticTextItem help = new StaticTextItem(itemName);
help.setShowTitle(false);
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index ed6b130..19d3fa5 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -919,6 +919,9 @@ view_alert_definition_condition_editor_availabilityDuration_tooltip_duration = T
view_alert_definition_condition_editor_availability_tooltip = Specify the availability state change that will trigger the condition.
view_alert_definition_condition_editor_availability_value = Availability
view_alert_definition_condition_editor_common_avg = Average
+view_alert_definition_condition_editor_common_baseUnits = Base Units
+view_alert_definition_condition_editor_common_baseUnits_availableUnits = Available units:
+view_alert_definition_condition_editor_common_baseUnits_none = None
view_alert_definition_condition_editor_common_max = Maximum
view_alert_definition_condition_editor_common_min = Minimum
view_alert_definition_condition_editor_common_regex = Regular Expression
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties
index 1950003..f71f907 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties
@@ -933,6 +933,9 @@ view_alert_definition_condition_editor_availabilityDuration_tooltip_duration = P
view_alert_definition_condition_editor_availability_tooltip = Specifikujte stav dostupnosti, který poté splní podmínku.
view_alert_definition_condition_editor_availability_value = Dostupnost
view_alert_definition_condition_editor_common_avg = Průměr
+view_alert_definition_condition_editor_common_baseUnits = Základní jednotky
+view_alert_definition_condition_editor_common_baseUnits_availableUnits = Dostupné jednotky:
+view_alert_definition_condition_editor_common_baseUnits_none = Źádné
view_alert_definition_condition_editor_common_max = Maximum
view_alert_definition_condition_editor_common_min = Minimum
view_alert_definition_condition_editor_common_regex = Regulární výraz
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
index bd8e0b4..524dcc0 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
@@ -844,6 +844,9 @@ view_alert_definition_condition_editor_avilability_option_up = Wird verfügbar
view_alert_definition_condition_editor_avilability_tooltip = Geben Sie die Änderung der Verfügbarkeit an, die die Bedingung auslösen soll.
view_alert_definition_condition_editor_avilability_value = Verfügbarkeit
view_alert_definition_condition_editor_common_avg = Durchschnitt
+##view_alert_definition_condition_editor_common_baseUnits = Base Units
+##view_alert_definition_condition_editor_common_baseUnits_availableUnits = Available units:
+##view_alert_definition_condition_editor_common_baseUnits_none = None
view_alert_definition_condition_editor_common_max = Maximum
view_alert_definition_condition_editor_common_min = Minimum
view_alert_definition_condition_editor_common_regex = Regulärer Ausdruck
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
index 1c0005b..cb0c35f 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
@@ -908,6 +908,9 @@ view_alert_definition_condition_editor_availabilityDuration_tooltip_duration =
view_alert_definition_condition_editor_availability_tooltip = 条件のトリガーとなるアベイラビリティ状態の変化を指定します
view_alert_definition_condition_editor_availability_value = アベイラビリティ
view_alert_definition_condition_editor_common_avg = 平均
+##view_alert_definition_condition_editor_common_baseUnits = Base Units
+##view_alert_definition_condition_editor_common_baseUnits_availableUnits = Available units:
+##view_alert_definition_condition_editor_common_baseUnits_none = None
view_alert_definition_condition_editor_common_max = 最大
view_alert_definition_condition_editor_common_min = 最小
view_alert_definition_condition_editor_common_regex = 正規表現
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties
index 5118a2d..32dc73d 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties
@@ -797,6 +797,9 @@ view_alert_definition_condition_editor_availabilityDuration_tooltip_duration =
view_alert_definition_condition_editor_availability_tooltip = 조건 트리거하는 가용성 상태의 변화를 지정합니다.
view_alert_definition_condition_editor_availability_value = 가용성
view_alert_definition_condition_editor_common_avg = 평균
+##view_alert_definition_condition_editor_common_baseUnits = Base Units
+##view_alert_definition_condition_editor_common_baseUnits_availableUnits = Available units:
+##view_alert_definition_condition_editor_common_baseUnits_none = None
view_alert_definition_condition_editor_common_max = 최대
view_alert_definition_condition_editor_common_min = 최소
view_alert_definition_condition_editor_common_regex = 정규 표현식
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
index bfd95e8..f4419e1 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
@@ -916,6 +916,9 @@ view_alert_common_tab_recovery = Recupera\u00E7\u00E3o
view_alert_definition_condition_editor_availability_tooltip = Especifica a mudan\u00E7a de estado na disponibilidade do recurso que ir\u00E1 disparar a condi\u00E7\u00E3o.
view_alert_definition_condition_editor_availability_value = Disponibilidade
view_alert_definition_condition_editor_common_avg = M\u00E9dio
+##view_alert_definition_condition_editor_common_baseUnits = Base Units
+##view_alert_definition_condition_editor_common_baseUnits_availableUnits = Available units:
+##view_alert_definition_condition_editor_common_baseUnits_none = None
view_alert_definition_condition_editor_common_max = M\u00E1ximo
view_alert_definition_condition_editor_common_min = M\u00EDnimo
view_alert_definition_condition_editor_common_regex = Express\u00E3o Regular
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties
index e03e1a9..d75b76e 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties
@@ -881,6 +881,9 @@
#view_alert_definition_condition_editor_availability_tooltip = Specify the availability state change that will trigger the condition.
#view_alert_definition_condition_editor_availability_value = Availability
#view_alert_definition_condition_editor_common_avg = Average
+##view_alert_definition_condition_editor_common_baseUnits = Base Units
+##view_alert_definition_condition_editor_common_baseUnits_availableUnits = Available units:
+##view_alert_definition_condition_editor_common_baseUnits_none = None
#view_alert_definition_condition_editor_common_max = Maximum
#view_alert_definition_condition_editor_common_min = Minimum
#view_alert_definition_condition_editor_delete_confirm = Delete the selected alert condition(s)?
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
index 82ddc2a..a9a24df 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
@@ -902,6 +902,9 @@ view_alert_common_tab_recovery = \u8fd8\u539f
view_alert_definition_condition_editor_availability_tooltip = Specify the availability state change that will trigger the condition.
view_alert_definition_condition_editor_availability_value = \u53ef\u7528\u6027
view_alert_definition_condition_editor_common_avg = \u5e73\u5747
+##view_alert_definition_condition_editor_common_baseUnits = Base Units
+##view_alert_definition_condition_editor_common_baseUnits_availableUnits = Available units:
+##view_alert_definition_condition_editor_common_baseUnits_none = None
view_alert_definition_condition_editor_common_max = \u6700\u5927
view_alert_definition_condition_editor_common_min = \u6700\u5c0f
view_alert_definition_condition_editor_common_regex = \u6b63\u5219\u8868\u8fbe\u5f0f
10 years, 10 months
[rhq] 3 commits - modules/core modules/enterprise
by Jiri Kremser
modules/core/domain/src/main/java/org/rhq/core/domain/alert/Alert.java | 3
modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertDampening.java | 3
modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertDefinition.java | 4
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AlertDefinitionCriteria.java | 9 ++
modules/enterprise/gui/coregui/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator.launch | 7 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java | 20 ++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDetailsView.java | 42 +++++++++-
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 1
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties | 1
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties | 1
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties | 1
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties | 1
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties | 1
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties | 1
14 files changed, 85 insertions(+), 10 deletions(-)
New commits:
commit 1f6cf05d57599ded2d196241284b4b5167886c80
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Fri Jul 19 12:43:35 2013 +0200
[BZ 980091] - link in the alert to the parent on which the alert was created - Adding the link to AlertDetailsView if the alert is defined by parent definition. Parent definition could mean group alert definition, autogroup alert definition or template definition
diff --git a/modules/enterprise/gui/coregui/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator.launch b/modules/enterprise/gui/coregui/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator.launch
new file mode 100644
index 0000000..627021f
--- /dev/null
+++ b/modules/enterprise/gui/coregui/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator.launch
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
+<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_DISABLED_BUILDER" value="org.eclipse.wst.jsdt.core.javascriptValidator"/>
+<mapAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS"/>
+<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
+</launchConfiguration>
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
index 17dd6d6..d66baea 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
@@ -57,6 +57,7 @@ import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
+import org.rhq.enterprise.gui.coregui.client.admin.templates.AlertDefinitionTemplateTypeView;
import org.rhq.enterprise.gui.coregui.client.components.form.DateFilterItem;
import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
import org.rhq.enterprise.gui.coregui.client.gwt.AlertGWTServiceAsync;
@@ -74,6 +75,8 @@ import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
* @author John Mazzitelli
*/
public class AlertDataSource extends RPCDataSource<Alert, AlertCriteria> {
+
+ private static final String FIELD_PARENT = "parent"; // may be template or group alert def parent
public static final String PRIORITY_ICON_HIGH = ImageManager.getAlertIcon(AlertPriority.HIGH);
public static final String PRIORITY_ICON_MEDIUM = ImageManager.getAlertIcon(AlertPriority.MEDIUM);
@@ -359,6 +362,7 @@ public class AlertDataSource extends RPCDataSource<Alert, AlertCriteria> {
}
criteria.addFilterEntityContext(entityContext);
criteria.fetchConditionLogs(true);
+// criteria.fetchGroupAlertDefinition(true);
return criteria;
}
@@ -410,6 +414,22 @@ public class AlertDataSource extends RPCDataSource<Alert, AlertCriteria> {
record.setAttribute(AncestryUtil.RESOURCE_ANCESTRY, resource.getAncestry());
record.setAttribute(AncestryUtil.RESOURCE_TYPE_ID, resource.getResourceType().getId());
+ AlertDefinition groupAlertDefinition = alertDefinition.getGroupAlertDefinition();
+ Integer parentId = alertDefinition.getParentId();
+ if (groupAlertDefinition != null && groupAlertDefinition.getGroup() != null) {
+ boolean isAutogroup = groupAlertDefinition.getGroup().getAutoGroupParentResource() != null;
+ record.setAttribute(FIELD_PARENT, (isAutogroup ? "#Resource/AutoGroup/" : "#ResourceGroup/")
+ + groupAlertDefinition.getGroup().getId() + "/Alerts/Definitions/" + groupAlertDefinition.getId());
+ record.setLinkText(MSG.view_alert_definition_for_group());
+ } else if (parentId != null && parentId.intValue() != 0) {
+ record.setAttribute(
+ FIELD_PARENT,
+ LinkManager.getAdminTemplatesEditLink(AlertDefinitionTemplateTypeView.VIEW_ID.getName(), resource
+ .getResourceType().getId())
+ + "/" + parentId);
+ record.setLinkText(MSG.view_alert_definition_for_type());
+ }
+
Set<AlertConditionLog> conditionLogs = from.getConditionLogs();
String conditionText;
String conditionValue;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDetailsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDetailsView.java
index 68a0953..ed98d94 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDetailsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDetailsView.java
@@ -40,8 +40,12 @@ import com.smartgwt.client.widgets.tab.Tab;
import com.smartgwt.client.widgets.tab.TabSet;
import org.rhq.core.domain.alert.Alert;
+import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.core.domain.alert.notification.ResultState;
import org.rhq.core.domain.criteria.AlertCriteria;
+import org.rhq.core.domain.criteria.AlertDefinitionCriteria;
+import org.rhq.core.domain.criteria.ResourceGroupCriteria;
+import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
@@ -83,7 +87,14 @@ public class AlertDetailsView extends EnhancedVLayout implements BookmarkableVie
@Override
public void onSuccess(PageList<Alert> result) {
Alert alert = result.get(0);
- show(alert);
+ Integer parentId = alert.getAlertDefinition().getParentId();
+ AlertDefinition groupAlertDefinition = alert.getAlertDefinition().getGroupAlertDefinition();
+ if (groupAlertDefinition != null || (parentId != null && parentId.intValue() != 0)) {
+ fetchDefinitionWithGroupAndTemplate(alert);
+ } else {
+ show(alert);
+ }
+
}
@Override
@@ -92,6 +103,24 @@ public class AlertDetailsView extends EnhancedVLayout implements BookmarkableVie
}
});
}
+
+ private void fetchDefinitionWithGroupAndTemplate(final Alert alert) {
+ AlertDefinitionCriteria criteria = new AlertDefinitionCriteria();
+ criteria.addFilterAlertId(alert.getId());
+ criteria.fetchGroupAlertDefinition(true);
+ criteria.fetchResourceType(true);
+ GWTServiceLookup.getAlertDefinitionService().findAlertDefinitionsByCriteria(criteria, new AsyncCallback<PageList<AlertDefinition>>() {
+ public void onSuccess(PageList<AlertDefinition> result) {
+ alert.getAlertDefinition().setGroupAlertDefinition(result.get(0).getGroupAlertDefinition());
+ alert.getAlertDefinition().setResourceType(result.get(0).getResourceType());
+ show(alert);
+ }
+
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_alert_details_loadFailed(), caught);
+ }
+ });
+ }
private void show(Alert alert) {
destroyMembers();
@@ -102,7 +131,7 @@ public class AlertDetailsView extends EnhancedVLayout implements BookmarkableVie
addMember(getDetailsTabSet(record));
}
- private TabSet getDetailsTabSet(Record record) {
+ private TabSet getDetailsTabSet(ListGridRecord record) {
TabSet tabset = new NamedTabSet();
Tab generalTab = new NamedTab(new ViewName("general", MSG.view_alert_common_tab_general()));
@@ -121,7 +150,7 @@ public class AlertDetailsView extends EnhancedVLayout implements BookmarkableVie
return tabset;
}
- private DynamicForm getDetailsTableForAlert(Record record) {
+ private DynamicForm getDetailsTableForAlert(ListGridRecord record) {
DynamicForm form = new DynamicForm();
form.setNumCols(4);
form.setHeight("15%");
@@ -189,6 +218,13 @@ public class AlertDetailsView extends EnhancedVLayout implements BookmarkableVie
MSG.view_alert_details_field_resource_ancestry());
resourceAncestryItem.setValue(record.getAttribute("resourceAncestry"));
items.add(resourceAncestryItem);
+
+ String parentUrl = record.getAttribute("parent");
+ if (parentUrl != null) {
+ StaticTextItem parentItem = new StaticTextItem("parent", "Parent Definition");
+ parentItem.setValue(LinkManager.getHref(parentUrl, record.getLinkText()));
+ items.add(parentItem);
+ }
form.setItems(items.toArray(new FormItem[items.size()]));
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index 84e9c6e..ed6b130 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -1080,6 +1080,7 @@ view_alert_definitions_update_failure = Alert definition update failed
view_alert_definitions_update_success = Alert definition successfully updated
view_alert_details_field_ack_at = Acknowledged at
view_alert_details_field_ack_by = Acknowledged by
+view_alert_details_field_parent_definition = Parent definition
view_alert_details_field_recovery_info = Recovery Info
view_alert_details_field_resource_ancestry = Resource Ancestry
view_alert_details_field_watched_resource = Watched Resource
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties
index d6a102b..1950003 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties
@@ -1094,6 +1094,7 @@ view_alert_definitions_update_failure = Nepodařilo se změnit definici výstrah
view_alert_definitions_update_success = Úspěšně změněna definice výstrahy
view_alert_details_field_ack_at = Potvrzeno v
view_alert_details_field_ack_by = Potvrzeno kým
+view_alert_details_field_parent_definition = Definice rodiče
view_alert_details_field_recovery_info = Informace o obnově
view_alert_details_field_resource_ancestry = Původ zdroje
view_alert_details_field_watched_resource = Sledovaný zdroj
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
index 9237f76..1c0005b 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
@@ -1069,6 +1069,7 @@ view_alert_definitions_update_failure = アラート定義の更新に失敗し
view_alert_definitions_update_success = アラート定義の更新に成功しました
view_alert_details_field_ack_at = 次の場所で確認済みです
view_alert_details_field_ack_by = 次の人によって確認済みです
+##view_alert_details_field_parent_definition = Parent definition
view_alert_details_field_recovery_info = リカバリ情報
##view_alert_details_field_resource_ancestry = Resource Ancestry
##view_alert_details_field_watched_resource = Watched Resource
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties
index bd34f9b..5118a2d 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties
@@ -935,6 +935,7 @@ view_alert_definitions_table_title_group = 그룹 경고 정의
view_alert_definitions_table_title_resource = 리소스 경고 정의
view_alert_details_field_ack_at = 다음 위치에서 확인했습니다
view_alert_details_field_ack_by = 다음 사람에 의해 확인되었습니다
+##view_alert_details_field_parent_definition = Parent definition
view_alert_details_field_recovery_info = 복구 정보
view_alert_details_field_resource_ancestry = 리소스 조상
view_alert_details_field_watched_resource = 관심 리소스
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
index 1330eb7..bfd95e8 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
@@ -1078,6 +1078,7 @@ view_alert_definitions_update_success = Defini\u00E7\u00E3o do alerta atualizada
view_alert_details_breadcrumb = Detalhes
view_alert_details_field_ack_at = Verificado em
view_alert_details_field_ack_by = Verificado por
+##view_alert_details_field_parent_definition = Parent definition
view_alert_details_field_recovery_info = Informa\u00E7\u00E3o de Recupera\u00E7\u00E3o
##view_alert_details_field_resource_ancestry = Resource Ancestry
##view_alert_details_field_watched_resource = Watched Resource
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties
index 72a287b..e03e1a9 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties
@@ -1042,6 +1042,7 @@
#view_alert_definitions_update_success = Alert definition successfully updated
#view_alert_details_field_ack_at = Acknowledged at
#view_alert_details_field_ack_by = Acknowledged by
+##view_alert_details_field_parent_definition = Parent definition
#view_alert_details_field_recovery_info = Recovery Info
#view_alert_details_loadFailed = Failed to fetch alert details
#view_alerts_ack_confirm = Acknowledge the selected alert(s)?
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
index 10f9b0a..82ddc2a 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
@@ -1063,6 +1063,7 @@ view_alert_definitions_update_failure = \u544a\u8b66\u5b9a\u4e49\u66f4\u65b0\u59
view_alert_definitions_update_success = \u544a\u8b66\u5b9a\u4e49\u66f4\u65b0\u6210\u529f
view_alert_details_field_ack_at = \u786e\u8ba4\u4e8e
view_alert_details_field_ack_by = \u786e\u8ba4\u8005
+##view_alert_details_field_parent_definition = Parent definition
view_alert_details_field_recovery_info = \u8fd8\u539f\u4fe1\u606f
##view_alert_details_field_resource_ancestry = Resource Ancestry
##view_alert_details_field_watched_resource = Watched Resource
commit 67c442b7baa5db4cdd3715fd89db9ea01b9e2fa8
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Fri Jul 19 12:41:13 2013 +0200
Removing deprecated annotation, adding orphanRemoval=true attribute instead.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/Alert.java b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/Alert.java
index 4742c17..44a8eac 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/Alert.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/Alert.java
@@ -253,9 +253,8 @@ public class Alert implements Serializable {
@ManyToOne
private AlertDefinition alertDefinition;
- @OneToMany(mappedBy = "alert", cascade = CascadeType.ALL)
+ @OneToMany(mappedBy = "alert", cascade = CascadeType.ALL, orphanRemoval=true)
@OrderBy
- @org.hibernate.annotations.Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
// primary key
private Set<AlertConditionLog> conditionLogs = new LinkedHashSet<AlertConditionLog>();
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertDampening.java b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertDampening.java
index 0f2d0b1..be98df5 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertDampening.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertDampening.java
@@ -86,8 +86,7 @@ public class AlertDampening implements java.io.Serializable {
// This is required for cascade behavior. We want to be able to cascade delete the AlertDampeningEvents when an
// AlertDefinition is removed from the db, due to deleting a Resource from inventory.
- @OneToMany(mappedBy = "alertDefinition", cascade = { CascadeType.REFRESH, CascadeType.REMOVE })
- @org.hibernate.annotations.Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
+ @OneToMany(mappedBy = "alertDefinition", cascade = { CascadeType.REFRESH, CascadeType.REMOVE }, orphanRemoval = true)
private Set<AlertDampeningEvent> alertDampeningEvents = new HashSet<AlertDampeningEvent>();
protected AlertDampening() {
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertDefinition.java b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertDefinition.java
index 02362ce..3445d9e 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertDefinition.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertDefinition.java
@@ -293,7 +293,6 @@ public class AlertDefinition implements Serializable {
// do not cascade remove - group removal will be detaching children alert defs from the group def,
// and then letting the children be deleted slowly by existing alert def removal mechanisms
- @SuppressWarnings("unused")
@OneToMany(mappedBy = "groupAlertDefinition", fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST })
@OrderBy
private Set<AlertDefinition> groupAlertDefinitionChildren = new LinkedHashSet<AlertDefinition>();
@@ -361,11 +360,10 @@ public class AlertDefinition implements Serializable {
// referencing AlertConditionLog records.
private Set<AlertCondition> conditions = new LinkedHashSet<AlertCondition>(1); // Most alerts will only have one condition.
- @OneToMany(mappedBy = "alertDefinition", cascade = CascadeType.ALL)
+ @OneToMany(mappedBy = "alertDefinition", cascade = CascadeType.ALL, orphanRemoval = true)
// Although similar to AlertCondition, we do use DELETE_ORPHAN here. The reason is because AlertNotificationLog
// does not refer back to the AlertNotification record and therefore the notification logs are not affected
// by the loss of the AlertNotification that spawned the notification.
- @org.hibernate.annotations.Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
private List<AlertNotification> alertNotifications = new ArrayList<AlertNotification>();
/**
commit 92a286d611085d96ba1710c442035445dda5318a
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Thu Jul 18 18:37:48 2013 +0200
[BZ 980091] - link in the alert to the parent on which the alert was created - Adding a new filter on AlertDefinitionCriteria (filter by alert id).
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AlertDefinitionCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AlertDefinitionCriteria.java
index 854efaf..9d4e51d 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AlertDefinitionCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AlertDefinitionCriteria.java
@@ -48,6 +48,7 @@ public class AlertDefinitionCriteria extends Criteria {
private String filterName;
private String filterDescription;
private AlertPriority filterPriority;
+ private Integer filterAlertId; // requires overrides
private NonBindingOverrideFilter filterAlertTemplateOnly; // requires overrides - finds only alert templates
private Integer filterAlertTemplateParentId; // requires overrides
private Integer filterAlertTemplateResourceTypeId; // requires overrides
@@ -75,6 +76,10 @@ public class AlertDefinitionCriteria extends Criteria {
private PageOrdering sortResourceName; // requires sort override
public AlertDefinitionCriteria() {
+ filterOverrides.put("alertId", ""
+ + "id IN ( SELECT alert.alertDefinition.id " //
+ + " FROM Alert alert " //
+ + " WHERE alert.id = ? )");
filterOverrides.put("alertTemplateOnly", "resourceType IS NOT NULL");
filterOverrides.put("alertTemplateParentId", "parentId = ?");
filterOverrides.put("alertTemplateResourceTypeId", "resourceType.id = ?");
@@ -113,6 +118,10 @@ public class AlertDefinitionCriteria extends Criteria {
public void addFilterAlertTemplateParentId(Integer filterAlertTemplateParentId) {
this.filterAlertTemplateParentId = filterAlertTemplateParentId;
}
+
+ public void addFilterAlertId(Integer filterAlertId) {
+ this.filterAlertId = filterAlertId;
+ }
public void addFilterAlertTemplateResourceTypeId(Integer filterAlertTemplateResourceTypeId) {
this.filterAlertTemplateResourceTypeId = filterAlertTemplateResourceTypeId;
10 years, 10 months
[rhq] modules/enterprise
by Heiko W. Rupp
modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/ControlCommand.java | 86 +++++++++-
modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/AbstractInstall.java | 55 ------
modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Start.java | 10 -
modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Stop.java | 10 -
4 files changed, 94 insertions(+), 67 deletions(-)
New commits:
commit b3aa6d8a54378fad077d2052e9f9620768723a4d
Author: Michael Burman <yak(a)iki.fi>
Date: Fri Jul 19 12:27:38 2013 +0200
BZ980076 Check if storage is really running after a crash
diff --git a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/ControlCommand.java b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/ControlCommand.java
index 8988d98..5528619 100644
--- a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/ControlCommand.java
+++ b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/ControlCommand.java
@@ -1,7 +1,7 @@
/*
*
* * RHQ Management Platform
- * * Copyright (C) 2005-2012 Red Hat, Inc.
+ * * Copyright (C) 2005-2013 Red Hat, Inc.
* * All rights reserved.
* *
* * This program is free software; you can redistribute it and/or modify
@@ -41,6 +41,10 @@ import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.commons.exec.DefaultExecutor;
+import org.apache.commons.exec.ExecuteException;
+import org.apache.commons.exec.Executor;
+import org.apache.commons.exec.PumpStreamHandler;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -171,10 +175,15 @@ public abstract class ControlCommand {
return getStorageBasedir().exists();
}
- protected String getStoragePid() throws IOException {
+ protected File getStoragePidFile() {
File storageBasedir = getStorageBasedir();
File storageBinDir = new File(storageBasedir, "bin");
File pidFile = new File(storageBinDir, "cassandra.pid");
+ return pidFile;
+ }
+
+ protected String getStoragePid() throws IOException {
+ File pidFile = getStoragePidFile();
if (pidFile.exists()) {
return StreamUtil.slurp(new FileReader(pidFile));
@@ -282,4 +291,77 @@ public abstract class ControlCommand {
return inUse;
}
+
+ protected void waitForProcessToStop(String pid) throws Exception {
+
+ if (isWindows() || pid==null) {
+ // For the moment we have no better way to just wait some time
+ Thread.sleep(10*1000L);
+ } else {
+ int tries = 5;
+ while (tries > 0) {
+ log.debug(".");
+ if (!isUnixPidRunning(pid)) {
+ break;
+ }
+ Thread.sleep(2*1000L);
+ tries--;
+ }
+ if (tries==0) {
+ throw new RHQControlException("Process [" + pid + "] did not finish yet. Terminate it manually and retry.");
+ }
+ }
+
+ }
+
+ protected void killPid(String pid) throws IOException {
+ Executor executor = new DefaultExecutor();
+ executor.setWorkingDirectory(getBinDir());
+ executor.setStreamHandler(new PumpStreamHandler());
+ org.apache.commons.exec.CommandLine commandLine;
+
+ commandLine = new org.apache.commons.exec.CommandLine("kill").addArgument(pid);
+ executor.execute(commandLine);
+ }
+
+ protected boolean isUnixPidRunning(String pid) {
+
+ Executor executor = new DefaultExecutor();
+ executor.setWorkingDirectory(getBinDir());
+ executor.setStreamHandler(new PumpStreamHandler());
+ org.apache.commons.exec.CommandLine commandLine = new org.apache.commons.exec.CommandLine("/bin/kill")
+ .addArgument("-0")
+ .addArgument(pid);
+
+ try {
+ int code = executor.execute(commandLine);
+ if (code!=0) {
+ return false;
+ }
+ } catch (ExecuteException ee ) {
+ if (ee.getExitValue()==1) {
+ // return code 1 means process does not exist
+ return false;
+ }
+ } catch (IOException e) {
+ log.error("Checking for running process failed: " + e.getMessage());
+ }
+ return true;
+ }
+
+ protected boolean isStorageRunning() throws IOException {
+ String pid = getStoragePid();
+ if(pid == null) {
+ return false;
+ } else if(pid != null && !isUnixPidRunning(pid)) {
+ // There is a phantom pidfile
+ File pidFile = getStoragePidFile();
+ if(!pidFile.delete()) {
+ throw new RHQControlException("Could not delete storage pidfile " + pidFile.getAbsolutePath());
+ }
+ return false;
+ } else {
+ return true;
+ }
+ }
}
diff --git a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/AbstractInstall.java b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/AbstractInstall.java
index fe7cdd4..8c885b0 100644
--- a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/AbstractInstall.java
+++ b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/AbstractInstall.java
@@ -1,7 +1,7 @@
/*
*
* * RHQ Management Platform
- * * Copyright (C) 2005-2012 Red Hat, Inc.
+ * * Copyright (C) 2005-2013 Red Hat, Inc.
* * All rights reserved.
* *
* * This program is free software; you can redistribute it and/or modify
@@ -36,16 +36,12 @@ import java.util.Properties;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.exec.DefaultExecuteResultHandler;
import org.apache.commons.exec.DefaultExecutor;
-import org.apache.commons.exec.ExecuteException;
import org.apache.commons.exec.Executor;
import org.apache.commons.exec.PumpStreamHandler;
-
import org.jboss.as.controller.client.ModelControllerClient;
-
import org.rhq.common.jbossas.client.controller.DeploymentJBossASClient;
import org.rhq.common.jbossas.client.controller.MCCHelper;
import org.rhq.server.control.ControlCommand;
-import org.rhq.server.control.RHQControlException;
/**
* Common code for commands that perform installs. Basically shared code for Install and Upgrade commands.
@@ -104,55 +100,6 @@ public abstract class AbstractInstall extends ControlCommand {
}
}
- protected void waitForProcessToStop(String pid) throws Exception {
-
- if (isWindows() || pid==null) {
- // For the moment we have no better way to just wait some time
- Thread.sleep(10*1000L);
- } else {
- int tries = 5;
- while (tries > 0) {
- log.debug(".");
- if (!isUnixPidRunning(pid)) {
- break;
- }
- Thread.sleep(2*1000L);
- tries--;
- }
- if (tries==0) {
- throw new RHQControlException("Process [" + pid + "] did not finish yet. Terminate it manually and retry.");
- }
- }
-
- }
-
- protected boolean isUnixPidRunning(String pid) {
-
- Executor executor = new DefaultExecutor();
- executor.setWorkingDirectory(getBinDir());
- executor.setStreamHandler(new PumpStreamHandler());
- org.apache.commons.exec.CommandLine commandLine;
-
- commandLine = new org.apache.commons.exec.CommandLine("/bin/kill")
- .addArgument("-0")
- .addArgument(pid);
-
- try {
- int code = executor.execute(commandLine);
- if (code!=0) {
- return false;
- }
- } catch (ExecuteException ee ) {
- if (ee.getExitValue()==1) {
- // return code 1 means process does not exist
- return false;
- }
- } catch (IOException e) {
- log.error("Checking for running process failed: " + e.getMessage());
- }
- return true;
- }
-
protected void waitForRHQServerToInitialize() throws Exception {
try {
final long messageInterval = 30000L;
diff --git a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Start.java b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Start.java
index 7e83c9e..f15b13e 100644
--- a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Start.java
+++ b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Start.java
@@ -1,7 +1,7 @@
/*
*
* * RHQ Management Platform
- * * Copyright (C) 2005-2012 Red Hat, Inc.
+ * * Copyright (C) 2005-2013 Red Hat, Inc.
* * All rights reserved.
* *
* * This program is free software; you can redistribute it and/or modify
@@ -26,7 +26,6 @@
package org.rhq.server.control.command;
import java.io.File;
-import java.io.FileReader;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Options;
@@ -137,14 +136,13 @@ public class Start extends ControlCommand {
log.debug("Failed to start storage service", e);
}
} else {
-
File storageBinDir = new File(getStorageBasedir(), "bin");
- File pidFile = new File(storageBinDir, "cassandra.pid");
+ File pidFile = getStoragePidFile();
// For now we are duplicating logic in the status command. This code will be
// replaced when we implement a rhq-storage.sh script.
- if (pidFile.exists()) {
- String pid = StreamUtil.slurp(new FileReader(pidFile));
+ if (isStorageRunning()) {
+ String pid = getStoragePid();
System.out.println("RHQ storage node (pid " + pid + ") is running");
} else {
commandLine = getCommandLine(false, "cassandra", "-p", pidFile.getAbsolutePath());
diff --git a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Stop.java b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Stop.java
index 53d0374..908aa8e 100644
--- a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Stop.java
+++ b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Stop.java
@@ -1,7 +1,7 @@
/*
*
* * RHQ Management Platform
- * * Copyright (C) 2005-2012 Red Hat, Inc.
+ * * Copyright (C) 2005-2013 Red Hat, Inc.
* * All rights reserved.
* *
* * This program is free software; you can redistribute it and/or modify
@@ -126,13 +126,13 @@ public class Stop extends AbstractInstall {
log.debug("Failed to stop storage service", e);
}
} else {
- String pid = getStoragePid();
- if (pid != null) {
+ if(isStorageRunning()) {
+ String pid = getStoragePid();
+
System.out.println("Stopping RHQ storage node...");
System.out.println("RHQ storage node (pid=" + pid + ") is stopping...");
- commandLine = new org.apache.commons.exec.CommandLine("kill").addArgument(pid);
- executor.execute(commandLine);
+ killPid(pid);
waitForProcessToStop(pid);
10 years, 10 months
[rhq] Branch 'mtho11/consolidated-metrics' - 2 commits - modules/enterprise
by mike thompson
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/AbstractMetricGraph.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/MetricGraphData.java | 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/graphtype/AvailabilityLineGraphType.java | 311 -------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/graphtype/LineMetricGraph.java | 158 ---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/graphtype/StackedBarMetricGraphImpl.java | 7
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/avail/ResourceAvailabilityView.java | 401 ----------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MeasurementTableView.java | 238 -----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MetricsResourceView.java | 29
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MetricsTableView.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MetricsViewDataSource.java | 6
modules/enterprise/gui/coregui/src/main/webapp/js/rhq.js | 4
11 files changed, 36 insertions(+), 1134 deletions(-)
New commits:
commit 6c46aa725f0a5c81df92250b4b587aa855997fa0
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Thu Jul 18 20:27:10 2013 -0700
Consolidated Metrics - Dont show graph legend on treegrid charts but show them elsewhere. Removal of old code.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/AbstractMetricGraph.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/AbstractMetricGraph.java
index e75b65a..ace6154 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/AbstractMetricGraph.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/AbstractMetricGraph.java
@@ -202,6 +202,10 @@ public abstract class AbstractMetricGraph extends VLayout implements HasD3Metric
return metricGraphData.getPortalId();
}
+ public boolean isHideLegend(){
+ return metricGraphData.isHideLegend();
+ }
+
public void setGraphListView(AbstractD3GraphListView graphListView) {
this.graphListView = graphListView;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/MetricGraphData.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/MetricGraphData.java
index ecd3b46..dc054fc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/MetricGraphData.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/MetricGraphData.java
@@ -73,6 +73,7 @@ public class MetricGraphData implements JsonMetricProducer {
private MeasurementOOBComposite lastOOB;
private Integer chartHeight;
private boolean isPortalGraph;
+ private boolean hideLegend;
private MetricGraphData(int portalId) {
@@ -249,6 +250,14 @@ public class MetricGraphData implements JsonMetricProducer {
return isPortalGraph;
}
+ public boolean isHideLegend() {
+ return hideLegend;
+ }
+
+ public void setHideLegend(boolean hideLegend) {
+ this.hideLegend = hideLegend;
+ }
+
public String getChartTitle() {
if(definition != null){
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/graphtype/StackedBarMetricGraphImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/graphtype/StackedBarMetricGraphImpl.java
index 9058ea5..eeb97cf 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/graphtype/StackedBarMetricGraphImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/graphtype/StackedBarMetricGraphImpl.java
@@ -73,7 +73,8 @@ public class StackedBarMetricGraphImpl extends AbstractMetricGraph {
global.@org.rhq.enterprise.gui.coregui.client.inventory.common.graph.AbstractMetricGraph::getButtonBarDateTimeFormat()(),
global.@org.rhq.enterprise.gui.coregui.client.inventory.common.graph.AbstractMetricGraph::getChartSingleValueLabel()(),
global.@org.rhq.enterprise.gui.coregui.client.inventory.common.graph.AbstractMetricGraph::getXAxisTimeFormatHours()(),
- global.@org.rhq.enterprise.gui.coregui.client.inventory.common.graph.AbstractMetricGraph::getXAxisTimeFormatHoursMinutes()()
+ global.@org.rhq.enterprise.gui.coregui.client.inventory.common.graph.AbstractMetricGraph::getXAxisTimeFormatHoursMinutes()(),
+ global.@org.rhq.enterprise.gui.coregui.client.inventory.common.graph.AbstractMetricGraph::isHideLegend()()
);
@@ -217,8 +218,8 @@ public class StackedBarMetricGraphImpl extends AbstractMetricGraph {
.attr("transform", "translate(" + margin.left + "," + (+titleHeight + titleSpace + margin.top) + ")");
legendUnDefined = (typeof min === 'undefined') || (typeof avg === 'undefined') || (typeof peak === 'undefined');
- if (!useSmallCharts() && !legendUnDefined) {
- createMinAvgPeakSidePanel(chartContext.minChartTitle, min, chartContext.avgChartTitle, avg, chartContext.peakChartTitle, peak, chartContext.yAxisUnits);
+ if (!(chartContext.hideLegend && !useSmallCharts())) {
+ createMinAvgPeakSidePanel(chartContext.minChartTitle, min, chartContext.avgChartTitle, avg, chartContext.peakChartTitle, peak, chartContext.yAxisUnits);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/avail/ResourceAvailabilityView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/avail/ResourceAvailabilityView.java
deleted file mode 100644
index 3d1c881..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/avail/ResourceAvailabilityView.java
+++ /dev/null
@@ -1,401 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright 2012, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.avail;
-
-import java.util.ArrayList;
-import java.util.Date;
-
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.data.DSRequest;
-import com.smartgwt.client.data.DSResponse;
-import com.smartgwt.client.data.Record;
-import com.smartgwt.client.data.SortSpecifier;
-import com.smartgwt.client.rpc.RPCResponse;
-import com.smartgwt.client.types.Alignment;
-import com.smartgwt.client.types.ListGridFieldType;
-import com.smartgwt.client.types.SortDirection;
-import com.smartgwt.client.widgets.form.DynamicForm;
-import com.smartgwt.client.widgets.form.fields.FormItem;
-import com.smartgwt.client.widgets.form.fields.StaticTextItem;
-import com.smartgwt.client.widgets.grid.ListGridField;
-import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.layout.Layout;
-
-import org.rhq.core.domain.criteria.AvailabilityCriteria;
-import org.rhq.core.domain.measurement.Availability;
-import org.rhq.core.domain.measurement.MeasurementUnits;
-import org.rhq.core.domain.resource.composite.ResourceAvailabilitySummary;
-import org.rhq.core.domain.resource.composite.ResourceComposite;
-import org.rhq.core.domain.util.PageControl;
-import org.rhq.core.domain.util.PageList;
-import org.rhq.core.domain.util.PageOrdering;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.ImageManager;
-import org.rhq.enterprise.gui.coregui.client.components.table.Table;
-import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
-import org.rhq.enterprise.gui.coregui.client.gwt.AvailabilityGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.util.MeasurementConverterClient;
-import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
-import org.rhq.enterprise.gui.coregui.client.util.enhanced.EnhancedVLayout;
-
-/**
- * This shows the availability history for a resource.
- *
- * @author Jay Shaughnessy
- * @author John Mazzitelli
- * @see org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.table.ResourceMetricAvailabilityView
- */
-@Deprecated
-public class ResourceAvailabilityView extends EnhancedVLayout {
-
- private ResourceComposite resourceComposite;
- private StaticTextItem currentField;
- private StaticTextItem availField;
- private StaticTextItem availTimeField;
- private StaticTextItem downField;
- private StaticTextItem downTimeField;
- private StaticTextItem disabledField;
- private StaticTextItem disabledTimeField;
- private StaticTextItem failureCountField;
- private StaticTextItem disabledCountField;
- private StaticTextItem mtbfField;
- private StaticTextItem mttrField;
- private StaticTextItem unknownField;
- private StaticTextItem currentTimeField;
-
- public ResourceAvailabilityView(ResourceComposite resourceComposite) {
- super();
-
- this.resourceComposite = resourceComposite;
-
- setWidth100();
- setHeight100();
- }
-
- @Override
- protected void onInit() {
- super.onInit();
-
- addMember(createSummaryForm());
- addMember(createListView());
- }
-
- private DynamicForm createSummaryForm() {
- DynamicForm form = new DynamicForm();
- form.setWidth100();
- form.setAutoHeight();
- form.setMargin(10);
- form.setNumCols(4);
-
- // row 1
- currentField = new StaticTextItem("current", MSG.view_resource_monitor_availability_currentStatus());
- currentField.setWrapTitle(false);
- currentField.setColSpan(4);
-
- // row 2
- availField = new StaticTextItem("avail", MSG.view_resource_monitor_availability_availability());
- availField.setWrapTitle(false);
- prepareTooltip(availField, MSG.view_resource_monitor_availability_availability_tooltip());
-
- availTimeField = new StaticTextItem("availTime", MSG.view_resource_monitor_availability_uptime());
- availTimeField.setWrapTitle(false);
- prepareTooltip(availTimeField, MSG.view_resource_monitor_availability_uptime_tooltip());
-
- // row 3
- downField = new StaticTextItem("down", MSG.view_resource_monitor_availability_down());
- downField.setWrapTitle(false);
- prepareTooltip(downField, MSG.view_resource_monitor_availability_down_tooltip());
-
- downTimeField = new StaticTextItem("downTime", MSG.view_resource_monitor_availability_downtime());
- downTimeField.setWrapTitle(false);
- prepareTooltip(downTimeField, MSG.view_resource_monitor_availability_downtime_tooltip());
-
- // row 4
- disabledField = new StaticTextItem("disabled", MSG.view_resource_monitor_availability_disabled());
- disabledField.setWrapTitle(false);
- prepareTooltip(disabledField, MSG.view_resource_monitor_availability_disabled_tooltip());
-
- disabledTimeField = new StaticTextItem("disabledTime", MSG.view_resource_monitor_availability_disabledTime());
- disabledTimeField.setWrapTitle(false);
- prepareTooltip(disabledTimeField, MSG.view_resource_monitor_availability_disabledTime_tooltip());
-
- // row 5
- failureCountField = new StaticTextItem("failureCount", MSG.view_resource_monitor_availability_numFailures());
- failureCountField.setWrapTitle(false);
- prepareTooltip(failureCountField, MSG.view_resource_monitor_availability_numFailures_tooltip());
-
- disabledCountField = new StaticTextItem("disabledCount", MSG.view_resource_monitor_availability_numDisabled());
- disabledCountField.setWrapTitle(false);
- prepareTooltip(disabledCountField, MSG.view_resource_monitor_availability_numDisabled_tooltip());
-
- // row 6
- mtbfField = new StaticTextItem("mtbf", MSG.view_resource_monitor_availability_mtbf());
- mtbfField.setWrapTitle(false);
- prepareTooltip(mtbfField, MSG.view_resource_monitor_availability_mtbf_tooltip());
-
- mttrField = new StaticTextItem("mttr", MSG.view_resource_monitor_availability_mttr());
- mttrField.setWrapTitle(false);
- prepareTooltip(mttrField, MSG.view_resource_monitor_availability_mttr_tooltip());
-
- // row 7
- unknownField = new StaticTextItem("unknown");
- unknownField.setWrapTitle(false);
- unknownField.setColSpan(4);
- unknownField.setShowTitle(false);
-
- // row 8
- currentTimeField = new StaticTextItem("currentTime");
- currentTimeField.setWrapTitle(false);
- currentTimeField.setColSpan(4);
- currentTimeField.setShowTitle(false);
-
- form.setItems(currentField, availField, availTimeField, downField, downTimeField, disabledField,
- disabledTimeField, failureCountField, disabledCountField, mtbfField, mttrField, unknownField,
- currentTimeField);
-
- reloadSummaryData();
-
- return form;
- }
-
- private void reloadSummaryData() {
- GWTServiceLookup.getResourceService().getResourceAvailabilitySummary(resourceComposite.getResource().getId(),
- new AsyncCallback<ResourceAvailabilitySummary>() {
-
- @Override
- public void onSuccess(ResourceAvailabilitySummary result) {
-
- currentField.setValue(MSG.view_resource_monitor_availability_currentStatus_value(result
- .getCurrent().getName(), TimestampCellFormatter.format(result.getLastChange().getTime())));
- availField.setValue(MeasurementConverterClient.format(result.getUpPercentage(),
- MeasurementUnits.PERCENTAGE, true));
- availTimeField.setValue(MeasurementConverterClient.format((double) result.getUpTime(),
- MeasurementUnits.MILLISECONDS, true));
- downField.setValue(MeasurementConverterClient.format(result.getDownPercentage(),
- MeasurementUnits.PERCENTAGE, true));
- downTimeField.setValue(MeasurementConverterClient.format((double) result.getDownTime(),
- MeasurementUnits.MILLISECONDS, true));
- disabledField.setValue(MeasurementConverterClient.format(result.getDisabledPercentage(),
- MeasurementUnits.PERCENTAGE, true));
- disabledTimeField.setValue(MeasurementConverterClient.format((double) result.getDisabledTime(),
- MeasurementUnits.MILLISECONDS, true));
- failureCountField.setValue(result.getFailures());
- disabledCountField.setValue(result.getDisabled());
- mtbfField.setValue(MeasurementConverterClient.format((double) result.getMTBF(),
- MeasurementUnits.MILLISECONDS, true));
- mttrField.setValue(MeasurementConverterClient.format((double) result.getMTTR(),
- MeasurementUnits.MILLISECONDS, true));
-
- if (result.getUnknownTime() > 0L) {
- unknownField.setValue(MSG.view_resource_monitor_availability_unknown(MeasurementConverterClient
- .format((double) result.getUnknownTime(), MeasurementUnits.MILLISECONDS, true)));
- } else {
- unknownField.setValue("");
- }
-
- currentTimeField.setValue(MSG.view_resource_monitor_availability_currentAsOf(TimestampCellFormatter
- .format(result.getCurrentTime())));
- }
-
- @Override
- public void onFailure(Throwable caught) {
- currentField.setValue(MSG.common_label_error());
- CoreGUI.getErrorHandler()
- .handleError(MSG.view_resource_monitor_availability_summaryError(), caught);
- }
- });
- }
-
- private void prepareTooltip(FormItem item, String tooltip) {
- item.setHoverWidth(400);
- item.setPrompt(tooltip);
- }
-
- private Table<ListView.DS> createListView() {
- ListView listView = new ListView(resourceComposite.getResource().getId());
- return listView;
- }
-
- private class ListView extends Table<ListView.DS> {
-
- private DS dataSource;
- private int resourceId;
-
- public ListView(int resourceId) {
- super(null, new SortSpecifier[] { new SortSpecifier("startTime", SortDirection.DESCENDING) });
-
- this.resourceId = resourceId;
-
- setDataSource(getDataSource());
- }
-
- @Override
- public DS getDataSource() {
- if (null == this.dataSource) {
- this.dataSource = new DS(resourceId);
- }
- return this.dataSource;
- }
-
- @Override
- public void refresh() {
- super.refresh();
- reloadSummaryData();
- }
-
- @Override
- protected void configureTableContents(Layout contents) {
- super.configureTableContents(contents);
- setAutoHeight();
- }
-
- @Override
- protected void configureTable() {
- ArrayList<ListGridField> dataSourceFields = getDataSource().getListGridFields();
- getListGrid().setFields(dataSourceFields.toArray(new ListGridField[dataSourceFields.size()]));
-
- super.configureTable();
- }
-
- private class DS extends RPCDataSource<Availability, AvailabilityCriteria> {
-
- public static final String ATTR_ID = "id";
- public static final String ATTR_AVAILABILITY = "availabilityType";
- public static final String ATTR_START_TIME = "startTime";
- public static final String ATTR_END_TIME = "endTime";
-
- public static final String ATTR_DURATION = "duration";
-
- private AvailabilityGWTServiceAsync availService = GWTServiceLookup.getAvailabilityService();
- private int resourceId;
-
- public DS(int resourceId) {
- super();
- this.resourceId = resourceId;
- addDataSourceFields();
- }
-
- /**
- * The view that contains the list grid which will display this datasource's data will call this
- * method to get the field information which is used to control the display of the data.
- *
- * @return list grid fields used to display the datasource data
- */
- public ArrayList<ListGridField> getListGridFields() {
- ArrayList<ListGridField> fields = new ArrayList<ListGridField>(6);
-
- ListGridField startTimeField = new ListGridField(ATTR_START_TIME, MSG.common_title_start());
- startTimeField.setCellFormatter(new TimestampCellFormatter());
- startTimeField.setShowHover(true);
- startTimeField.setHoverCustomizer(TimestampCellFormatter.getHoverCustomizer(ATTR_START_TIME));
- startTimeField.setCanSortClientOnly(true);
- fields.add(startTimeField);
-
- ListGridField endTimeField = new ListGridField(ATTR_END_TIME, MSG.common_title_end());
- endTimeField.setCellFormatter(new TimestampCellFormatter());
- endTimeField.setShowHover(true);
- endTimeField.setHoverCustomizer(TimestampCellFormatter.getHoverCustomizer(ATTR_END_TIME));
- endTimeField.setCanSortClientOnly(true);
- fields.add(endTimeField);
-
- ListGridField durationField = new ListGridField(ATTR_DURATION, MSG.common_title_duration());
- durationField.setAlign(Alignment.RIGHT);
- fields.add(durationField);
-
- ListGridField availabilityField = new ListGridField(ATTR_AVAILABILITY, MSG.common_title_availability());
- availabilityField.setType(ListGridFieldType.IMAGE);
- availabilityField.setAlign(Alignment.CENTER);
- fields.add(availabilityField);
-
- return fields;
- }
-
- @Override
- protected AvailabilityCriteria getFetchCriteria(DSRequest request) {
- AvailabilityCriteria c = new AvailabilityCriteria();
- c.addFilterResourceId(resourceId);
- c.addFilterInitialAvailability(false);
-
- // This code is unlikely to be necessary as the encompassing view should be using an initial
- // sort specifier. But just in case, make sure we set the initial sort. Note that we have to
- // manipulate the PageControl directly as per the restrictions on getFetchCriteria() (see jdoc).
- PageControl pageControl = getPageControl(request);
- if (pageControl.getOrderingFields().isEmpty()) {
- pageControl.initDefaultOrderingField("startTime", PageOrdering.DESC);
- }
-
- return c;
- }
-
- @Override
- protected void executeFetch(final DSRequest request, final DSResponse response,
- AvailabilityCriteria criteria) {
-
- this.availService.findAvailabilityByCriteria(criteria, new AsyncCallback<PageList<Availability>>() {
- public void onFailure(Throwable caught) {
- // TODO fix message
- CoreGUI.getErrorHandler().handleError(MSG.common_label_error(), caught);
- response.setStatus(RPCResponse.STATUS_FAILURE);
- processResponse(request.getRequestId(), response);
- }
-
- public void onSuccess(final PageList<Availability> result) {
- response.setData(buildRecords(result));
- response.setTotalRows(result.size());
- processResponse(request.getRequestId(), response);
- }
- });
- }
-
- @Override
- public Availability copyValues(Record from) {
- return null;
- }
-
- @Override
- public ListGridRecord copyValues(Availability from) {
- ListGridRecord record = new ListGridRecord();
-
- record.setAttribute(ATTR_ID, from.getId());
- record.setAttribute(ATTR_AVAILABILITY,
- ImageManager.getAvailabilityIconFromAvailType(from.getAvailabilityType()));
- record.setAttribute(ATTR_START_TIME, new Date(from.getStartTime()));
- if (null != from.getEndTime()) {
- record.setAttribute(ATTR_END_TIME, new Date(from.getEndTime()));
- long duration = from.getEndTime() - from.getStartTime();
- record.setAttribute(ATTR_DURATION,
- MeasurementConverterClient.format((double) duration, MeasurementUnits.MILLISECONDS, true));
-
- } else {
- record.setAttribute(ATTR_END_TIME, MSG.common_label_none2());
- long duration = System.currentTimeMillis() - from.getStartTime();
- record.setAttribute(ATTR_DURATION,
- MeasurementConverterClient.format((double) duration, MeasurementUnits.MILLISECONDS, true));
-
- }
-
- return record;
- }
- }
- }
-
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MeasurementTableView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MeasurementTableView.java
deleted file mode 100644
index dd70b93..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MeasurementTableView.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2011 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.table;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.TreeSet;
-
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.types.SelectionStyle;
-import com.smartgwt.client.widgets.Window;
-import com.smartgwt.client.widgets.events.CloseClickEvent;
-import com.smartgwt.client.widgets.events.CloseClickHandler;
-import com.smartgwt.client.widgets.grid.ListGrid;
-import com.smartgwt.client.widgets.grid.ListGridField;
-import com.smartgwt.client.widgets.grid.ListGridRecord;
-
-import org.rhq.core.domain.criteria.ResourceCriteria;
-import org.rhq.core.domain.measurement.MeasurementData;
-import org.rhq.core.domain.measurement.MeasurementUnits;
-import org.rhq.core.domain.resource.composite.ResourceComposite;
-import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.components.measurement.UserPreferencesMeasurementRangeEditor;
-import org.rhq.enterprise.gui.coregui.client.components.table.Table;
-import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.inventory.InventoryView;
-import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.summary.AbstractActivityView.ChartViewWindow;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.D3GraphListView;
-import org.rhq.enterprise.gui.coregui.client.util.MeasurementConverterClient;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-
-/**
- * Views a resource's measurements in a tabular view.
- *
- * @author John Mazzitelli
- */
-@Deprecated
-public class MeasurementTableView extends Table<MetricsTableDataSource> {
-
- private final int resourceId;
-
- public MeasurementTableView(int resourceId) {
- super();
- this.resourceId = resourceId;
- setDataSource(new MetricsTableDataSource(resourceId));
- }
-
- protected void configureTable() {
- ArrayList<ListGridField> fields = getDataSource().getListGridFields();
- setListGridFields(fields.toArray(new ListGridField[0]));
- addExtraWidget(new UserPreferencesMeasurementRangeEditor(), true);
- addTableAction(MSG.view_measureTable_getLive(), new TableAction() {
- @Override
- public boolean isEnabled(ListGridRecord[] selection) {
- return selection != null && selection.length > 0;
- }
-
- @Override
- public void executeAction(ListGridRecord[] selection, Object actionValue) {
- if (selection == null || selection.length == 0) {
- return;
- }
- // keyed on metric name - string[0] is the metric label, [1] is the units
- final HashMap<String, String[]> scheduleNamesAndUnits = new HashMap<String, String[]>();
- int[] definitionIds = new int[selection.length];
- int i = 0;
- for (ListGridRecord record : selection) {
- Integer defId = record.getAttributeAsInt(MetricsTableDataSource.FIELD_METRIC_DEF_ID);
- definitionIds[i++] = defId.intValue();
-
- String name = record.getAttribute(MetricsTableDataSource.FIELD_METRIC_NAME);
- String label = record.getAttribute(MetricsTableDataSource.FIELD_METRIC_LABEL);
- String units = record.getAttribute(MetricsTableDataSource.FIELD_METRIC_UNITS);
- if (units == null || units.length() < 1) {
- units = MeasurementUnits.NONE.name();
- }
-
- scheduleNamesAndUnits.put(name, new String[] { label, units });
- }
-
- // actually go out and ask the agents for the data
- GWTServiceLookup.getMeasurementDataService(60000).findLiveData(resourceId, definitionIds,
- new AsyncCallback<Set<MeasurementData>>() {
- @Override
- public void onSuccess(Set<MeasurementData> result) {
- if (result == null) {
- result = new HashSet<MeasurementData>(0);
- }
- ArrayList<ListGridRecord> records = new ArrayList<ListGridRecord>(result.size());
- for (MeasurementData data : result) {
- String[] nameAndUnits = scheduleNamesAndUnits.get(data.getName());
- if (nameAndUnits != null) {
- double doubleValue;
- if (data.getValue() instanceof Number) {
- doubleValue = ((Number) data.getValue()).doubleValue();
- } else {
- doubleValue = Double.parseDouble(data.getValue().toString());
- }
- String value = MeasurementConverterClient.formatToSignificantPrecision(
- new double[] { doubleValue }, MeasurementUnits.valueOf(nameAndUnits[1]), true)[0];
-
- ListGridRecord record = new ListGridRecord();
- record.setAttribute("name", nameAndUnits[0]);
- record.setAttribute("value", value);
- records.add(record);
- }
- }
- Collections.sort(records, new Comparator<ListGridRecord>() {
- public int compare(ListGridRecord o1, ListGridRecord o2) {
- return o1.getAttribute("name").compareTo(o2.getAttribute("name"));
- }
- });
- showLiveData(records);
- }
-
- @Override
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_measureTable_getLive_failure(), caught);
- }
- });
- }
- });
-
-
- addTableAction(MSG.view_measureTable_chartMetricValues(), new TableAction() {
- @Override
- public boolean isEnabled(ListGridRecord[] selection) {
- return selection != null && selection.length > 0;
- }
-
- @Override
- public void executeAction(ListGridRecord[] selection, Object actionValue) {
- if (selection == null || selection.length == 0) {
- return;
- }
- final TreeSet<Integer> definitionIds = new TreeSet<Integer>();
- for (ListGridRecord record : selection) {
- Integer defId = record.getAttributeAsInt(MetricsTableDataSource.FIELD_METRIC_DEF_ID);
- definitionIds.add(defId);
- }
-
- ResourceCriteria criteria = new ResourceCriteria();
- criteria.addFilterId(resourceId);
- criteria.fetchSchedules(true);
- GWTServiceLookup.getResourceService().findResourceCompositesByCriteria(criteria,
- new AsyncCallback<PageList<ResourceComposite>>() {
-
- @Override
- public void onFailure(Throwable caught) {
- CoreGUI.getMessageCenter().notify(
- new Message(MSG.view_inventory_resource_loadFailed(String.valueOf(resourceId)),
- Message.Severity.Warning));
-
- CoreGUI.goToView(InventoryView.VIEW_ID.getName());
- }
-
- @Override
- public void onSuccess(PageList<ResourceComposite> result) {
- if (result.isEmpty()) {
- onFailure(new Exception(MSG.view_inventory_resource_loadFailed(String
- .valueOf(resourceId))));
- } else {
- final ResourceComposite resourceComposite = result.get(0);
-
- ChartViewWindow window = new ChartViewWindow("");
- final D3GraphListView graphListView = D3GraphListView.createMultipleGraphs(
- resourceComposite.getResource(), definitionIds, true);
-
- window.addItem(graphListView);
- window.show();
- refreshTableInfo();
-
- }
- }
- });
-
- }
- });
- }
-
- private void showLiveData(ArrayList<ListGridRecord> records) {
- final Window liveDataWindow = new Window();
- liveDataWindow.setTitle(MSG.view_measureTable_live_title());
- liveDataWindow.setShowModalMask(true);
- liveDataWindow.setShowMinimizeButton(false);
- liveDataWindow.setShowMaximizeButton(true);
- liveDataWindow.setShowCloseButton(true);
- liveDataWindow.setShowResizer(true);
- liveDataWindow.setCanDragResize(true);
- liveDataWindow.setDismissOnEscape(true);
- liveDataWindow.setIsModal(true);
- liveDataWindow.setWidth(700);
- liveDataWindow.setHeight(425);
- liveDataWindow.setAutoCenter(true);
- liveDataWindow.centerInPage();
- liveDataWindow.addCloseClickHandler(new CloseClickHandler() {
- @Override
- public void onCloseClick(CloseClickEvent event) {
- liveDataWindow.destroy();
- refreshTableInfo();
- }
- });
-
- ListGrid liveDataGrid = new ListGrid();
- liveDataGrid.setShowAllRecords(true);
- liveDataGrid.setData(records.toArray(new ListGridRecord[records.size()]));
- liveDataGrid.setSelectionType(SelectionStyle.NONE);
- ListGridField name = new ListGridField("name", MSG.common_title_metric());
- ListGridField value = new ListGridField("value", MSG.common_title_value());
- liveDataGrid.setFields(name, value);
-
- liveDataWindow.addItem(liveDataGrid);
- liveDataWindow.show();
- }
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MetricsResourceView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MetricsResourceView.java
index 5784ed4..bcea825 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MetricsResourceView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MetricsResourceView.java
@@ -27,7 +27,6 @@ import com.smartgwt.client.types.VerticalAlignment;
import com.smartgwt.client.widgets.Img;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
-import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.common.EntityContext;
import org.rhq.core.domain.measurement.Availability;
@@ -53,14 +52,16 @@ public class MetricsResourceView extends AbstractD3GraphListView {
private static final String COLLAPSED_TOOLTIP = MSG.chart_metrics_collapse_tooltip();
private static final String EXPANDED_TOOLTIP = MSG.chart_metrics_expand_tooltip();
- private Resource resource;
- private VLayout vLayout;
+ private final Resource resource;
private Img expandCollapseArrow;
- private MetricsTableView metricsTableView;
- private ResourceMetricAvailabilityView availabilityDetails;
+ private final MetricsTableView metricsTableView;
+ private final ResourceMetricAvailabilityView availabilityDetails;
public MetricsResourceView(Resource resource) {
super();
+ setOverflow(Overflow.AUTO);
+ setWidth100();
+ setHeight100();
this.resource = resource;
metricsTableView = new MetricsTableView(resource, this);
availabilityDetails = new ResourceMetricAvailabilityView(resource);
@@ -87,12 +88,8 @@ public class MetricsResourceView extends AbstractD3GraphListView {
Log.debug("MetricResourceView.onDraw() for: " + resource.getName() + " id: " + resource.getId());
destroyMembers();
- vLayout = new VLayout();
- vLayout.setOverflow(Overflow.AUTO);
- vLayout.setWidth100();
- vLayout.setHeight100();
- vLayout.addMember(buttonBarDateTimeRangeEditor);
+ addMember(buttonBarDateTimeRangeEditor);
availabilityGraph = new AvailabilityD3GraphView<AvailabilityOverUnderGraphType>(
new AvailabilityOverUnderGraphType(resource.getId()));
@@ -126,19 +123,17 @@ public class MetricsResourceView extends AbstractD3GraphListView {
expandCollapseHLayout.addMember(expandCollapseArrow);
expandCollapseHLayout.addMember(availabilityGraph);
- vLayout.addMember(expandCollapseHLayout);
+ addMember(expandCollapseHLayout);
+
availabilityDetails.hide();
- vLayout.addMember(availabilityDetails);
+ addMember(availabilityDetails);
metricsTableView.setHeight100();
- vLayout.addMember(metricsTableView);
+ addMember(metricsTableView);
- addMember(vLayout);
- if (resource != null) {
- queryAvailability(EntityContext.forResource(resource.getId()), buttonBarDateTimeRangeEditor.getStartTime(),
+ queryAvailability(EntityContext.forResource(resource.getId()), buttonBarDateTimeRangeEditor.getStartTime(),
buttonBarDateTimeRangeEditor.getEndTime(), null);
- }
}
@Override
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MetricsTableView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MetricsTableView.java
index 25e430b..77aeda6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MetricsTableView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MetricsTableView.java
@@ -272,8 +272,6 @@ public class MetricsTableView extends Table<MetricsViewDataSource> implements Re
addRecordExpandHandler(new RecordExpandHandler() {
@Override
public void onRecordExpand(RecordExpandEvent recordExpandEvent) {
- Log.debug("Record Expanded: "
- + recordExpandEvent.getRecord().getAttribute(MetricsViewDataSource.FIELD_METRIC_LABEL));
redrawGraphs();
}
@@ -328,6 +326,7 @@ public class MetricsTableView extends Table<MetricsViewDataSource> implements Re
MetricGraphData metricGraphData = MetricGraphData.createForResource(resourceId,
resource.getName(), measurementDefinition, measurementList, null);
+ metricGraphData.setHideLegend(true);
StackedBarMetricGraphImpl graph = GWT.create(StackedBarMetricGraphImpl.class);
graph.setMetricGraphData(metricGraphData);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MetricsViewDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MetricsViewDataSource.java
index a03ad1a..431e076 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MetricsViewDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MetricsViewDataSource.java
@@ -45,7 +45,7 @@ import org.rhq.enterprise.gui.coregui.client.util.preferences.MeasurementUserPre
*/
public class MetricsViewDataSource extends RPCDataSource<MetricDisplaySummary, Criteria> {
- public static final int NUMBER_OF_METRIC_POINTS = 60;
+ private static final int NUMBER_OF_METRIC_POINTS = 60;
public static final String FIELD_SPARKLINE = "sparkline";
public static final String FIELD_METRIC_LABEL = "label";
public static final String FIELD_ALERT_COUNT = "alertCount";
@@ -58,11 +58,11 @@ public class MetricsViewDataSource extends RPCDataSource<MetricDisplaySummary, C
public static final String FIELD_METRIC_UNITS = "units";
public static final String FIELD_METRIC_NAME = "name";
public static final String FIELD_RESOURCE_ID = "resourceId";
- final private Resource resource;
+ private final Resource resource;
private List<MetricDisplaySummary> metricDisplaySummaries;
private List<List<MeasurementDataNumericHighLowComposite>> metricsDataList;
private int[] definitionArrayIds;
- private MeasurementUserPreferences measurementUserPrefs;
+ private final MeasurementUserPreferences measurementUserPrefs;
public MetricsViewDataSource(Resource resource) {
this.resource = resource;
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/js/rhq.js b/modules/enterprise/gui/coregui/src/main/webapp/js/rhq.js
index 40c7ca8..ef65e69 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/js/rhq.js
+++ b/modules/enterprise/gui/coregui/src/main/webapp/js/rhq.js
@@ -38,9 +38,10 @@ if (!window.console.log) window.console.log = function () {
* @param singleValueLabel
* @param chartXaxisTimeFormatHours
* @param chartXaxisTimeFormatHoursMinutes
+ * @param showLegend
* @constructor
*/
-var ChartContext = function (chartId, chartHeight, metricsData, xAxisLabel, chartTitle, yAxisUnits, minChartTitle, avgChartTitle, peakChartTitle, dateLabel, timeLabel, downLabel, unknownLabel, noDataLabel, hoverStartLabel, hoverEndLabel, hoverPeriodLabel, hoverBarLabel, chartHoverTimeFormat, chartHoverDateFormat, isPortalGraph, portalId, buttonBarDateTimeFormat, singleValueLabel, chartXaxisTimeFormatHours, chartXaxisTimeFormatHoursMinutes) {
+var ChartContext = function (chartId, chartHeight, metricsData, xAxisLabel, chartTitle, yAxisUnits, minChartTitle, avgChartTitle, peakChartTitle, dateLabel, timeLabel, downLabel, unknownLabel, noDataLabel, hoverStartLabel, hoverEndLabel, hoverPeriodLabel, hoverBarLabel, chartHoverTimeFormat, chartHoverDateFormat, isPortalGraph, portalId, buttonBarDateTimeFormat, singleValueLabel, chartXaxisTimeFormatHours, chartXaxisTimeFormatHoursMinutes, hideLegend) {
"use strict";
if (!(this instanceof ChartContext)) {
throw new Error("ChartContext function cannot be called as a function.")
@@ -78,6 +79,7 @@ var ChartContext = function (chartId, chartHeight, metricsData, xAxisLabel, char
this.buttonBarDateTimeFormat = buttonBarDateTimeFormat;
this.chartXaxisTimeFormatHours = chartXaxisTimeFormatHours;
this.chartXaxisTimeFormatHoursMinutes = chartXaxisTimeFormatHoursMinutes;
+ this.hideLegend = hideLegend;
},
/**
commit 87b3c824722d38276a1d1399a14bbf4d208940a1
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Thu Jul 18 13:14:02 2013 -0700
Remove unused chart types - LineMetricGraph and AvailabilityLineGraphType
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/graphtype/AvailabilityLineGraphType.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/graphtype/AvailabilityLineGraphType.java
deleted file mode 100644
index 34ca60b..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/graphtype/AvailabilityLineGraphType.java
+++ /dev/null
@@ -1,311 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2012 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.inventory.common.graph.graphtype;
-
-import java.util.Date;
-import java.util.List;
-
-import org.rhq.core.domain.measurement.Availability;
-import org.rhq.core.domain.measurement.MeasurementUnits;
-import org.rhq.core.domain.resource.group.composite.ResourceGroupAvailability;
-import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.Messages;
-import org.rhq.enterprise.gui.coregui.client.inventory.common.graph.AvailabilityGraphType;
-import org.rhq.enterprise.gui.coregui.client.util.Log;
-import org.rhq.enterprise.gui.coregui.client.util.MeasurementConverterClient;
-
-/**
- * This is now old and for demonstration purposes only.
- * Contains the javascript chart definition for an implementation of the d3 availability chart. This implementation is
- * just a line that changes color based on availability type: up=green, down=red, orange=disabled, unknown=grey,
- * empty=grey, warn=yellow. This version of the availability graph shows continuous intervals.
- * @deprecated
- * @see AvailabilityOverUnderGraphType
- *
- * @author Mike Thompson
- */
-public class AvailabilityLineGraphType implements AvailabilityGraphType {
-
- private static Messages MSG = CoreGUI.getMessages();
- private List<Availability> availabilityList;
- private List<ResourceGroupAvailability> groupAvailabilityList;
- private Integer entityId;
-
- /**
- * General constructor for stacked bar graph when you have all the data needed to produce the graph. (This is true
- * for all cases but the dashboard portlet).
- */
- public AvailabilityLineGraphType(Integer entityId) {
- this.entityId = entityId;
- }
-
- public void setAvailabilityList(List<Availability> availabilityList) {
- this.availabilityList = availabilityList;
- }
-
- public void setGroupAvailabilityList(List<ResourceGroupAvailability> groupAvailabilityList) {
- this.groupAvailabilityList = groupAvailabilityList;
- }
-
- public String getAvailabilityJson() {
- StringBuilder sb = new StringBuilder("[");
- if (null != availabilityList) {
- // loop through the avail intervals
- for (Availability availability : availabilityList) {
- sb.append("{ \"availType\":\"" + availability.getAvailabilityType() + "\", ");
- sb.append(" \"availTypeMessage\":\"" + availability.getAvailabilityType()+ "\", ");
- sb.append(" \"availStart\":" + availability.getStartTime() + ", ");
- // last record will be null
- long endTime = availability.getEndTime() != null ? availability.getEndTime() : (new Date()).getTime();
- sb.append(" \"availEnd\":" + endTime + ", ");
-
- long availDuration = endTime - availability.getStartTime();
- String availDurationString = MeasurementConverterClient.format((double) availDuration,
- MeasurementUnits.MILLISECONDS, true);
- sb.append(" \"availDuration\": \"" + availDurationString + "\" },");
-
- }
- sb.setLength(sb.length() - 1);
-
- } else if (null != groupAvailabilityList) {
- // loop through the group avail down intervals
- for (ResourceGroupAvailability groupAvailability : groupAvailabilityList) {
- // allows substitution for situations like WARN=MIXED for easier terminology
- String availabilityTypeMessage = (groupAvailability.getGroupAvailabilityType().equals(ResourceGroupComposite.GroupAvailabilityType.WARN))
- ? MSG.chart_hover_availability_type_warn() : groupAvailability.getGroupAvailabilityType().name();
-
- sb.append("{ \"availType\":\"" + groupAvailability.getGroupAvailabilityType() + "\", ");
- sb.append(" \"availTypeMessage\":\"" + availabilityTypeMessage + "\", ");
- sb.append(" \"availStart\":" + groupAvailability.getStartTime() + ", ");
- // last record will be null
- long endTime = groupAvailability.getEndTime() != null ? groupAvailability.getEndTime() : (new Date())
- .getTime();
- sb.append(" \"availEnd\":" + endTime + ", ");
-
- long availDuration = endTime - groupAvailability.getStartTime();
- String availDurationString = MeasurementConverterClient.format((double) availDuration,
- MeasurementUnits.MILLISECONDS, true);
- sb.append(" \"availDuration\": \"" + availDurationString + "\" },");
-
- }
- sb.setLength(sb.length() - 1);
- }
-
- sb.append("]");
- Log.debug(sb.toString());
- return sb.toString();
- }
-
- /**
- * The magic JSNI to draw the charts with d3.
- */
- public native void drawJsniChart() /*-{
- console.log("Draw Availability chart");
-
- var global = this,
- // tidy up all of our interactions with java (via JSNI) thru AvailChartContext class
- // NOTE: rhq.js has the javascript object constructors in it.
- availChartContext = new $wnd.AvailChartContext(global.@org.rhq.enterprise.gui.coregui.client.inventory.common.graph.graphtype.AvailabilityLineGraphType::getChartId()(),
- global.@org.rhq.enterprise.gui.coregui.client.inventory.common.graph.graphtype.AvailabilityLineGraphType::getAvailabilityJson()(),
- global.@org.rhq.enterprise.gui.coregui.client.inventory.common.graph.graphtype.AvailabilityLineGraphType::getChartDateLabel()(),
- global.@org.rhq.enterprise.gui.coregui.client.inventory.common.graph.graphtype.AvailabilityLineGraphType::getChartTimeLabel()(),
- global.@org.rhq.enterprise.gui.coregui.client.inventory.common.graph.graphtype.AvailabilityLineGraphType::getChartHoverStartLabel()(),
- global.@org.rhq.enterprise.gui.coregui.client.inventory.common.graph.graphtype.AvailabilityLineGraphType::getChartHoverEndLabel()(),
- global.@org.rhq.enterprise.gui.coregui.client.inventory.common.graph.graphtype.AvailabilityLineGraphType::getChartHoverBarLabel()(),
- global.@org.rhq.enterprise.gui.coregui.client.inventory.common.graph.graphtype.AvailabilityLineGraphType::getChartHoverAvailabilityLabel()(),
- global.@org.rhq.enterprise.gui.coregui.client.inventory.common.graph.graphtype.AvailabilityLineGraphType::getChartHoverTimeFormat()(),
- global.@org.rhq.enterprise.gui.coregui.client.inventory.common.graph.graphtype.AvailabilityLineGraphType::getChartHoverDateFormat()()
- );
-
-
- var availabilityGraph = function () {
- "use strict";
- // privates
-
- var margin = {top: 5, right: 5, bottom: 5, left: 40},
- barOffset = 10,
- width = 750 - margin.left - margin.right + barOffset,
- height = 20 - margin.top - margin.bottom,
- pixelsOffHeight = 0,
- svg;
-
-
- function drawBars(availChartContext) {
- var xAxisMin = $wnd.d3.min(availChartContext.data, function (d) {
- return +d.availStart;
- }),
- xAxisMax = $wnd.d3.max(availChartContext.data, function (d) {
- return +d.availEnd;
- }),
-
- timeScale = $wnd.d3.time.scale()
- .range([0, width])
- .domain([xAxisMin, xAxisMax]),
-
- yScale = $wnd.d3.scale.linear()
- .clamp(true)
- .rangeRound([height, 0])
- .domain([0, 4]),
-
- svg = $wnd.d3.select(availChartContext.chartSelection).append("g")
- .attr("width", width + margin.left + margin.right)
- .attr("height", height + margin.top + margin.bottom)
- .attr("transform", "translate(" + margin.left + "," + margin.top + ")");
-
-
- // The gray bars at the bottom leading up
- svg.selectAll("rect.availBars")
- .data(availChartContext.data)
- .enter().append("rect")
- .attr("class", "availBars")
- .attr("x", function (d) {
- return timeScale(+d.availStart);
- })
- .attr("y", function (d) {
- return yScale(0);
- })
- .attr("height", function (d) {
- return height - yScale(4) - pixelsOffHeight;
- })
- .attr("width", function (d) {
- return timeScale(+d.availEnd) - timeScale(+d.availStart);
- })
-
- .attr("opacity", ".9")
- .attr("fill", function (d) {
- if (d.availType === 'DOWN') {
- return "#FF1919"; // red
- }
- else if (d.availType === 'DISABLED') {
- return "#FF9933"; // orange
- }
- else if (d.availType === 'UNKNOWN') {
- return "#CCC"; // gray
- }
- else if (d.availType === 'UP') {
- return "#198C19"; // green
- }
- else if (d.availType === 'WARN') {
- return "#FFFF00"; // yellow
- }
- else if (d.availType === 'EMPTY') {
- return "#CCC"; // gray
- }
- else {
- // should not ever happen, but...
- console.warn("AvailabilityType not valid.");
- return "#000"; //black
- }
- });
- }
-
- function createHovers() {
- $wnd.jQuery('svg rect.availBars').tipsy({
- gravity: 'n',
- html: true,
- trigger: 'hover',
- title: function () {
- var d = this.__data__;
- return formatHovers(d);
- },
- show: function (e, el) {
- el.css({ 'z-index': '990000'})
- }
- });
- }
-
- function formatHovers(d) {
- var hoverString,
- timeFormatter = $wnd.d3.time.format(availChartContext.chartHoverTimeFormat),
- dateFormatter = $wnd.d3.time.format(availChartContext.chartHoverDateFormat),
- availStart = new Date(+d.availStart),
- availEnd = new Date(+d.availEnd);
-
- hoverString =
- '<div class="chartHoverEnclosingDiv">' +
- '<div class="chartHoverAlignRight"><span >' + availChartContext.hoverBarAvailabilityLabel + ': </span><span style="width:50px;">' + d.availTypeMessage + '</span></div>' +
- '<div class="chartHoverAlignRight"><span >' + availChartContext.hoverStartLabel + ': </span><span style="width:50px;">' + timeFormatter(availStart) + '</span></div>' +
- '<div class="chartHoverAlignRight"><span >' + ' </span><span style="width:50px;">' + dateFormatter(availStart) + '</span></div>' +
- '<div class="chartHoverAlignRight"><span >' + availChartContext.hoverEndLabel + ': </span><span style="width:50px;">' + timeFormatter(availEnd) + '</span></div>' +
- '<div class="chartHoverAlignRight"><span >' + ' </span><span style="width:50px;">' + dateFormatter(availEnd) + '</span></div>' +
- '<div class="chartHoverAlignRight"><span >' + availChartContext.hoverBarLabel + ': </span><span style="width:50px;">' + d.availDuration + '</span></div>' +
- '</div>';
- return hoverString;
-
- }
-
- return {
- // Public API
- draw: function (chartContext) {
- "use strict";
- console.info("AvailabilityChart");
- //console.time("availabilityChart");
-
- drawBars(availChartContext);
- createHovers();
- //console.timeEnd("availabilityChart");
- }
- }; // end public closure
-
-
- }();
-
- if (availChartContext.data !== undefined && availChartContext.data.length > 0) {
- availabilityGraph.draw(availChartContext);
- }
-
- }-*/;
-
- public String getChartId() {
- return String.valueOf(entityId);
- }
-
- public String getChartTimeLabel() {
- return MSG.chart_time_label();
- }
-
- public String getChartDateLabel() {
- return MSG.chart_date_label();
- }
-
- public String getChartHoverAvailabilityLabel() {
- return MSG.chart_hover_availability_label();
- }
-
- public String getChartHoverStartLabel() {
- return MSG.chart_hover_start_label();
- }
-
- public String getChartHoverEndLabel() {
- return MSG.chart_hover_end_label();
- }
-
- public String getChartHoverBarLabel() {
- return MSG.chart_hover_bar_label();
- }
-
- public String getChartHoverTimeFormat() {
- return MSG.chart_hover_time_format();
- }
-
- public String getChartHoverDateFormat() {
- return MSG.chart_hover_date_format();
- }
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/graphtype/LineMetricGraph.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/graphtype/LineMetricGraph.java
deleted file mode 100644
index 079b2ab..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/graphtype/LineMetricGraph.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2012 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.inventory.common.graph.graphtype;
-
-import org.rhq.enterprise.gui.coregui.client.inventory.common.graph.AbstractMetricGraph;
-import org.rhq.enterprise.gui.coregui.client.inventory.common.graph.MetricGraphData;
-
-/**
- * Contains the javascript chart definition for a d3 Line graph chart.
- * NOTE: this class isn't used just provided as an example as how to create
- * other graph types.
- *
- * @author Mike Thompson
- */
-public final class LineMetricGraph extends AbstractMetricGraph {
-
- /**
- * General constructor for stacked bar graph when you have all the data needed to
- * produce the graph. (This is true for all cases but the dashboard portlet).
- */
- public LineMetricGraph(MetricGraphData metricGraphData) {
- setMetricGraphData(metricGraphData);
- }
-
- /**
- * The magic JSNI to draw the charts with d3.
- */
- public native void drawJsniChart() /*-{
- console.log("Draw Metric Line jsni chart");
- var global = this,
- chartId = global.@org.rhq.enterprise.gui.coregui.client.inventory.common.graph.MetricGraphData::getChartId()(),
- chartHandle = "#rChart-"+chartId,
- chartSelection = chartHandle + " svg",
- json = $wnd.jQuery.parseJSON(global.@org.rhq.enterprise.gui.coregui.client.inventory.common.graph.MetricGraphData::getJsonMetrics()()),
- yAxisLabel = global.@org.rhq.enterprise.gui.coregui.client.inventory.common.graph.MetricGraphData::getChartTitle()(),
- yAxisUnits = global.@org.rhq.enterprise.gui.coregui.client.inventory.common.graph.MetricGraphData::getYAxisUnits()(),
- xAxisLabel = global.@org.rhq.enterprise.gui.coregui.client.inventory.common.graph.MetricGraphData::getXAxisTitle()();
-
- console.log("chart id: "+chartSelection );
- console.log(global.@org.rhq.enterprise.gui.coregui.client.inventory.common.graph.MetricGraphData::getJsonMetrics()());
-
-
- function draw(data){
- "use strict";
-
- var margin = {top: 10, right: 5, bottom: 30, left: 70},
- width = 400 - margin.left - margin.right,
- height = 150 - margin.top - margin.bottom;
-
- var timeScale = $wnd.d3.time.scale()
- .range([0, width])
- .domain($wnd.d3.extent(data, function(d) { return d.x; }));
-
- var yScale = $wnd.d3.scale.linear()
- .rangeRound([height, 0])
- .domain([$wnd.d3.min(data.map(function(x) {return x.low;})), $wnd.d3.max(data.map(function(x){return x.high;}))]);
-
- var xAxis = $wnd.d3.svg.axis()
- .scale(timeScale)
- .ticks(5)
- .orient("bottom");
-
- var yAxis = $wnd.d3.svg.axis()
- .scale(yScale)
- .ticks(5)
- .orient("left");
-
- var interpolation = "basis";
-
- var line = $wnd.d3.svg.line()
- .interpolate(interpolation)
- .x(function(d) { return timeScale(d.x); })
- .y(function(d) { return yScale(+d.y); });
-
- var highLine = $wnd.d3.svg.line()
- .interpolate(interpolation)
- .x(function(d) { return timeScale(d.x); })
- .y(function(d) { return yScale(+d.high); });
-
- var lowLine = $wnd.d3.svg.line()
- .interpolate(interpolation)
- .x(function(d) { return timeScale(d.x); })
- .y(function(d) { return yScale(+d.low); });
-
- var svg = $wnd.d3.select(chartSelection).append("g")
- .attr("width", width + margin.left + margin.right)
- .attr("height", height + margin.top + margin.bottom)
- .attr("transform", "translate(" + margin.left + "," + margin.top + ")");
-
- svg.append("g")
- .attr("class", "x axis")
- .attr("transform", "translate(0," + height + ")")
- .call(xAxis);
-
-
- svg.append("g")
- .attr("class", "y axis")
- .call(yAxis)
- .append("text")
- .attr("transform", "rotate(-90)")
- .attr("y", -60)
- .attr("dy", ".71em")
- .style("text-anchor", "end")
- .text(yAxisUnits === "NONE" ? "" : yAxisUnits);
-
- console.log("finished axes");
-
- svg.append("path")
- .datum(data)
- .attr("class", "line")
- .attr("fill", "none")
- .attr("stroke", "steelblue")
- .attr("stroke-width", "2")
- .attr("d", line);
-
- svg.append("path")
- .datum(data)
- .attr("class", "highLine")
- .attr("fill", "none")
- .attr("stroke", "red")
- .attr("stroke-width", "1.5")
- //.attr("stroke-dasharray", "20,10,5,5,5,10")
- .attr("stroke-dasharray", "5,5")
- .attr("stroke-opacity", ".3")
- .attr("d", highLine);
-
- svg.append("path")
- .datum(data)
- .attr("class", "lowLine")
- .attr("fill", "none")
- .attr("stroke", "blue")
- .attr("stroke-width", "1.5")
- .attr("stroke-dasharray", "5,5")
- .attr("stroke-opacity", ".3")
- .attr("d", lowLine);
-
- console.log("finished paths");
- }(data);
-
- }-*/;
-
-}
10 years, 10 months