[rhq] Branch 'feature/cassandra-backend' - modules/enterprise
by Jiri Kremser
modules/enterprise/server/installer/pom.xml | 10 ++++++++++
modules/enterprise/server/installer/src/main/resources/module/main/module.xml | 1 +
2 files changed, 11 insertions(+)
New commits:
commit 3f1fe33e226e8ee600a6443f2cebb454f5f01dfd
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Thu May 9 13:51:25 2013 +0200
Adding the dependency to core-domain for module rhq-installer-util.
diff --git a/modules/enterprise/server/installer/pom.xml b/modules/enterprise/server/installer/pom.xml
index 0a9268e..591ae83 100644
--- a/modules/enterprise/server/installer/pom.xml
+++ b/modules/enterprise/server/installer/pom.xml
@@ -26,6 +26,12 @@
<dependencies>
<dependency>
<groupId>org.rhq</groupId>
+ <artifactId>rhq-core-domain</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.rhq</groupId>
<artifactId>rhq-core-util</artifactId>
<version>${project.version}</version>
</dependency>
@@ -133,6 +139,10 @@
<artifactItems>
<artifactItem>
<groupId>org.rhq</groupId>
+ <artifactId>rhq-core-domain</artifactId>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.rhq</groupId>
<artifactId>rhq-core-util</artifactId>
</artifactItem>
<artifactItem>
diff --git a/modules/enterprise/server/installer/src/main/resources/module/main/module.xml b/modules/enterprise/server/installer/src/main/resources/module/main/module.xml
index 2854563..9def431 100644
--- a/modules/enterprise/server/installer/src/main/resources/module/main/module.xml
+++ b/modules/enterprise/server/installer/src/main/resources/module/main/module.xml
@@ -6,6 +6,7 @@
<resources>
<resource-root path="${project.build.finalName}.jar"/>
+ <resource-root path="rhq-core-domain-${project.version}.jar"/>
<resource-root path="rhq-core-dbutils-${project.version}.jar"/>
<resource-root path="rhq-core-util-${project.version}.jar"/>
<resource-root path="rhq-enterprise-comm-${project.version}.jar"/>
11 years, 1 month
[rhq] Changes to 'bug/620603'
by lkrejci
New branch 'bug/620603' available with the following commits:
commit 69d4373ea34fd83262c9d9ef1c30f73658c4a52d
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Thu May 9 13:11:50 2013 +0200
[BZ 620603] - Don't use JOIN FETCH in criteria queries with limits.
Use the "manual" initialization of lazy fields and collections in
that case instead.
Together with the "hibernate.default_batch_fetch_size" setting in the
hibernate configuration, this offers superior performance over the join
fetch and in memory filtering of results when the number of rows in the
"primary" tables times the number of rows in the "join-fetched" table
is non-trivial.
11 years, 1 month
[rhq] modules/enterprise
by mazz
modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/SecureConnector.java | 63 ++++------
1 file changed, 28 insertions(+), 35 deletions(-)
New commits:
commit 7c4577c895a469b5ddce6aa91eb6935eb5cf6cc9
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed May 8 22:23:58 2013 -0400
BZ 535800 - can't use default protocol because it is automatically initialized and cached, not allowing us to use a customized one
add a main() for quick testing
diff --git a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/SecureConnector.java b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/SecureConnector.java
index 6097ebe..16a4544 100644
--- a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/SecureConnector.java
+++ b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/SecureConnector.java
@@ -23,7 +23,6 @@ import java.io.File;
import java.io.FileInputStream;
import java.net.URL;
import java.security.KeyStore;
-import java.security.NoSuchAlgorithmException;
import java.security.cert.X509Certificate;
import javax.net.ssl.HostnameVerifier;
@@ -62,29 +61,13 @@ public class SecureConnector {
private final String truststoreAlgorithm;
/**
- * The {@link #openSecureConnection(URL) secure connections} built by this object will not
- * authenticate the server endpoint, but they will use the default secure socket protocol to
- * encrypt the connection traffic (see <code>javax.net.ssl.SSLContext.getDefault().getProtocol()</code>).
- *
- * @throws NoSuchAlgorithmException if the default secure connection protocol cannot be determined
- */
- public SecureConnector() throws NoSuchAlgorithmException {
- this(null, null, null, null, null);
- }
-
- /**
* The {@link #openSecureConnection(URL) secure connections} built by this object will
* not authenticate the server endpoint, but they will use the given secure socket protocol
* to encrypt the connection traffic.
*
- * @param secureSocketProtocol the secure socket protocol to use; if <code>null</code>, then
- * the JVM's default secure socket protocol will be used
- * (see <code>javax.net.ssl.SSLContext.getDefault().getProtocol()</code>)
- *
- * @throws NoSuchAlgorithmException if <code>secureSocketProtocol</code> is <code>null</code>, and
- * the default secure connection protocol cannot be determined
+ * @param secureSocketProtocol the secure socket protocol to use (e.g. "TLS")
*/
- public SecureConnector(String secureSocketProtocol) throws NoSuchAlgorithmException {
+ public SecureConnector(String secureSocketProtocol) {
this(secureSocketProtocol, null, null, null, null);
}
@@ -97,28 +80,22 @@ public class SecureConnector {
* truststore parameters are ignored and the secure connections built by this object will
* not authenticate the server endpoint.
*
- * @param secureSocketProtocol the secure socket protocol to use; if <code>null</code>, then
- * the JVM's default secure socket protocol will be used
- * (see <code>javax.net.ssl.SSLContext.getDefault().getProtocol()</code>)
+ * @param secureSocketProtocol the secure socket protocol to use (e.g. "TLS")
* @param truststoreFile the truststore file containing authorized certificates
- * @param truststorePassword the password to the truststore file
- * @param truststoreType the type of the truststore file; if <code>null</code>, then the JVM's
+ * @param truststorePassword the password to the truststore file (if a file is given, this must not be <code>null</code>)
+ * @param truststoreType the type of the truststore file (e.g. "JKS"); if <code>null</code>, then the JVM's
* default type is used (see <code>java.security.KeyStore.getDefaultType()</code>)
- * @param truststoreAlgorithm the standard name of the trust management algorithm; if <code>null</code>,
- * then the JVM's default algorithm is used (see
+ * @param truststoreAlgorithm the standard name of the trust management algorithm (e.g. "SunX509");
+ * if <code>null</code>, then the JVM's default algorithm is used (see
* <code>javax.net.ssl.TrustManagerFactory.getDefaultAlgorithm()</code>)
- *
- * @throws NoSuchAlgorithmException if <code>secureSocketProtocol</code> is <code>null</code>, and
- * the default secure connection protocol cannot be determined
*/
public SecureConnector(String secureSocketProtocol, File truststoreFile, String truststorePassword,
- String truststoreType, String truststoreAlgorithm) throws NoSuchAlgorithmException {
+ String truststoreType, String truststoreAlgorithm) {
if (secureSocketProtocol == null) {
- this.secureSocketProtocol = SSLContext.getDefault().getProtocol();
- } else {
- this.secureSocketProtocol = secureSocketProtocol;
+ throw new IllegalArgumentException("secure socket protocol cannot be null");
}
+ this.secureSocketProtocol = secureSocketProtocol;
if (truststoreFile == null) {
// no truststore file was provided, we don't need to know any truststore parameters
@@ -129,17 +106,21 @@ public class SecureConnector {
} else {
// the truststore file is provided, make sure we have non-null truststore parameters, using defaults if need be
this.truststoreFile = truststoreFile;
+
+ if (truststorePassword == null) {
+ throw new IllegalArgumentException("truststorePassword cannot be null");
+ }
this.truststorePassword = truststorePassword;
if (truststoreType == null) {
truststoreType = KeyStore.getDefaultType();
}
- this.truststoreType = (truststoreType != null) ? truststoreType : "JKS";
+ this.truststoreType = truststoreType;
if (truststoreAlgorithm == null) {
truststoreAlgorithm = TrustManagerFactory.getDefaultAlgorithm();
}
- this.truststoreAlgorithm = (truststoreAlgorithm != null) ? truststoreAlgorithm : "SunX509";
+ this.truststoreAlgorithm = truststoreAlgorithm;
}
return;
@@ -216,4 +197,16 @@ public class SecureConnector {
return true;
}
};
+
+ public static void main(String[] args) throws Exception {
+ HttpsURLConnection conn = new SecureConnector("TLS").openSecureConnection(new URL(args[0]));
+ java.io.ByteArrayOutputStream out = new java.io.ByteArrayOutputStream();
+ java.io.InputStream input = new java.io.BufferedInputStream(conn.getInputStream(), 32768);
+ byte[] buffer = new byte[32768];
+ for (int bytesRead = input.read(buffer); bytesRead != -1; bytesRead = input.read(buffer)) {
+ out.write(buffer, 0, bytesRead);
+ }
+ out.flush();
+ System.out.println(out.toString());
+ }
}
\ No newline at end of file
11 years, 1 month
[rhq] Branch 'feature/cassandra-backend' - .gitignore modules/core
by John Sanda
.gitignore | 1 +
modules/core/dbutils/pom.xml | 5 +++++
2 files changed, 6 insertions(+)
New commits:
commit 5eff00569502258985c5dc4238296f9b53b55b6d
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed May 8 17:23:24 2013 -0400
we now need core/domain dep for C* dbreset
diff --git a/.gitignore b/.gitignore
index bd96b70..c65b898 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,7 @@ gwt-tmp/
./cassandra/
/cassandra/
dev-container/
+rhq-data/
dev-agent/
dev-cli/
modules/enterprise/gui/portal-war/build/classes/
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index 49559ad..f7e49de 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -204,6 +204,11 @@
<version>${project.version}</version>
</dependency>
<dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>rhq-core-domain</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.1.3</version>
11 years, 1 month
[rhq] Branch 'feature/cassandra-backend' - modules/common
by John Sanda
modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/ClusterInitService.java | 13 +++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
New commits:
commit 59c961528beb69f25986b88f4b1a396bfaa9acb7
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed May 8 17:00:35 2013 -0400
documenting the reason for ignoring exceptions on jmx query
diff --git a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/ClusterInitService.java b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/ClusterInitService.java
index d7a4e9e..bd37510 100644
--- a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/ClusterInitService.java
+++ b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/ClusterInitService.java
@@ -307,7 +307,18 @@ public final class ClusterInitService {
try {
nativeTransportRunning = (Boolean) serverConnection.getAttribute(storageService, attribute);
} catch (Exception e) {
- log.debug("Failed to read attribute [" + attribute + "] from " + storageService, e);
+ // It is ok to just catch and log exceptions here particularly in an integration
+ // test environment where we could potentially try to do the JMX query before
+ // Cassandra is fully initialized. We can query StorageService before the native
+ // transport server is initialized which will result in Cassandra throwing a NPE.
+ // We do not want propagate that exception because it is just a matter of waiting
+ // for Cassandra to finish initializing.
+ if (log.isDebugEnabled()) {
+ log.debug("Failed to read attribute [" + attribute + "] from " + storageService, e);
+ } else {
+ log.info("Faied to read attribute [" + attribute + "] from " + storageService + ": " +
+ e.getMessage());
+ }
}
} finally {
if (connector != null) {
11 years, 1 month
[rhq] Branch 'feature/cassandra-backend' - 4 commits - modules/common modules/enterprise
by John Sanda
modules/common/cassandra-ccm/cassandra-ccm-arquillian/src/main/java/org/rhq/cassandra/ccm/arquillian/CCMSuiteDeploymentExtension.java | 32 ++++++----
modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/ClusterInitService.java | 9 ++
modules/enterprise/server/appserver/pom.xml | 1
modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml | 11 +++
modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/ControlCommand.java | 4 +
modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Install.java | 12 +++
modules/enterprise/server/server-metrics/src/test/java/org/rhq/server/metrics/CassandraIntegrationTest.java | 2
modules/enterprise/server/server-metrics/src/test/resources/log4j.properties | 8 +-
8 files changed, 61 insertions(+), 18 deletions(-)
New commits:
commit 2bb0b948cb9908e508f27f4b29e33bf9d9a44dff
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed May 8 16:46:57 2013 -0400
fix regression in ClusterInitService.waitForClusterToStart
when a storage node is take off of the queue to see if it is initialized, we
need to put it back on the queue if it is not initialized; otherwise, the
waitForClusterToStart method can return prematurely before the cluster has
fully initialized.
diff --git a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/ClusterInitService.java b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/ClusterInitService.java
index 0b38fb0..d7a4e9e 100644
--- a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/ClusterInitService.java
+++ b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/ClusterInitService.java
@@ -202,6 +202,8 @@ public final class ClusterInitService {
}
if (isNativeTransportRunning) {
++connections;
+ } else {
+ queue.offer(storageNode);
}
if (connections == numHosts) {
if (log.isDebugEnabled()) {
@@ -301,7 +303,12 @@ public final class ClusterInitService {
connector = JMXConnectorFactory.connect(serviceURL, env);
MBeanServerConnection serverConnection = connector.getMBeanServerConnection();
ObjectName storageService = new ObjectName("org.apache.cassandra.db:type=StorageService");
- nativeTransportRunning = (Boolean) serverConnection.getAttribute(storageService, "NativeTransportRunning");
+ String attribute = "NativeTransportRunning";
+ try {
+ nativeTransportRunning = (Boolean) serverConnection.getAttribute(storageService, attribute);
+ } catch (Exception e) {
+ log.debug("Failed to read attribute [" + attribute + "] from " + storageService, e);
+ }
} finally {
if (connector != null) {
connector.close();
diff --git a/modules/enterprise/server/server-metrics/src/test/resources/log4j.properties b/modules/enterprise/server/server-metrics/src/test/resources/log4j.properties
index 44f8c2e..c13e2bd 100644
--- a/modules/enterprise/server/server-metrics/src/test/resources/log4j.properties
+++ b/modules/enterprise/server/server-metrics/src/test/resources/log4j.properties
@@ -23,7 +23,7 @@
# */
#
-log4j.rootCategory=DEBUG, FILE, CONSOLE
+log4j.rootCategory=WARN, FILE, CONSOLE
log4j.appender.FILE=org.apache.log4j.DailyRollingFileAppender
log4j.appender.FILE.DatePattern='.'yyyy-MM-dd
@@ -35,6 +35,8 @@ log4j.appender.FILE.Append=false
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
-log4j.appender.CONSOLE.layout.ConversionPattern=%5p %d{HH:mm:ss,SSS} %m%n
+#log4j.appender.CONSOLE.layout.ConversionPattern=%5p %d{HH:mm:ss,SSS} %m%n
+log4j.appender.CONSOLE.layout.ConversionPattern=%d{ABSOLUTE} %-5p %c %m%n
-log4j.logger.org.apache.cassandra.cql.jdbc=TRACE
+log4j.logger.org.rhq=DEBUG
+log4j.logger.com.datastax=INFO
commit c7b14052fcf6708ab5953bee962bcb2499f4b17c
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed May 8 13:53:45 2013 -0400
make sure test cluster is shut down when there are errors prior to any tests running
diff --git a/modules/common/cassandra-ccm/cassandra-ccm-arquillian/src/main/java/org/rhq/cassandra/ccm/arquillian/CCMSuiteDeploymentExtension.java b/modules/common/cassandra-ccm/cassandra-ccm-arquillian/src/main/java/org/rhq/cassandra/ccm/arquillian/CCMSuiteDeploymentExtension.java
index 0f297ca..fb28c11 100644
--- a/modules/common/cassandra-ccm/cassandra-ccm-arquillian/src/main/java/org/rhq/cassandra/ccm/arquillian/CCMSuiteDeploymentExtension.java
+++ b/modules/common/cassandra-ccm/cassandra-ccm-arquillian/src/main/java/org/rhq/cassandra/ccm/arquillian/CCMSuiteDeploymentExtension.java
@@ -111,16 +111,20 @@ public class CCMSuiteDeploymentExtension implements LoadableExtension {
List<StorageNode> nodes = ccm.createCluster();
ccm.startCluster(false);
+ try {
+ ClusterInitService clusterInitService = new ClusterInitService();
+ clusterInitService.waitForClusterToStart(nodes, nodes.size(), 1500, 20, 5);
- ClusterInitService clusterInitService = new ClusterInitService();
- clusterInitService.waitForClusterToStart(nodes, nodes.size(), 1500, 20, 5);
-
- SchemaManager schemaManager = new SchemaManager("cassandra", "cassandra", nodes);
- if (!schemaManager.schemaExists()) {
- schemaManager.createSchema();
+ SchemaManager schemaManager = new SchemaManager("cassandra", "cassandra", nodes);
+ if (!schemaManager.schemaExists()) {
+ schemaManager.createSchema();
+ }
+ schemaManager.updateSchema();
+ schemaManager.shutdown();
+ } catch (Exception e) {
+ ccm.shutdownCluster();
+ throw new RuntimeException("Cassandra cluster initialization failed", e);
}
- schemaManager.updateSchema();
- schemaManager.shutdown();
executeInClassScope(new Callable<Void>() {
public Void call() throws Exception {
@@ -135,11 +139,15 @@ public class CCMSuiteDeploymentExtension implements LoadableExtension {
final AfterStart event, final ContainerRegistry registry) {
executeInClassScope(new Callable<Void>() {
public Void call() throws Exception {
- for (Deployment d : suiteDeploymentScenario.deployments()) {
- deploymentEvent.fire(new DeployDeployment(findContainer(registry,
- event.getDeployableContainer()), d));
+ try {
+ for (Deployment d : suiteDeploymentScenario.deployments()) {
+ deploymentEvent.fire(new DeployDeployment(findContainer(registry,
+ event.getDeployableContainer()), d));
+ }
+ return null;
+ } finally {
+ ccm.shutdownCluster();
}
- return null;
}
});
}
diff --git a/modules/enterprise/server/server-metrics/src/test/java/org/rhq/server/metrics/CassandraIntegrationTest.java b/modules/enterprise/server/server-metrics/src/test/java/org/rhq/server/metrics/CassandraIntegrationTest.java
index 3a9679e..3129b43 100644
--- a/modules/enterprise/server/server-metrics/src/test/java/org/rhq/server/metrics/CassandraIntegrationTest.java
+++ b/modules/enterprise/server/server-metrics/src/test/java/org/rhq/server/metrics/CassandraIntegrationTest.java
@@ -66,7 +66,7 @@ public class CassandraIntegrationTest {
session = cluster.connect("rhq");
}
- @AfterSuite
+ @AfterSuite(alwaysRun = true)
@ShutdownCluster
public void shutdownCluster() throws Exception {
}
commit 1f4699e54b5b45f9f846f1b9f4715163c6dab9e3
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed May 8 12:59:49 2013 -0400
updating container ant script to generate rhq-storage.properties
This is a dev-container only change for pre-configuring the storage node.
diff --git a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml
index e932ac7..c6ac637 100644
--- a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml
+++ b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml
@@ -776,6 +776,17 @@ rhq.cassandra.cluster.num-nodes=${rhq.cassandra.cluster.num-nodes}
# The log4j logging level to use on each node.
rhq.cassandra.logging.level=${rhq.cassandra.logging.level}
</echo>
+
+<echo file="${project.build.outputDirectory}/bin/rhq-storage.properties" append="true"># storage installer options for dev deployment
+hostname=127.0.0.1
+commitlog=${rhq.dev.data.dir}/storage/commit_log
+data=${rhq.dev.data.dir}/storage/data
+saved-caches=${rhq.dev.data.dir}/storage/saved_caches
+heap-size=256M
+heap-new-size=64M
+</echo>
+
+<echo file="${project.build.outputDirectory}/bin/rhqctl.properties" append="true">rhqctl.install.storage-config=bin/rhq-storage.properties</echo>
</target>
commit 049402dc47377e3b1ad18771a7f8c66d734dc038
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed May 8 12:51:51 2013 -0400
add support for specifying storage installer props file in rhqctl.properties
This is used for dev-container deployments so that we can pre-configure the
storage installer. This could also be useful for production use as a way to
templatize deployments.
diff --git a/modules/enterprise/server/appserver/pom.xml b/modules/enterprise/server/appserver/pom.xml
index 42aa4a5..79d2b5f 100644
--- a/modules/enterprise/server/appserver/pom.xml
+++ b/modules/enterprise/server/appserver/pom.xml
@@ -186,6 +186,7 @@
<!-- dev/test DB type (TODO: do we still need this?) -->
<property name="rhq.test.ds.type-mapping" value="${rhq.test.ds.type-mapping}" />
<property name="rhq.dev.ds.type-mapping" value="${rhq.dev.ds.type-mapping}" />
+ <property name="rhq.dev.data.dir" location="${rhq.rootDir}/rhq-data"/>
</ant>
</target>
</configuration>
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 ee7a404..8919630 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
@@ -184,6 +184,10 @@ public abstract class ControlCommand {
return null;
}
+ protected boolean hasProperty(String key) {
+ return rhqctlConfig.containsKey(key);
+ }
+
protected String getProperty(String key) {
return rhqctlConfig.getString(key);
}
diff --git a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Install.java b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Install.java
index fe79183..d2e4c0e 100644
--- a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Install.java
+++ b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Install.java
@@ -66,6 +66,10 @@ public class Install extends ControlCommand {
private final String SERVER_CONFIG_OPTION = "server-config";
+ private final String AGENT_TOKEN_OPTION = "agent-security-token";
+
+ private final String STORAGE_CONFIG_PROP = "rhqctl.install.storage-config";
+
private final File DEFAULT_STORAGE_BASEDIR = new File(basedir, STORAGE_BASEDIR_NAME);
private final File DEFAULT_AGENT_BASEDIR = new File(basedir, AGENT_BASEDIR_NAME);
@@ -99,7 +103,10 @@ public class Install extends ControlCommand {
true,
"A properties file with keys that correspond to option names "
+ "of the storage installer. Each property will be translated into an option that is passed to the "
- + " storage installer. See example.storage.properties for examples.");
+ + " storage installer. See example.storage.properties for examples.")
+ .addOption(null, AGENT_TOKEN_OPTION, true, "The security token that the agent needs to include with " +
+ "commands sent to the server. Use this option when installing or upgrading an agent that is already " +
+ "registered with the server.");
}
@Override
@@ -308,6 +315,9 @@ public class Install extends ControlCommand {
if (rhqctlCommandLine.hasOption(STORAGE_CONFIG_OPTION)) {
String[] args = toArray(loadStorageProperties(rhqctlCommandLine.getOptionValue(STORAGE_CONFIG_OPTION)));
commandLine.addArguments(args);
+ } else if (hasProperty(STORAGE_CONFIG_PROP)) {
+ String[] args = toArray(loadStorageProperties(getProperty(STORAGE_CONFIG_PROP)));
+ commandLine.addArguments(args);
}
Executor executor = new DefaultExecutor();
11 years, 1 month
[rhq] modules/enterprise
by mazz
modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentUpdateDownload.java | 32 +
modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentUpdateVersion.java | 33 +
modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/SecureConnector.java | 219 ++++++++++
3 files changed, 280 insertions(+), 4 deletions(-)
New commits:
commit 2c6438cd554b64aa97f2b83d1d5fe7f005d9f68f
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed May 8 16:43:36 2013 -0400
BZ 535800 - allow the agent to download the agent update binary over the configured SSL channel
diff --git a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentUpdateDownload.java b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentUpdateDownload.java
index 9edad7f..ccd46db 100644
--- a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentUpdateDownload.java
+++ b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentUpdateDownload.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2008 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
@@ -24,6 +24,8 @@ import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
+import javax.net.ssl.HttpsURLConnection;
+
import mazz.i18n.Logger;
import org.rhq.core.util.MessageDigestGenerator;
@@ -153,7 +155,13 @@ public class AgentUpdateDownload {
// we only support http/s
url = getDownloadUrl();
LOG.info(AgentI18NResourceKeys.UPDATE_DOWNLOAD_RETRIEVAL, info, url);
- conn = (HttpURLConnection) url.openConnection();
+
+ if (url.getProtocol().equals("https")) {
+ conn = openSecureConnection(url);
+ } else {
+ conn = (HttpURLConnection) url.openConnection(); // we only support http(s), so this cast is OK
+ }
+
inStream = conn.getInputStream();
// put the update content in the local file system
@@ -277,4 +285,24 @@ public class AgentUpdateDownload {
return false;
}
}
+
+ private HttpsURLConnection openSecureConnection(URL url) throws Exception {
+ AgentConfiguration config = this.agent.getConfiguration();
+ String secureSocketProtocol = config.getClientSenderSecuritySocketProtocol();
+ SecureConnector secureConnector;
+ if (config.isClientSenderSecurityServerAuthMode()) {
+ File file = new File(config.getClientSenderSecurityTruststoreFile());
+ if (!file.isAbsolute()) {
+ file = new File(this.agent.getAgentHomeDirectory(), file.getPath());
+ }
+ String password = config.getClientSenderSecurityTruststorePassword();
+ String type = config.getClientSenderSecurityTruststoreType();
+ String algorithm = config.getClientSenderSecurityTruststoreAlgorithm();
+ secureConnector = new SecureConnector(secureSocketProtocol, file, password, type, algorithm);
+ } else {
+ secureConnector = new SecureConnector(secureSocketProtocol);
+ }
+
+ return secureConnector.openSecureConnection(url);
+ }
}
diff --git a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentUpdateVersion.java b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentUpdateVersion.java
index b429fa8..6ef123a 100644
--- a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentUpdateVersion.java
+++ b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentUpdateVersion.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2008 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
@@ -18,11 +18,14 @@
*/
package org.rhq.enterprise.agent;
+import java.io.File;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Properties;
+import javax.net.ssl.HttpsURLConnection;
+
import mazz.i18n.Logger;
import org.rhq.core.util.exception.ThrowableUtil;
@@ -100,7 +103,13 @@ public class AgentUpdateVersion {
// we only support http/s
url = getVersionUrl();
LOG.debug(AgentI18NResourceKeys.UPDATE_VERSION_RETRIEVAL, url);
- conn = (HttpURLConnection) url.openConnection();
+
+ if (url.getProtocol().equals("https")) {
+ conn = openSecureConnection(url);
+ } else {
+ conn = (HttpURLConnection) url.openConnection(); // we only support http(s), so this cast is OK
+ }
+
versionProps = new Properties();
inStream = conn.getInputStream();
versionProps.load(inStream);
@@ -142,4 +151,24 @@ public class AgentUpdateVersion {
return;
}
+
+ private HttpsURLConnection openSecureConnection(URL url) throws Exception {
+ AgentConfiguration config = this.agent.getConfiguration();
+ String secureSocketProtocol = config.getClientSenderSecuritySocketProtocol();
+ SecureConnector secureConnector;
+ if (config.isClientSenderSecurityServerAuthMode()) {
+ File file = new File(config.getClientSenderSecurityTruststoreFile());
+ if (!file.isAbsolute()) {
+ file = new File(this.agent.getAgentHomeDirectory(), file.getPath());
+ }
+ String password = config.getClientSenderSecurityTruststorePassword();
+ String type = config.getClientSenderSecurityTruststoreType();
+ String algorithm = config.getClientSenderSecurityTruststoreAlgorithm();
+ secureConnector = new SecureConnector(secureSocketProtocol, file, password, type, algorithm);
+ } else {
+ secureConnector = new SecureConnector(secureSocketProtocol);
+ }
+
+ return secureConnector.openSecureConnection(url);
+ }
}
diff --git a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/SecureConnector.java b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/SecureConnector.java
new file mode 100644
index 0000000..6097ebe
--- /dev/null
+++ b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/SecureConnector.java
@@ -0,0 +1,219 @@
+/*
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.enterprise.agent;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.net.URL;
+import java.security.KeyStore;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.X509Certificate;
+
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSession;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.TrustManagerFactory;
+import javax.net.ssl.X509TrustManager;
+
+/**
+ * If you need to make a connection to an external HTTP server using the https protocol,
+ * use this class to build the connection. You can specify which trusted certificates can be used
+ * to verify and authenticate the remote server via truststore file parameters passed into the constructor.
+ * In other words, you don't have to rely on the global system properties javax.net.ssl.keyStore and
+ * javax.net.ssl.trustStore to make your connection.
+ *
+ * This is useful if some other object running in your JVM requires
+ * javax.net.ssl.keyStore/javax.net.ssl.trustStore set to something other than what you want to use.
+ * Since those system properties can only be set once during the lifetime of the JVM, it is not possible
+ * to change them at runtime and expect the change to take effect. Besides, even if you could change them,
+ * this could then effect the other objects that do need those properties set to particular values.
+ *
+ * This object has the ability to make an encrypted call without requiring a truststore to exist (that is,
+ * you can encrypt the call but you will not have the server endpoint verified and authenticated). This
+ * can be useful if you aren't concerned with authenticating the endpoint but do want to encrypt the
+ * traffic.
+ *
+ * @author John Mazzitelli
+ */
+public class SecureConnector {
+ private final String secureSocketProtocol;
+ private final File truststoreFile;
+ private final String truststorePassword;
+ private final String truststoreType;
+ private final String truststoreAlgorithm;
+
+ /**
+ * The {@link #openSecureConnection(URL) secure connections} built by this object will not
+ * authenticate the server endpoint, but they will use the default secure socket protocol to
+ * encrypt the connection traffic (see <code>javax.net.ssl.SSLContext.getDefault().getProtocol()</code>).
+ *
+ * @throws NoSuchAlgorithmException if the default secure connection protocol cannot be determined
+ */
+ public SecureConnector() throws NoSuchAlgorithmException {
+ this(null, null, null, null, null);
+ }
+
+ /**
+ * The {@link #openSecureConnection(URL) secure connections} built by this object will
+ * not authenticate the server endpoint, but they will use the given secure socket protocol
+ * to encrypt the connection traffic.
+ *
+ * @param secureSocketProtocol the secure socket protocol to use; if <code>null</code>, then
+ * the JVM's default secure socket protocol will be used
+ * (see <code>javax.net.ssl.SSLContext.getDefault().getProtocol()</code>)
+ *
+ * @throws NoSuchAlgorithmException if <code>secureSocketProtocol</code> is <code>null</code>, and
+ * the default secure connection protocol cannot be determined
+ */
+ public SecureConnector(String secureSocketProtocol) throws NoSuchAlgorithmException {
+ this(secureSocketProtocol, null, null, null, null);
+ }
+
+ /**
+ * The {@link #openSecureConnection(URL) secure connections} built by this object will
+ * authenticate the server endpoint using the given truststore file and its related parameters.
+ * The connection will use the given secure socket protocol to encrypt the connection traffic.
+ *
+ * Note that if the given <code>truststoreFile</code> is <code>null</code>, the other
+ * truststore parameters are ignored and the secure connections built by this object will
+ * not authenticate the server endpoint.
+ *
+ * @param secureSocketProtocol the secure socket protocol to use; if <code>null</code>, then
+ * the JVM's default secure socket protocol will be used
+ * (see <code>javax.net.ssl.SSLContext.getDefault().getProtocol()</code>)
+ * @param truststoreFile the truststore file containing authorized certificates
+ * @param truststorePassword the password to the truststore file
+ * @param truststoreType the type of the truststore file; if <code>null</code>, then the JVM's
+ * default type is used (see <code>java.security.KeyStore.getDefaultType()</code>)
+ * @param truststoreAlgorithm the standard name of the trust management algorithm; if <code>null</code>,
+ * then the JVM's default algorithm is used (see
+ * <code>javax.net.ssl.TrustManagerFactory.getDefaultAlgorithm()</code>)
+ *
+ * @throws NoSuchAlgorithmException if <code>secureSocketProtocol</code> is <code>null</code>, and
+ * the default secure connection protocol cannot be determined
+ */
+ public SecureConnector(String secureSocketProtocol, File truststoreFile, String truststorePassword,
+ String truststoreType, String truststoreAlgorithm) throws NoSuchAlgorithmException {
+
+ if (secureSocketProtocol == null) {
+ this.secureSocketProtocol = SSLContext.getDefault().getProtocol();
+ } else {
+ this.secureSocketProtocol = secureSocketProtocol;
+ }
+
+ if (truststoreFile == null) {
+ // no truststore file was provided, we don't need to know any truststore parameters
+ this.truststoreFile = null;
+ this.truststorePassword = null;
+ this.truststoreType = null;
+ this.truststoreAlgorithm = null;
+ } else {
+ // the truststore file is provided, make sure we have non-null truststore parameters, using defaults if need be
+ this.truststoreFile = truststoreFile;
+ this.truststorePassword = truststorePassword;
+
+ if (truststoreType == null) {
+ truststoreType = KeyStore.getDefaultType();
+ }
+ this.truststoreType = (truststoreType != null) ? truststoreType : "JKS";
+
+ if (truststoreAlgorithm == null) {
+ truststoreAlgorithm = TrustManagerFactory.getDefaultAlgorithm();
+ }
+ this.truststoreAlgorithm = (truststoreAlgorithm != null) ? truststoreAlgorithm : "SunX509";
+ }
+
+ return;
+ }
+
+ public HttpsURLConnection openSecureConnection(URL url) throws Exception {
+ // we assume the URL is https - if it is not, its an error so just let the cast throw exception
+ HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
+
+ TrustManager[] trustManagers;
+ SSLContext sslContext = SSLContext.getInstance(getSecureSocketProtocol());
+
+ if (getTruststoreFile() == null) {
+ // we are configured to not care about authenticating the server, just encrypt but don't worry about certificates
+ trustManagers = new TrustManager[] { NO_OP_TRUST_MANAGER };
+ connection.setHostnameVerifier(NO_OP_HOSTNAME_VERIFIER);
+ } else {
+ // We need to configure our SSL connection with the agent's truststore so we can authenticate the server.
+ // First, create a KeyStore, but load it with our truststore entries.
+ KeyStore keyStore = KeyStore.getInstance(getTruststoreType());
+ keyStore.load(new FileInputStream(getTruststoreFile()), getTruststorePassword().toCharArray());
+ // now create a truststore manager instance and initialize it with our KeyStore we created with all our truststore entries
+ TrustManagerFactory tmf = TrustManagerFactory.getInstance(getTruststoreAlgorithm());
+ tmf.init(keyStore);
+ trustManagers = tmf.getTrustManagers();
+ }
+
+ sslContext.init(null, trustManagers, null);
+ connection.setSSLSocketFactory(sslContext.getSocketFactory());
+
+ return connection;
+ }
+
+ public String getSecureSocketProtocol() {
+ return this.secureSocketProtocol;
+ }
+
+ public File getTruststoreFile() {
+ return this.truststoreFile;
+ }
+
+ public String getTruststorePassword() {
+ return this.truststorePassword;
+ }
+
+ public String getTruststoreType() {
+ return this.truststoreType;
+ }
+
+ public String getTruststoreAlgorithm() {
+ return this.truststoreAlgorithm;
+ }
+
+ private static TrustManager NO_OP_TRUST_MANAGER = new X509TrustManager() {
+ @Override
+ public X509Certificate[] getAcceptedIssuers() {
+ return new X509Certificate[0];
+ }
+
+ @Override
+ public void checkClientTrusted(X509Certificate[] certs, String authType) {
+ return;
+ }
+
+ @Override
+ public void checkServerTrusted(X509Certificate[] certs, String authType) {
+ return;
+ }
+ };
+
+ private static HostnameVerifier NO_OP_HOSTNAME_VERIFIER = new HostnameVerifier() {
+ @Override
+ public boolean verify(String s, SSLSession sslSession) {
+ return true;
+ }
+ };
+}
\ No newline at end of file
11 years, 1 month
[rhq] Branch 'feature/cassandra-backend' - 4 commits - .classpath modules/enterprise
by Jay Shaughnessy
.classpath | 3
modules/enterprise/server/appserver/src/main/dev-resources/bin/wrapper/rhq-server-wrapper.inc | 2
modules/enterprise/server/ear/pom.xml | 6
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java | 54 -
modules/enterprise/server/plugins/alertdef-rhq/pom.xml | 132 ++++
modules/enterprise/server/plugins/alertdef-rhq/src/main/java/org/rhq/enterprise/server/plugins/alertdef/AlertDefinitionServerPluginComponent.java | 325 ++++++++++
modules/enterprise/server/plugins/alertdef-rhq/src/main/resources/META-INF/rhq-serverplugin.xml | 57 +
modules/enterprise/server/plugins/pom.xml | 1
8 files changed, 552 insertions(+), 28 deletions(-)
New commits:
commit e77339f1bb0b53ca0d4fc60d81ac8002604a70cc
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed May 8 16:31:04 2013 -0400
Add Server Plugin for injecting factory-installed alert templates for RHQ.
This will be used to create pre-defined storage alerting, alhough at the moment
it just creates a dummy template for alerting when the rhq agent goes down.
diff --git a/modules/enterprise/server/ear/pom.xml b/modules/enterprise/server/ear/pom.xml
index a4f3f6b..3dcd796 100644
--- a/modules/enterprise/server/ear/pom.xml
+++ b/modules/enterprise/server/ear/pom.xml
@@ -524,6 +524,12 @@
<artifactItem>
<groupId>${project.groupId}</groupId>
+ <artifactId>serverplugin-alertdef-rhq</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>${project.groupId}</groupId>
<artifactId>rhq-serverplugin-drift</artifactId>
<version>${project.version}</version>
</artifactItem>
diff --git a/modules/enterprise/server/plugins/alertdef-rhq/pom.xml b/modules/enterprise/server/plugins/alertdef-rhq/pom.xml
new file mode 100644
index 0000000..842aabf
--- /dev/null
+++ b/modules/enterprise/server/plugins/alertdef-rhq/pom.xml
@@ -0,0 +1,132 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-enterprise-server-plugins-parent</artifactId>
+ <version>4.7.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.rhq</groupId>
+ <artifactId>serverplugin-alertdef-rhq</artifactId>
+ <packaging>jar</packaging>
+
+ <name>RHQ Alert Definition Server Plugin</name>
+ <description>Server side plugin providing RHQ Alert Definition Injection</description>
+
+ <dependencies>
+
+ <!-- Internal Deps -->
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-domain</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-client-api</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludedGroups>${rhq.testng.excludedGroups}</excludedGroups>
+ <!--
+ <argLine>${jacoco.unit-test.args} -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y</argLine>
+ -->
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+
+ <profiles>
+
+ <profile>
+ <id>dev</id>
+
+ <properties>
+ <rhq.rootDir>../../../../..</rhq.rootDir>
+ <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir>
+ <rhq.deploymentDir>${rhq.containerDir}/${rhq.serverPluginDir}</rhq.deploymentDir>
+ </properties>
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+
+ <execution>
+ <id>deploy</id>
+ <phase>compile</phase>
+ <configuration>
+ <target>
+ <mkdir dir="${rhq.deploymentDir}" />
+ <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+ <echo>*** Updating ${deployment.file}...</echo>
+ <jar destfile="${deployment.file}" basedir="${project.build.outputDirectory}" />
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ <execution>
+ <id>undeploy</id>
+ <phase>clean</phase>
+ <configuration>
+ <target>
+ <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+ <echo>*** Deleting ${deployment.file}...</echo>
+ <delete file="${deployment.file}" />
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ <execution>
+ <id>deploy-jar-meta-inf</id>
+ <phase>package</phase>
+ <configuration>
+ <target>
+ <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+ <echo>*** Updating META-INF dir in ${deployment.file}...</echo>
+ <unjar src="${project.build.directory}/${project.build.finalName}.jar" dest="${project.build.outputDirectory}">
+ <patternset>
+ <include name="META-INF/**" />
+ </patternset>
+ </unjar>
+ <jar destfile="${deployment.file}" manifest="${project.build.outputDirectory}/META-INF/MANIFEST.MF" update="true">
+ </jar>
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
\ No newline at end of file
diff --git a/modules/enterprise/server/plugins/alertdef-rhq/src/main/java/org/rhq/enterprise/server/plugins/alertdef/AlertDefinitionServerPluginComponent.java b/modules/enterprise/server/plugins/alertdef-rhq/src/main/java/org/rhq/enterprise/server/plugins/alertdef/AlertDefinitionServerPluginComponent.java
new file mode 100644
index 0000000..76c4e28
--- /dev/null
+++ b/modules/enterprise/server/plugins/alertdef-rhq/src/main/java/org/rhq/enterprise/server/plugins/alertdef/AlertDefinitionServerPluginComponent.java
@@ -0,0 +1,325 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2013, 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.server.plugins.alertdef;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.rhq.core.domain.alert.AlertCondition;
+import org.rhq.core.domain.alert.AlertConditionCategory;
+import org.rhq.core.domain.alert.AlertConditionOperator;
+import org.rhq.core.domain.alert.AlertDampening;
+import org.rhq.core.domain.alert.AlertDefinition;
+import org.rhq.core.domain.alert.AlertPriority;
+import org.rhq.core.domain.alert.BooleanExpression;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.PropertyList;
+import org.rhq.core.domain.configuration.PropertyMap;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.criteria.AlertDefinitionCriteria;
+import org.rhq.core.domain.criteria.ResourceTypeCriteria;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.enterprise.server.alert.AlertDefinitionManagerLocal;
+import org.rhq.enterprise.server.auth.SubjectManagerLocal;
+import org.rhq.enterprise.server.plugin.pc.ControlFacet;
+import org.rhq.enterprise.server.plugin.pc.ControlResults;
+import org.rhq.enterprise.server.plugin.pc.ServerPluginComponent;
+import org.rhq.enterprise.server.plugin.pc.ServerPluginContext;
+import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
+import org.rhq.enterprise.server.util.LookupUtil;
+
+/**
+ * An alert def server-side plugin component that the server uses to inject alert defintions.
+ *
+ * @author Jay Shaughnessy
+ */
+public class AlertDefinitionServerPluginComponent implements ServerPluginComponent, ControlFacet {
+
+ private final Log log = LogFactory.getLog(AlertDefinitionServerPluginComponent.class);
+
+ static private final List<InjectedAlertDef> injectedAlertDefs;
+ static private final InjectedAlertDef testTemplate;
+
+ static {
+ testTemplate = new InjectedAlertDef( //
+ "RHQAgent", //
+ "RHQ Agent", //
+ "TestTemplate", //
+ "A test template injection");
+
+ injectedAlertDefs = new ArrayList<InjectedAlertDef>();
+ injectedAlertDefs.add(testTemplate);
+ }
+
+ private ServerPluginContext context;
+
+ @Override
+ public void initialize(ServerPluginContext context) throws Exception {
+ this.context = context;
+ log.debug("The RHQ AlertDefinition plugin has been initialized!!! : " + this);
+ }
+
+ @Override
+ public void start() {
+ boolean injectAtPluginStartup = Boolean.valueOf(context.getPluginConfiguration().getSimpleValue(
+ "injectAtPluginStartup", "true"));
+ boolean replaceIfExists = Boolean.valueOf(context.getPluginConfiguration().getSimpleValue("replaceIfExists",
+ "false"));
+
+ if (injectAtPluginStartup) {
+ injectAllAlertDefs(replaceIfExists);
+ }
+
+ log.debug("The RHQ AlertDefinition plugin has started!!! : " + this);
+
+ }
+
+ @Override
+ public void stop() {
+ log.debug("The RHQ AlertDefinition plugin has stopped!!! : " + this);
+ }
+
+ @Override
+ public void shutdown() {
+ log.debug("The RHQ AlertDefinition plugin has been shut down!!! : " + this);
+ }
+
+ @Override
+ public ControlResults invoke(String name, Configuration parameters) {
+ ControlResults controlResults = new ControlResults();
+
+ try {
+ if (name.equals("listInjectedAlertDefinitions")) {
+ PropertyList result = new PropertyList("injectedAlertDefinitions");
+ for (InjectedAlertDef iad : injectedAlertDefs) {
+ PropertyMap map = new PropertyMap("injectedAlertDefinition");
+ map.put(new PropertySimple(InjectedAlertDef.FIELD_PLUGIN_NAME, iad.getPluginName()));
+ map.put(new PropertySimple(InjectedAlertDef.FIELD_RESOURCE_TYPE_NAME, iad.getResourceTypeName()));
+ map.put(new PropertySimple(InjectedAlertDef.FIELD_NAME, iad.getName()));
+ map.put(new PropertySimple(InjectedAlertDef.FIELD_DESCRIPTION, iad.getDescription()));
+ result.add(map);
+ }
+ controlResults.getComplexResults().put(result);
+
+ } else if (name.equals("injectAllAlertDefinitions")) {
+ injectAllAlertDefs(Boolean.valueOf(parameters.getSimpleValue("replaceIfExists")));
+
+ } else if (name.equals("injectAlertDefinition")) {
+ InjectedAlertDef requestedInjection = new InjectedAlertDef( //
+ parameters.getSimpleValue(InjectedAlertDef.FIELD_PLUGIN_NAME), //
+ parameters.getSimpleValue(InjectedAlertDef.FIELD_RESOURCE_TYPE_NAME), //
+ parameters.getSimpleValue(InjectedAlertDef.FIELD_NAME), null);
+ boolean injected = false;
+ for (InjectedAlertDef iad : injectedAlertDefs) {
+ if (iad.equals(requestedInjection)) {
+ injectAlertDef(iad, Boolean.valueOf(parameters.getSimpleValue("replaceIfExists", "false")));
+ injected = true;
+ break;
+ }
+ }
+
+ if (!injected) {
+ controlResults
+ .setError("Unknown requested alert definition. Check spelling: " + requestedInjection);
+ }
+
+ } else {
+ controlResults.setError("Unknown control name: " + name);
+ }
+ } catch (Throwable t) {
+ controlResults.setError(t);
+ }
+
+ return controlResults;
+ }
+
+ private List<AlertDefinition> injectAllAlertDefs(boolean replaceIfExists) {
+
+ List<AlertDefinition> result = new ArrayList<AlertDefinition>();
+
+ for (InjectedAlertDef iad : injectedAlertDefs) {
+ AlertDefinition newAlertDef = injectAlertDef(iad, replaceIfExists);
+ if (null != newAlertDef) {
+ result.add(newAlertDef);
+ }
+ }
+
+ return result;
+ }
+
+ private AlertDefinition injectAlertDef(InjectedAlertDef injectedAlertDef, boolean replaceIfExists) {
+
+ AlertDefinition result = null;
+ ResourceTypeManagerLocal typeManager = LookupUtil.getResourceTypeManager();
+ AlertDefinitionManagerLocal alertDefManager = LookupUtil.getAlertDefinitionManager();
+ SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
+
+ ResourceTypeCriteria rtc = new ResourceTypeCriteria();
+ rtc.addFilterPluginName(injectedAlertDef.getPluginName());
+ rtc.addFilterName(injectedAlertDef.getResourceTypeName());
+ List<ResourceType> resourceTypes = typeManager.findResourceTypesByCriteria(subjectManager.getOverlord(), rtc);
+
+ if (resourceTypes.isEmpty()) {
+ return result;
+ }
+
+ assert 1 == resourceTypes.size() : "Found more than 1 resource type!";
+ ResourceType resourceType = resourceTypes.get(0);
+
+ AlertDefinitionCriteria adc = new AlertDefinitionCriteria();
+ adc.addFilterName(injectedAlertDef.getName());
+ adc.addFilterAlertTemplateResourceTypeId(resourceType.getId());
+ List<AlertDefinition> alertDefs = alertDefManager.findAlertDefinitionsByCriteria(subjectManager.getOverlord(),
+ adc);
+
+ if (!alertDefs.isEmpty()) {
+ assert 1 == alertDefs.size() : "Found more than 1 existing alert def!";
+
+ if (!replaceIfExists) {
+ return result;
+ }
+
+ int[] alertDefIdArray = new int[1];
+ alertDefIdArray[0] = alertDefs.get(0).getId();
+ alertDefManager.removeAlertDefinitions(subjectManager.getOverlord(), alertDefIdArray);
+ }
+
+ int newAlertDefId = 0;
+
+ if (testTemplate.equals(injectedAlertDef)) {
+ newAlertDefId = injectTestTemplate(resourceType);
+ }
+
+ adc.addFilterId(newAlertDefId);
+ alertDefs = alertDefManager.findAlertDefinitionsByCriteria(subjectManager.getOverlord(), adc);
+ assert 1 == alertDefs.size() : "Found more than 1 new alert def!";
+ result = alertDefs.get(0);
+
+ return result;
+ }
+
+ private int injectTestTemplate(ResourceType resourceType) {
+ AlertDefinitionManagerLocal alertDefManager = LookupUtil.getAlertDefinitionManager();
+ SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
+
+ AlertDefinition newTemplate = new AlertDefinition();
+ newTemplate.setName(testTemplate.getName());
+ newTemplate.setResourceType(resourceType);
+ newTemplate.setPriority(AlertPriority.MEDIUM);
+ newTemplate.setAlertDampening(new AlertDampening(AlertDampening.Category.NONE));
+ newTemplate.setConditionExpression(BooleanExpression.ANY);
+ newTemplate.setRecoveryId(0);
+ newTemplate.setEnabled(true);
+
+ AlertCondition ac = new AlertCondition();
+ ac.setCategory(AlertConditionCategory.AVAILABILITY);
+ ac.setName(AlertConditionOperator.AVAIL_GOES_DOWN.name());
+
+ newTemplate.addCondition(ac);
+
+ int newTemplateId = alertDefManager.createAlertDefinitionInNewTransaction(subjectManager.getOverlord(),
+ newTemplate, null, true);
+
+ return newTemplateId;
+ }
+
+ private static class InjectedAlertDef {
+ static public final String FIELD_PLUGIN_NAME = "plugin";
+ static public final String FIELD_RESOURCE_TYPE_NAME = "type";
+ static public final String FIELD_NAME = "name";
+ static public final String FIELD_DESCRIPTION = "description";
+
+ private String pluginName;
+ private String resourceTypeName;
+ private String name;
+ private String description;
+
+ public InjectedAlertDef(String pluginName, String resourceTypeName, String name, String description) {
+ super();
+ this.pluginName = pluginName;
+ this.resourceTypeName = resourceTypeName;
+ this.name = name;
+ this.description = description;
+ }
+
+ public String getPluginName() {
+ return pluginName;
+ }
+
+ public String getResourceTypeName() {
+ return resourceTypeName;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + ((pluginName == null) ? 0 : pluginName.hashCode());
+ result = prime * result + ((resourceTypeName == null) ? 0 : resourceTypeName.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ InjectedAlertDef other = (InjectedAlertDef) obj;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ if (pluginName == null) {
+ if (other.pluginName != null)
+ return false;
+ } else if (!pluginName.equals(other.pluginName))
+ return false;
+ if (resourceTypeName == null) {
+ if (other.resourceTypeName != null)
+ return false;
+ } else if (!resourceTypeName.equals(other.resourceTypeName))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "InjectedAlertDef [pluginName=" + pluginName + ", resourceTypeName=" + resourceTypeName + ", name="
+ + name + "]";
+ }
+ }
+
+}
diff --git a/modules/enterprise/server/plugins/alertdef-rhq/src/main/resources/META-INF/rhq-serverplugin.xml b/modules/enterprise/server/plugins/alertdef-rhq/src/main/resources/META-INF/rhq-serverplugin.xml
new file mode 100644
index 0000000..84ffa91
--- /dev/null
+++ b/modules/enterprise/server/plugins/alertdef-rhq/src/main/resources/META-INF/rhq-serverplugin.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<generic-plugin name="AlertDefinitionPlugin" displayName="Alert Definition Injection Plugin" description="Injects Factory Installed Alert Definitions"
+ package="org.rhq.enterprise.server.plugins.alertdef" version="1.0" apiVersion="1.0" disabledOnDiscovery="false"
+ xmlns="urn:xmlns:rhq-serverplugin.generic" xmlns:serverplugin="urn:xmlns:rhq-serverplugin" xmlns:c="urn:xmlns:rhq-configuration">
+
+ <serverplugin:help><![CDATA[
+ Injects Factory Installed Alert Templates/Definitions.
+ ]]></serverplugin:help>
+
+ <serverplugin:plugin-component class="AlertDefinitionServerPluginComponent">
+
+ <serverplugin:control name="listInjectedAlertDefinitions" description="Return a list of the alert definitions injected by this plugin">
+ <serverplugin:results>
+ <c:list-property name="injectedAlertDefinitions" description="A list of injected Alert Definitions">
+ <c:map-property name="injectedAlertDefinition" description="Injected Alert Definition">
+ <c:simple-property name="plugin" type="string" summary="true" />
+ <c:simple-property name="type" type="string" summary="true" />
+ <c:simple-property name="name" type="string" summary="true" />
+ <c:simple-property name="description" type="string" summary="true" />
+ </c:map-property>
+ </c:list-property>
+ </serverplugin:results>
+ </serverplugin:control>
+
+ <serverplugin:control name="injectAllAlertDefinitions" description="Inject all of the defined alert definitions">
+ <serverplugin:parameters>
+ <c:simple-property name="replaceIfExists" type="boolean" required="true" default="false"
+ description="If false do not replace the alert definition if it exists. Otherwise delete and replace. Default is false." />
+ </serverplugin:parameters>
+ </serverplugin:control>
+
+ <serverplugin:control name="injectAlertDefinition" description="Inject the specified alert definition">
+ <serverplugin:parameters>
+ <c:simple-property name="plugin" type="string" required="true" default="" summary="true"
+ description="The plugin name" />
+ <c:simple-property name="type" type="string" required="true" default="true" summary="true"
+ description="The resource type name" />
+ <c:simple-property name="name" type="string" required="true" default="true" summary="true"
+ description="The name of the alert definition" />
+ <c:simple-property name="replaceIfExists" type="boolean" required="true" default="false"
+ description="If false do not replace the alert definition if it exists. Otherwise delete and replace. Default is false." />
+ </serverplugin:parameters>
+ </serverplugin:control>
+
+ </serverplugin:plugin-component>
+
+ <!-- custom global config - unrelated to schedules -->
+ <serverplugin:plugin-configuration>
+ <c:simple-property name="injectAtPluginStart" type="boolean" required="true" default="true"
+ description="If true inject all templates at server plugin start. Otherwise skip injection. See 'replaceIfExists' property, which affects injection behavior. Default is true." />
+ <c:simple-property name="replaceIfExists" type="boolean" required="true" default="false"
+ description="If false do not replace the alert definition if it exists. Otherwise delete and replace. Default is false." />
+ </serverplugin:plugin-configuration>
+
+
+</generic-plugin>
diff --git a/modules/enterprise/server/plugins/pom.xml b/modules/enterprise/server/plugins/pom.xml
index 827bc41..b6a1eb7 100644
--- a/modules/enterprise/server/plugins/pom.xml
+++ b/modules/enterprise/server/plugins/pom.xml
@@ -53,6 +53,7 @@
<module>alert-subject</module>
<module>alert-cli</module>
<module>alert-log4j</module>
+ <module>alertdef-rhq</module>
<module>cobbler</module>
<module>drift-rhq</module>
<!--
commit cc76229460a4c3b5c90e65c6e5530b18de29179a
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed May 8 16:25:58 2013 -0400
Change the cassandra heartbeat quartz job to be non-volatile because
volatile is treated as non-volatile in a Quartz cluster, and was generating
logging at 5s intervals.
Also, just move the job creation into the existing scheduleJobs method.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java
index a80c210..5888896 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java
@@ -208,7 +208,6 @@ public class StartupBean implements StartupLocal {
//startAgentClients(); // this could be expensive if we have large number of agents so skip it and we'll create them lazily
//startEmbeddedAgent(); // this is obsolete - we no longer have an embedded agent
registerShutdownListener();
- initCassandraClusterHeartBeatJob();
registerPluginDeploymentScannerJob();
logServerStartedMessage();
@@ -584,7 +583,8 @@ public class StartupBean implements StartupLocal {
// Do not check until we are up at least 10 mins, but check every 60 secs thereafter.
final long initialDelay = 1000L * 60 * 10; // 10 mins
final long interval = 1000L * 60; // 60 secs
- schedulerBean.scheduleSimpleRepeatingJob(CheckForSuspectedAgentsJob.class, true, false, initialDelay, interval);
+ schedulerBean.scheduleSimpleRepeatingJob(CheckForSuspectedAgentsJob.class, true, false, initialDelay,
+ interval);
} catch (Exception e) {
log.error("Cannot schedule suspected Agents job.", e);
}
@@ -614,8 +614,8 @@ public class StartupBean implements StartupLocal {
try {
final long initialDelay = 1000L * 60 * 5; // 5 mins
final long interval = 1000L * 60 * 15; // 15 mins
- schedulerBean.scheduleSimpleRepeatingJob(CheckForTimedOutContentRequestsJob.class, true, false, initialDelay,
- interval);
+ schedulerBean.scheduleSimpleRepeatingJob(CheckForTimedOutContentRequestsJob.class, true, false,
+ initialDelay, interval);
} catch (Exception e) {
log.error("Cannot schedule check-for-timed-out-artifact-requests job.", e);
}
@@ -646,9 +646,33 @@ public class StartupBean implements StartupLocal {
log.error("Cannot create alert availability duration job.", e);
}
+ scheduleCassandraClusterHeartBeatJob();
+
return;
}
+ private void scheduleCassandraClusterHeartBeatJob() {
+ String seeds = System.getProperty("rhq.cassandra.seeds");
+ if (seeds != null) {
+ seeds = seeds.replaceAll(";", ",");
+ }
+ String jobTrigger = "CassandraClusterHeartBeatTrigger - " + UUID.randomUUID().toString();
+ String jobGroup = CassandraClusterHeartBeatJob.JOB_NAME + "Group";
+
+ JobDataMap jobDataMap = new JobDataMap();
+ jobDataMap.put(CassandraClusterHeartBeatJob.KEY_CONNECTION_TIMEOUT, "100");
+ jobDataMap.put(CassandraClusterHeartBeatJob.KEY_CASSANDRA_HOSTS, seeds);
+
+ try {
+ schedulerBean.scheduleRepeatingJob(CassandraClusterHeartBeatJob.JOB_NAME, jobGroup, jobDataMap,
+ CassandraClusterHeartBeatJob.class, true, false, 3000, 5000);
+ } catch (SchedulerException e) {
+ String msg = "Unable to schedule " + CassandraClusterHeartBeatJob.class.getSimpleName() + " job. The "
+ + "server will reamin in maintenance mode without a manual override.";
+ log.error(msg, e);
+ }
+ }
+
/**
* This seeds the agent clients cache with clients for all known agents. These clients will be started so they can
* immediately begin to send any persisted guaranteed messages that might already exist. This method must be called
@@ -817,28 +841,6 @@ public class StartupBean implements StartupLocal {
return;
}
- private void initCassandraClusterHeartBeatJob() {
- String seeds = System.getProperty("rhq.cassandra.seeds");
- if (seeds != null) {
- seeds=seeds.replaceAll(";", ",");
- }
- String jobTrigger = "CassandraClusterHeartBeatTrigger - " + UUID.randomUUID().toString();
- String jobGroup = CassandraClusterHeartBeatJob.JOB_NAME + "Group";
-
- JobDataMap jobDataMap = new JobDataMap();
- jobDataMap.put(CassandraClusterHeartBeatJob.KEY_CONNECTION_TIMEOUT, "100");
- jobDataMap.put(CassandraClusterHeartBeatJob.KEY_CASSANDRA_HOSTS, seeds);
-
- try {
- schedulerBean.scheduleRepeatingJob(CassandraClusterHeartBeatJob.JOB_NAME, jobGroup, jobDataMap,
- CassandraClusterHeartBeatJob.class, true, true, 3000, 5000);
- } catch (SchedulerException e) {
- String msg = "Unable to schedule " + CassandraClusterHeartBeatJob.class.getSimpleName() + " job. The " +
- "server will reamin in maintenance mode without a manual override.";
- log.error(msg, e);
- }
- }
-
/**
* Gets the number of milliseconds since the time when the server was last shutdown.
* If we don't know, then return the time since it was started.
commit 7808913b4583b88f1d4c7914fbcd333df269fce9
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed May 8 16:23:11 2013 -0400
more .classpath changes
diff --git a/.classpath b/.classpath
index 2e6f36f..f42d022 100644
--- a/.classpath
+++ b/.classpath
@@ -1,11 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="modules/common/ant-bundle/src/main/java"/>
+ <classpathentry kind="src" path="modules/enterprise/server/plugins/alertdef-rhq/src/main/java"/>
<classpathentry kind="src" path="modules/common/cassandra-util/src/main/java"/>
<classpathentry kind="src" path="modules/common/cassandra-ccm/cassandra-ccm-maven-plugin/src/main/java"/>
<classpathentry kind="src" path="modules/common/cassandra-ccm/cassandra-ccm-core/src/test/java"/>
<classpathentry kind="src" path="modules/common/cassandra-ccm/cassandra-ccm-arquillian/src/main/java"/>
<classpathentry kind="src" path="modules/common/cassandra-installer/src/main/java"/>
+ <classpathentry kind="src" path="modules/common/cassandra-jmx/src/main/java"/>
<classpathentry kind="src" path="modules/enterprise/server/server-control/src/main/java"/>
<classpathentry kind="src" path="modules/enterprise/server/jar/src/test/java"/>
<classpathentry kind="src" path="modules/enterprise/server/itests-2/src/test/java"/>
@@ -209,7 +211,6 @@
<classpathentry kind="src" path="modules/common/cassandra-common-itests/src/main/java"/>
<classpathentry kind="src" path="modules/enterprise/server/server-metrics/src/test/java"/>
<classpathentry kind="src" path="modules/common/cassandra-schema/src/main/java"/>
- <classpathentry kind="src" path="modules/common/cassandra-ccm/cassandra-ccm-cli/src/main/java"/>
<classpathentry kind="src" path="modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java"/>
<classpathentry kind="src" path="modules/common/cassandra-ccm/cassandra-ccm-testng/src/main/java"/>
<classpathentry kind="src" path="modules/common/cassandra-ccm/cassandra-ccm-testng/src/test/java"/>
commit 9c040af64396f49148987d257f8a09f90d3c7fbf
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue May 7 16:36:04 2013 -0400
Server needs more permgen, even in dev container
diff --git a/modules/enterprise/server/appserver/src/main/dev-resources/bin/wrapper/rhq-server-wrapper.inc b/modules/enterprise/server/appserver/src/main/dev-resources/bin/wrapper/rhq-server-wrapper.inc
index a7207b1..c1ce814 100644
--- a/modules/enterprise/server/appserver/src/main/dev-resources/bin/wrapper/rhq-server-wrapper.inc
+++ b/modules/enterprise/server/appserver/src/main/dev-resources/bin/wrapper/rhq-server-wrapper.inc
@@ -9,7 +9,7 @@ wrapper.java.additional.9=-agentlib:jdwp=transport=dt_socket,address=8787,server
wrapper.java.additional.10=-Xms256M
wrapper.java.additional.11=-Xmx512M
wrapper.java.additional.12=-XX:PermSize=128M
-wrapper.java.additional.13=-XX:MaxPermSize=128M
+wrapper.java.additional.13=-XX:MaxPermSize=256M
# enable jprofiler
#set.PATH=%PATH%;<jprofiler-install-dir>\bin\windows
11 years, 1 month
[rhq] modules/enterprise
by mike thompson
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/AvailabilityOverUnderGraphType.java | 24 +++++++---
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 +
modules/enterprise/gui/coregui/src/main/webapp/js/rhq.js | 6 +-
10 files changed, 45 insertions(+), 9 deletions(-)
New commits:
commit 8091c631ae4cebe9a19825f3c107753590bec922
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Wed May 8 10:15:23 2013 -0700
[BZ 960646] - RFE Redesigned Availability Chart - i18n.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/AvailabilityOverUnderGraphType.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/AvailabilityOverUnderGraphType.java
index f0db5a2..fbce610 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/AvailabilityOverUnderGraphType.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/AvailabilityOverUnderGraphType.java
@@ -124,11 +124,13 @@ public class AvailabilityOverUnderGraphType {
global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityOverUnderGraphType::getChartDateLabel()(),
global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityOverUnderGraphType::getChartTimeLabel()(),
global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityOverUnderGraphType::getChartHoverStartLabel()(),
- global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityOverUnderGraphType::getChartHoverEndLabel()(),
global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityOverUnderGraphType::getChartHoverBarLabel()(),
global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityOverUnderGraphType::getChartHoverAvailabilityLabel()(),
global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityOverUnderGraphType::getChartHoverTimeFormat()(),
- global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityOverUnderGraphType::getChartHoverDateFormat()()
+ global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityOverUnderGraphType::getChartHoverDateFormat()(),
+ global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityOverUnderGraphType::getAvailChartTitleLabel()(),
+ global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityOverUnderGraphType::getAvailChartUpLabel()(),
+ global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityOverUnderGraphType::getAvailChartDownLabel()()
);
@@ -264,7 +266,7 @@ public class AvailabilityOverUnderGraphType {
.style("font-family", "Arial, Verdana, sans-serif;")
.style("font-weight", "bold")
.attr("fill", "#003168")
- .text("Availability");
+ .text(availChartContext.chartTitle);
svg.append("text")
.attr("class", "upLabel")
@@ -274,7 +276,7 @@ public class AvailabilityOverUnderGraphType {
.style("font-size", "9px")
.attr("fill", "#50505a")
.style("text-anchor", "end")
- .text("UP");
+ .text(availChartContext.chartUpLabel);
svg.append("text")
.attr("class", "downLabel")
@@ -284,7 +286,7 @@ public class AvailabilityOverUnderGraphType {
.style("font-size", "9px")
.attr("fill", "#50505a")
.style("text-anchor", "end")
- .text("DOWN");
+ .text(availChartContext.chartDownLabel);
}
@@ -355,8 +357,16 @@ public class AvailabilityOverUnderGraphType {
return MSG.chart_hover_start_label();
}
- public String getChartHoverEndLabel() {
- return MSG.chart_hover_end_label();
+ public String getAvailChartDownLabel() {
+ return MSG.avail_chart_down_label();
+ }
+
+ public String getAvailChartUpLabel() {
+ return MSG.avail_chart_up_label();
+ }
+
+ public String getAvailChartTitleLabel() {
+ return MSG.avail_chart_title_label();
}
public String getChartHoverBarLabel() {
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 0c5af20..00a68ef 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
@@ -6,6 +6,9 @@
# https://docs.jboss.org/author/display/RHQ/Working+with+the+Resource+Bundles
#
###################################
+avail_chart_down_label = DOWN
+avail_chart_title_label = Availability
+avail_chart_up_label = UP
chart_date_label = Date
chart_down_label = Down
chart_hover_availability_label = Availability
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 42405aa..a27fb3c 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
@@ -29,6 +29,9 @@
# https://docs.jboss.org/author/display/RHQ/Working+with+the+Resource+Bundles
#
###################################
+##avail_chart_down_label = DOWN
+##avail_chart_title_label = Availability
+##avail_chart_up_label = UP
##chart_date_label = Date
##chart_down_label = Down
##chart_time_label = Start
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 8185e7f..5415ed0 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
@@ -9,6 +9,9 @@
# https://docs.jboss.org/author/display/RHQ/Working+with+the+Resource+Bundles
#
###################################
+##avail_chart_down_label = DOWN
+##avail_chart_title_label = Availability
+##avail_chart_up_label = UP
##chart_date_label = Date
##chart_down_label = Down
##chart_time_label = Start
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 c15e129..8f47413 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
@@ -9,6 +9,9 @@
# https://docs.jboss.org/author/display/RHQ/Working+with+the+Resource+Bundles
#
###################################
+##avail_chart_down_label = DOWN
+##avail_chart_title_label = Availability
+##avail_chart_up_label = UP
##chart_date_label = Date
##chart_down_label = Down
##chart_time_label = Start
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 8105460..5d19d06 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
@@ -7,6 +7,9 @@
# https://docs.jboss.org/author/display/RHQ/Working+with+the+Resource+Bundles
#
###################################
+##avail_chart_down_label = DOWN
+##avail_chart_title_label = Availability
+##avail_chart_up_label = UP
##chart_date_label = Date
##chart_down_label = Down
##chart_time_label = Start
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 d50a54e..743c4b5 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
@@ -6,6 +6,9 @@
# https://docs.jboss.org/author/display/RHQ/Working+with+the+Resource+Bundles
#
###################################
+##avail_chart_down_label = DOWN
+##avail_chart_title_label = Availability
+##avail_chart_up_label = UP
##chart_date_label = Date
##chart_down_label = Down
##chart_time_label = Start
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 fb45e35..772c4e4 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
@@ -6,6 +6,9 @@
## http://rhq-project.org/display/RHQ/Working+with+the+Resource+Bundles
##
####################################
+##avail_chart_down_label = DOWN
+##avail_chart_title_label = Availability
+##avail_chart_up_label = UP
##chart_date_label = Date
##chart_down_label = Down
##chart_time_label = Start
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 e929386..03dfa4e 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
@@ -6,6 +6,9 @@
# https://docs.jboss.org/author/display/RHQ/Working+with+the+Resource+Bundles
#
###################################
+##avail_chart_down_label = DOWN
+##avail_chart_title_label = Availability
+##avail_chart_up_label = UP
##chart_date_label = Date
##chart_down_label = Down
##chart_time_label = Start
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 081a9a2..3b35252 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/js/rhq.js
+++ b/modules/enterprise/gui/coregui/src/main/webapp/js/rhq.js
@@ -48,7 +48,7 @@ var ChartContext = function (chartId, chartHeight, metricsData, xAxisLabel, char
this.chartSelection = this.chartHandle + " svg";
},
-AvailChartContext = function (chartId, availData, dateLabel, timeLabel, hoverStartLabel, hoverEndLabel, hoverBarLabel, availabilityLabel, chartHoverTimeFormat, chartHoverDateFormat) {
+AvailChartContext = function (chartId, availData, dateLabel, timeLabel, hoverStartLabel, hoverBarLabel, availabilityLabel, chartHoverTimeFormat, chartHoverDateFormat, chartTitle, chartUpLabel, chartDownLabel) {
"use strict";
if (!(this instanceof AvailChartContext)) {
throw new Error("AvailChartContext function cannot be called as a function.")
@@ -60,10 +60,12 @@ AvailChartContext = function (chartId, availData, dateLabel, timeLabel, hoverSta
this.dateLabel = dateLabel;
this.timeLabel = timeLabel;
this.hoverStartLabel = hoverStartLabel;
- this.hoverEndLabel = hoverEndLabel;
this.hoverBarLabel = hoverBarLabel;
this.hoverBarAvailabilityLabel = availabilityLabel;
this.chartHoverTimeFormat = chartHoverTimeFormat;
this.chartHoverDateFormat = chartHoverDateFormat;
+ this.chartTitle = chartTitle;
+ this.chartDownLabel = chartDownLabel;
+ this.chartUpLabel = chartUpLabel;
};
11 years, 1 month
[rhq] 2 commits - modules/enterprise
by mike thompson
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/AvailabilityOverUnderGraphType.java | 10 +--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/StackedBarMetricGraphImpl.java | 21 ++------
modules/enterprise/gui/coregui/src/main/webapp/js/rhq.js | 26 +---------
3 files changed, 14 insertions(+), 43 deletions(-)
New commits:
commit 59df0f08367521576187063a6bbafaa6ba0be9c2
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Wed May 8 08:45:18 2013 -0700
Make x-axis more readable on Safari, IE. These browsers even though they are using the same SVG fonts, render wider fonts showing up as labels running into one another. Reduced the clutter on the x-axis for increased readability.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/AvailabilityOverUnderGraphType.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/AvailabilityOverUnderGraphType.java
index e38df39..f0db5a2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/AvailabilityOverUnderGraphType.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/AvailabilityOverUnderGraphType.java
@@ -162,7 +162,7 @@ public class AvailabilityOverUnderGraphType {
xAxis = $wnd.d3.svg.axis()
.scale(timeScale)
- .ticks(12)
+ .ticks(8)
.tickSize(13, 0, 0)
.orient("bottom"),
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/StackedBarMetricGraphImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/StackedBarMetricGraphImpl.java
index bf08615..4d71192 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/StackedBarMetricGraphImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/StackedBarMetricGraphImpl.java
@@ -129,13 +129,8 @@ public class StackedBarMetricGraphImpl extends AbstractGraph {
else {
console.log("Using Large Charts Profile");
// we use the width already defined above
- if(isIEBrowserGreaterThanOrEqualTo(9)){
- xTicks = 8;
- xTickSubDivide = 5;
- }else {
- xTicks = 12;
- xTickSubDivide = 5;
- }
+ xTicks = 8;
+ xTickSubDivide = 5;
chartData = chartContext.data;
}
commit c8bbd8b0c5dcfa51a2d653a95bc83d73d80178be
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Wed May 8 08:30:08 2013 -0700
[BZ 960521] Globally uncaught exception on clicking on resource name link on IE9.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/AvailabilityOverUnderGraphType.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/AvailabilityOverUnderGraphType.java
index 4e6a0ce..e38df39 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/AvailabilityOverUnderGraphType.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/AvailabilityOverUnderGraphType.java
@@ -215,7 +215,7 @@ public class AvailabilityOverUnderGraphType {
}
else {
// should not ever happen, but...
- console.warn("AvailabilityType not valid.");
+ console.log("AvailabilityType not valid.");
return "#000"; //black
}
},
@@ -318,13 +318,11 @@ public class AvailabilityOverUnderGraphType {
return {
// Public API
- draw: function (chartContext) {
+ draw: function (availChartContext) {
"use strict";
- console.info("AvailabilityChart");
- //console.time("availabilityChart");
+ console.log("AvailabilityChart");
drawBars(availChartContext);
createHovers();
- //console.timeEnd("availabilityChart");
}
}; // end public closure
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/StackedBarMetricGraphImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/StackedBarMetricGraphImpl.java
index 15f400d..bf08615 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/StackedBarMetricGraphImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/StackedBarMetricGraphImpl.java
@@ -38,7 +38,7 @@ public class StackedBarMetricGraphImpl extends AbstractGraph {
*/
@Override
public native void drawJsniChart() /*-{
- //console.log("Draw Stacked Bar jsni chart");
+ console.log("Draw Stacked Bar jsni chart");
var global = this,
// create a chartContext object (from rhq.js) with the data required to render to a chart
@@ -120,14 +120,14 @@ public class StackedBarMetricGraphImpl extends AbstractGraph {
// if window is too small server up small chart
if (useSmallCharts()) {
- //console.log("Using Small Charts Profile for width: "+getChartWidth());
+ console.log("Using Small Charts Profile for width: "+getChartWidth());
width = 250;
xTicks = 3;
xTickSubDivide = 2;
chartData = chartContext.data.slice(chartContext.data.length - numberOfBarsForSmallGraph, chartContext.data.length - 1);
}
else {
- //console.log("Using Large Charts Profile");
+ console.log("Using Large Charts Profile");
// we use the width already defined above
if(isIEBrowserGreaterThanOrEqualTo(9)){
xTicks = 8;
@@ -613,8 +613,7 @@ public class StackedBarMetricGraphImpl extends AbstractGraph {
"use strict";
// Guard condition that can occur when a portlet has not been configured yet
if (chartContext.data.length > 0) {
- //console.info("Creating Chart: "+ chartContext.chartSelection + " --> "+ chartContext.chartTitle);
- //console.time("chart");
+ console.log("Creating Chart: "+ chartContext.chartSelection + " --> "+ chartContext.chartTitle);
determineScale();
createHeader(chartContext.chartTitle);
@@ -624,11 +623,10 @@ public class StackedBarMetricGraphImpl extends AbstractGraph {
createXandYAxes();
createAvgLines();
if (oobMax > 0) {
- //console.info("OOB Data Exists!");
+ console.log("OOB Data Exists!");
createOOBLines();
}
createHovers(chartContext);
- //console.timeEnd("chart");
}
}
}; // end public closure
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 27c4cc0..081a9a2 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/js/rhq.js
+++ b/modules/enterprise/gui/coregui/src/main/webapp/js/rhq.js
@@ -2,29 +2,9 @@
* Charting Javascript Functions.
*/
-// Avoid `console` errors in browsers that lack a console.
-(function() {
- var method;
- var noop = function () {};
- var methods = [
- 'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
- 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
- 'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
- 'timeStamp', 'trace', 'warn'
- ];
- var length = methods.length;
- var console = (window.console = window.console || {});
-
- while (length--) {
- method = methods[length];
-
- // Only stub undefined methods.
- if (!console[method]) {
- console[method] = noop;
- }
- }
-} ());
-
+// Handle browsers not supporting console object
+if (!window.console) window.console = {};
+if (!window.console.log) window.console.log = function () { };
/**
* ChartContext Constructor Object
11 years, 1 month