modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeDiscoveryComponent.java
| 15 ++++++++--
modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml
| 7 ++--
2 files changed, 16 insertions(+), 6 deletions(-)
New commits:
commit c25b47396cacc3aff6d653c638a0ec4e23f1a6d0
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Wed May 1 11:45:02 2013 -0500
Update the plugin configuration propertiest to capture the file path for the yaml
file. Also, remove and update other properties that were not used properly.
diff --git
a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeDiscoveryComponent.java
b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeDiscoveryComponent.java
index afb5cd9..cda0fe5 100644
---
a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeDiscoveryComponent.java
+++
b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeDiscoveryComponent.java
@@ -69,15 +69,18 @@ public class CassandraNodeDiscoveryComponent extends
JMXDiscoveryComponent {
@SuppressWarnings({ "unchecked", "deprecation" })
private DiscoveredResourceDetails getDetails(ResourceDiscoveryContext<?>
context,
ProcessScanResult processScanResult) {
+
ProcessInfo processInfo = processScanResult.getProcessInfo();
- Configuration pluginConfig = new Configuration();
+ Configuration pluginConfig = context.getDefaultPluginConfiguration();
String jmxPort = null;
String[] arguments = processInfo.getCommandLine();
+ StringBuilder commandLineBuilder = new StringBuilder(400);
int classpathIndex = -1;
+
for (int i = 0; i < arguments.length; i++) {
String arg = arguments[i];
@@ -88,8 +91,13 @@ public class CassandraNodeDiscoveryComponent extends
JMXDiscoveryComponent {
if (arg.startsWith("-cp")) {
classpathIndex = i;
}
+
+ commandLineBuilder.append(arg);
+ commandLineBuilder.append(' ');
}
+ pluginConfig.put(new PropertySimple("commandLine",
commandLineBuilder.toString()));
+
if (classpathIndex != -1 && classpathIndex + 1 < arguments.length) {
String[] classpathEntries = arguments[classpathIndex +
1].split(":");
@@ -104,7 +112,10 @@ public class CassandraNodeDiscoveryComponent extends
JMXDiscoveryComponent {
InputStream inputStream = null;
try {
- inputStream = new FileInputStream(new File(yamlConfigurationPath +
"/cassandra.yaml"));
+ File yamlConfigurationFile = new File(yamlConfigurationPath +
"/cassandra.yaml");
+ pluginConfig.put(new PropertySimple("yamlConfiguration",
yamlConfigurationFile.getAbsolutePath()));
+
+ inputStream = new FileInputStream(yamlConfigurationFile);
Yaml yaml = new Yaml();
Map<String, String> parsedProperties = (Map<String,
String>) yaml.load(inputStream);
diff --git a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml
b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml
index 66f867d..39b93e9 100644
--- a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml
@@ -38,21 +38,20 @@
description="The RMI URL with which to connect to the
Cassandra node (e.g. service:jmx:rmi:///jndi/rmi://localhost:7199/jmxrmi)."/>
<c:simple-property name="type" readOnly="true"
default="org.mc4j.ems.connection.support.metadata.J2SE5ConnectionTypeDescriptor"
description="The type used to establish the EMS connection
to the Cassandra node."/>
- <c:simple-property name="installURI" required="false"
type="string" description="The installation path for the selected server
type which will be used to find client libraries (if appropriate)"/>
<c:simple-property name="username" default="cassandra"
required="true" description="The login username"/>
<c:simple-property name="password" default="cassandra"
required="true" type="password" description="The login
password"/>
- <c:simple-property name="additionalClassPathEntries"
required="false" type="string" description="Comma-separated list
of directories and filenames that contain resources and classes needed to communicate with
the JMX Server and its MBeans. If you specify 'some/directory/*.jar', all jars
found in the given directory will be added."/>
- <c:simple-property name="commandLine" required="false"
type="string" description="the command line of the JVM at the time it was
discovered - only used by JVMs with type Local; if the command line of the JVM changes,
this property's value will need to be updated accordingly in order for RHQ to connect
to the JVM"/>
<c:simple-property name="baseDir" displayName="Base
Directory" description="The base directory from which the Cassandra Daemon was
launched." required="false"/>
+ <c:simple-property name="yamlConfiguration" displayName="YAML
Configuration File" description="YAML Configuration File"/>
<c:simple-property name="nativeTransportPort" description="The
port on which Cassandra listens for CQL client connections." default="9042"
type="integer"/>
<c:simple-property name="host" description="The host on which
cassandra listens to CQL client connections" default="localhost"/>
<c:simple-property name="clusterName" description="Cluster
name" default="localhost"/>
- <c:simple-property name="authenticator" required="true"
default="org.apache.cassandra.auth.AllowAllAuthenticator">
+ <c:simple-property name="authenticator" required="true"
default="org.apache.cassandra.auth.AllowAllAuthenticator"
description="Cassandra client authenticator">
<c:property-options>
<c:option name="org.apache.cassandra.auth.AllowAllAuthenticator"
value="org.apache.cassandra.auth.AllowAllAuthenticator"/>
<c:option name="org.apache.cassandra.auth.PasswordAuthenticator"
value="org.apache.cassandra.auth.PasswordAuthenticator"/>
</c:property-options>
</c:simple-property>
+ <c:simple-property name="commandLine" required="false"
type="string" description="the command line of the JVM at the time it was
discovered - only used by JVMs with type Local; if the command line of the JVM changes,
this property's value will need to be updated accordingly in order for RHQ to connect
to the JVM"/>
</plugin-configuration>
<process-scan name="CassandraDaemon"
query="process|basename|match=^java.*,arg|org.apache.cassandra.service.CassandraDaemon|match=.*"/>