[rhq] Branch 'feature/cassandra-backend' - modules/common
by John Sanda
modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java | 1 +
1 file changed, 1 insertion(+)
New commits:
commit 493fe40fd7c8b1ea9dc3111f18ac78f163ab1b2a
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed May 1 17:44:51 2013 -0400
return non-zero exit code when installer receives bad command line
diff --git a/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java b/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java
index 02fcd22..adf3670 100644
--- a/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java
+++ b/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java
@@ -566,6 +566,7 @@ public class StorageInstaller {
System.exit(1);
} catch (ParseException e) {
installer.printUsage();
+ System.exit(STATUS_SHOW_USAGE);
}
}
11 years
[rhq] Branch 'feature/cassandra-backend' - modules/common
by John Sanda
modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java | 42 ++++++++--
1 file changed, 37 insertions(+), 5 deletions(-)
New commits:
commit 6af11391e9a3e5f411108e2ecb3af118663e1cf5
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed May 1 17:05:25 2013 -0400
adding new memory options to storage installer
diff --git a/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java b/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java
index 9ea1d65..02fcd22 100644
--- a/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java
+++ b/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java
@@ -164,12 +164,31 @@ public class StorageInstaller {
Option basedirOption = new Option(null, "dir", true, "The directory where the storage node will be installed "
+ "The default directory will be " + storageBasedir);
+ Option heapSizeOption = new Option(null, "heap-size", true, "The value to use for both the min and max heap. " +
+ "This value is passed directly to the -Xms and -Xmx options of the Java executable.");
+
+ Option heapNewSizeOption = new Option(null, "heap-new-size", true, "The value to use for the new generation " +
+ "of the heap. This value is passed directly to the -Xmn option of the Java executable");
+
+ Option stackSizeOption = new Option(null, "stack-size", true, "The value to use for the thread stack size. " +
+ "This value is passed directly to the -Xss option of the Java executable.");
+
options = new Options().addOption(new Option("h", "help", false, "Show this message."))
.addOption(hostname)
- //.addOption(seeds)
- .addOption(jmxPortOption).addOption(startOption).addOption(checkStatus).addOption(commitLogOption)
- .addOption(dataDirOption).addOption(savedCachesDirOption).addOption(nativeTransportPortOption)
- .addOption(storagePortOption).addOption(sslStoragePortOption).addOption(basedirOption);
+ .addOption(seeds)
+ .addOption(jmxPortOption)
+ .addOption(startOption)
+ .addOption(checkStatus)
+ .addOption(commitLogOption)
+ .addOption(dataDirOption)
+ .addOption(savedCachesDirOption)
+ .addOption(nativeTransportPortOption)
+ .addOption(storagePortOption)
+ .addOption(sslStoragePortOption)
+ .addOption(basedirOption)
+ .addOption(heapSizeOption)
+ .addOption(heapNewSizeOption)
+ .addOption(stackSizeOption);
}
public int run(CommandLine cmdLine) throws Exception {
@@ -201,7 +220,7 @@ public class StorageInstaller {
// Rather than have the user specify the seeds for each node, the installer can
// obtain the list either from the RHQ server or directly from querying the
// database.
- String seeds = hostname;
+ String seeds = cmdLine.getOptionValue("seeds", hostname);
deploymentOptions.setSeeds(seeds);
commitLogDir = cmdLine.getOptionValue("commitlog", commitLogDir);
@@ -220,6 +239,19 @@ public class StorageInstaller {
deploymentOptions.setNativeTransportPort(getPort(cmdLine, "client-port", nativeTransportPort));
deploymentOptions.setStoragePort(getPort(cmdLine, "storage-port", storagePort));
deploymentOptions.setSslStoragePort(getPort(cmdLine, "ssl-storage-port", sslStoragePort));
+
+ if (cmdLine.hasOption("heap-size")) {
+ deploymentOptions.setHeapSize(cmdLine.getOptionValue("heap-size"));
+ }
+
+ if (cmdLine.hasOption("heap-new-size")) {
+ deploymentOptions.setHeapNewSize(cmdLine.getOptionValue("heap-new-size"));
+ }
+
+ if (cmdLine.hasOption("stack-size")) {
+ deploymentOptions.setStackSize(cmdLine.getOptionValue("stack-size"));
+ }
+
deploymentOptions.load();
List<String> errors = new ArrayList<String>();
11 years
[rhq] Branch 'feature/cassandra-backend' - modules/plugins
by snegrea
modules/plugins/cassandra/pom.xml | 46 ++++++++++++++++++++++++++++++++++++--
1 file changed, 44 insertions(+), 2 deletions(-)
New commits:
commit b0d5ec4b4d08e20a2e8cf46069541c5b8bcb11a4
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Wed May 1 15:24:23 2013 -0500
Add back all the transitive dependencies that were packaged by the plugin.
diff --git a/modules/plugins/cassandra/pom.xml b/modules/plugins/cassandra/pom.xml
index a88d6e3..3396a5c 100644
--- a/modules/plugins/cassandra/pom.xml
+++ b/modules/plugins/cassandra/pom.xml
@@ -86,10 +86,42 @@
<artifactItem>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
+ <version>${cassandra.driver.version}</version>
</artifactItem>
<artifactItem>
- <groupId>org.yaml</groupId>
- <artifactId>snakeyaml</artifactId>
+ <groupId>io.netty</groupId>
+ <artifactId>netty</artifactId>
+ <version>${cassandra.driver.netty.version}</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.apache.cassandra</groupId>
+ <artifactId>cassandra-all</artifactId>
+ <version>${cassandra.version}</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.apache.cassandra</groupId>
+ <artifactId>cassandra-thrift</artifactId>
+ <version>${cassandra.version}</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.apache.thrift</groupId>
+ <artifactId>libthrift</artifactId>
+ <version>${cassandra.thrift.version}</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>14.0.1</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>com.yammer.metrics</groupId>
+ <artifactId>metrics-core</artifactId>
+ <version>2.2.0</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.7.2</version>
</artifactItem>
<artifactItem>
<groupId>org.slf4j</groupId>
@@ -101,6 +133,16 @@
<artifactId>snappy-java</artifactId>
<version>1.0.5-M3-p1</version>
</artifactItem>
+ <artifactItem>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-core-asl</artifactId>
+ <version>1.9.2</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-mapper-asl</artifactId>
+ <version>1.9.2</version>
+ </artifactItem>
</artifactItems>
</configuration>
</execution>
11 years
[rhq] Branch 'feature/cassandra-backend' - modules/enterprise
by John Sanda
modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Start.java | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
New commits:
commit f2ca644478727134ea6e20cf74e0bdc871fe50a5
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed May 1 15:59:46 2013 -0400
fix start command for server
There was a check for the pid file that should not be there
diff --git a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Start.java b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Start.java
index ef25370..2658ac8 100644
--- a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Start.java
+++ b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Start.java
@@ -163,11 +163,7 @@ public class Start extends ControlCommand {
log.debug("Failed to start server service", e);
}
} else {
- String pid = getServerPid();
-
- if (pid != null) {
- executor.execute(commandLine);
- }
+ executor.execute(commandLine);
}
}
11 years
[rhq] modules/enterprise
by mike thompson
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml | 11 +++++
modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html | 20 +++-------
2 files changed, 18 insertions(+), 13 deletions(-)
New commits:
commit 93a7c3264c30a6ea08d2c767fa6f087a3a86aa1d
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Wed May 1 07:54:40 2013 -0700
Fix IE issues with "Move jquery(1.7.2) library out of CoreGUI.gwt.xml now that we don't have GFlot dependency (GFlot was removed with addition of d3 charts)."
This reverts commit 8c54ef01abaa6790f49f96c492fe6649a0245a6f.
Revert "UI Performance - Move non-essential javascripts (like charting) out of CoreGUI.gwt.xml to CoreGUI.html and add the 'defer' script evaluation attribute for faster page load time. Also moved stylesheets to load ahead of javascripts as they load faster and provide less blocking time than the external javascripts. This shaved about 0.5 sec on my box will probably save more on slower hardware/connection/mobile. The *.gwt.xml prevents race conditions at the expense of speed so moving out increases startup speed."
This commit has unintended consequences for IE9 browser. Javascript
libraries that are supposed to be loaded are not (although this works in
other browsers).
This reverts commit e4ac4b1b628ae5e577510045ead7967a603d4c1c.
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
index 7d50e87..f3c93be 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
@@ -46,6 +46,17 @@
<when-type-assignable class="com.google.gwt.user.client.rpc.RemoteService"/>
</generate-with>
+ <!-- External javascript libraries -->
+ <!-- jquery.sparkline requires jquery. We don't explicitly provide jquery here because it is already
+ embedded in the GFlot JAR (the charting lib used for GraphPortlet). Furthermore, GFlot 2.4.2 requires
+ the version of jquery (1.7.2).
+ -->
+ <script src="/coregui/js/jquery-1.7.2.min.js"/>
+ <script src="/coregui/js/jquery.sparkline-2.1.min.js"/>
+ <script src="/coregui/js/d3.v3.js"/>
+ <script src="/coregui/js/nv.d3.js"/>
+ <script src="/coregui/js/jquery.tipsy.js"/>
+
<!--
Limit compilation to your preferred browser(s) to speed up compile time.
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html
index 1b69b53..206b586 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html
+++ b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html
@@ -10,19 +10,7 @@
<!-- support internationalized characters -->
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
- <link rel="stylesheet" href="CoreGUI.css">
- <link rel="stylesheet" href="css/nv.d3.css">
- <link rel="stylesheet" href="css/tipsy.css">
- <link rel="stylesheet" href="css/charts.css">
-
- <script defer="defer" type="text/javascript" src="/coregui/js/rhq.js"></script>
- <script defer="defer" type="text/javascript" src="/coregui/js/d3.v3.js"></script>
- <script defer="defer" type="text/javascript" src="/coregui/js/nv.d3.js"></script>
- <!-- jquery dependent js libs -->
- <script defer="defer" type="text/javascript" src="/coregui/js/jquery-1.7.2.min.js"></script>
- <script defer="defer" type="text/javascript" src="/coregui/js/jquery.sparkline-2.1.min.js"></script>
- <script defer="defer" type="text/javascript" src="/coregui/js/jquery.tipsy.js"></script>
-
+ <script type="text/javascript" src="js/rhq.js"></script>
<script type="text/javascript">
var search = location.search;
// only do this if you have not specified locale as query param
@@ -42,6 +30,12 @@
var isomorphicDir = "org.rhq.enterprise.gui.coregui.CoreGUI/sc/";
</script>
+
+ <link rel="stylesheet" href="CoreGUI.css">
+ <link rel="stylesheet" href="css/nv.d3.css">
+ <link rel="stylesheet" href="css/tipsy.css">
+ <link rel="stylesheet" href="css/charts.css">
+
</head>
<body>
11 years
[rhq] Branch 'feature/cassandra-backend' - modules/common
by John Sanda
modules/common/cassandra-schema/src/main/java/org/rhq/cassandra/schema/SchemaManager.java | 11 ++++++++++
1 file changed, 11 insertions(+)
New commits:
commit 5ff96204c205dd5fd713217a7c7ba91822a46cd3
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed May 1 12:57:52 2013 -0400
temporary fix for applying shcema changes when schema already exists
diff --git a/modules/common/cassandra-schema/src/main/java/org/rhq/cassandra/schema/SchemaManager.java b/modules/common/cassandra-schema/src/main/java/org/rhq/cassandra/schema/SchemaManager.java
index 8b44bd2..5581782 100644
--- a/modules/common/cassandra-schema/src/main/java/org/rhq/cassandra/schema/SchemaManager.java
+++ b/modules/common/cassandra-schema/src/main/java/org/rhq/cassandra/schema/SchemaManager.java
@@ -117,6 +117,13 @@ public class SchemaManager {
log.debug("Creating keyspace [" + RHQ_KEYSPACE + "]");
session.execute(
"CREATE KEYSPACE rhq WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};");
+
+ // Note that once we have a schema management tool back in place, the call
+ // to createTables will be moved back to the updateSchema method as it
+ // previously was when we were using liquibase. We do NOT want to have
+ // separate install/update schema changes. Treating everything as an update as
+ // liquibase does dramatically simplifies things.
+ createTables();
} catch (NoHostAvailableException e) {
throw new RuntimeException(e);
}
@@ -143,6 +150,10 @@ public class SchemaManager {
public void updateSchema() {
log.info("Applying schema updates");
+ //createTables();
+ }
+
+ private void createTables() {
try {
log.debug("Creating table raw_metrics");
session.execute(
11 years
[rhq] Branch 'feature/cassandra-backend' - modules/plugins
by snegrea
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=.*"/>
11 years
[rhq] modules/common modules/enterprise
by mazz
modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/CoreJBossASClient.java | 23
modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/LoggingJBossASClient.java | 4
modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/SecurityDomainJBossASClient.java | 109 ----
modules/enterprise/server/appserver/src/main/dev-resources/bin/rhq-autoinstall.sh | 2
modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml | 30 -
modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java | 30 -
modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerService.java | 17
modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java | 75 ---
modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java | 250 ++--------
9 files changed, 101 insertions(+), 439 deletions(-)
New commits:
commit 4c50679d28c84c2d0057c2438bb985c562fc8ac5
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed May 1 12:14:40 2013 -0400
BZ 893609 - remove temp workaround code now that we are on a newer EAP that doesn't have the bad issues anymore
diff --git a/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/CoreJBossASClient.java b/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/CoreJBossASClient.java
index 9a766f4..8cef6e1 100644
--- a/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/CoreJBossASClient.java
+++ b/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/CoreJBossASClient.java
@@ -46,6 +46,29 @@ public class CoreJBossASClient extends JBossASClient {
}
/**
+ * Given a string with possible ${x} expressions in it, this will resolve that expression
+ * using system property values that are set within the AS JVM itself. If the string
+ * to resolve has no expressions, or has no expressions that are resolveable, the expression
+ * string itself is returned as-is (this includes if <code>expression</code> is <code>null</code>).
+ *
+ * @param expression string containing zero, one or more ${x} expressions to be resolved
+ * @return the expression with the expressions resolved using system properties of the AS JVM
+ * @throws Exception if failed to resolve the expression.
+ */
+ public String resolveExpression(String expression) throws Exception {
+ if (expression == null || expression.length() == 0) {
+ return expression;
+ }
+ final ModelNode request = createRequest("resolve-expression", Address.root());
+ request.get("expression").set(expression);
+ final ModelNode response = execute(request);
+ if (!isSuccess(response)) {
+ throw new FailureException(response);
+ }
+ return getResults(response).asString();
+ }
+
+ /**
* This returns the system properties that are set in the AS JVM. This is not the system properties
* in the JVM of this client object - it is actually the system properties in the remote
* JVM of the AS instance that the client is talking to.
diff --git a/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/LoggingJBossASClient.java b/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/LoggingJBossASClient.java
index babe373..ee7466e 100644
--- a/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/LoggingJBossASClient.java
+++ b/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/LoggingJBossASClient.java
@@ -72,7 +72,7 @@ public class LoggingJBossASClient extends JBossASClient {
final ModelNode request;
if (isLogger(loggerName)) {
- request = createWriteAttributeRequest("level", level.toUpperCase(), addr);
+ request = createWriteAttributeRequest("level", level, addr);
} else {
final String dmrTemplate = "" //
+ "{" //
@@ -80,7 +80,7 @@ public class LoggingJBossASClient extends JBossASClient {
+ ", \"level\" => \"%s\" " //
+ ", \"use-parent-handlers\" => \"true\" " //
+ "}";
- final String dmr = String.format(dmrTemplate, loggerName, level.toUpperCase());
+ final String dmr = String.format(dmrTemplate, loggerName, level);
request = ModelNode.fromString(dmr);
request.get(OPERATION).set(ADD);
diff --git a/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/SecurityDomainJBossASClient.java b/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/SecurityDomainJBossASClient.java
index f977f0a..5caa45e 100644
--- a/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/SecurityDomainJBossASClient.java
+++ b/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/SecurityDomainJBossASClient.java
@@ -26,6 +26,7 @@ import javax.security.auth.login.AppConfigurationEntry.LoginModuleControlFlag;
import org.jboss.as.controller.client.ModelControllerClient;
import org.jboss.dmr.ModelNode;
+import org.jboss.dmr.ModelType;
/**
* Provides convenience methods associated with security domain management.
@@ -71,49 +72,6 @@ public class SecurityDomainJBossASClient extends JBossASClient {
* Create a new security domain using the SecureIdentity authentication method.
* This is used when you want to obfuscate a database password in the configuration.
*
- * @param securityDomainName the name of the new security domain
- * @param username the username associated with the security domain
- * @param password the value of the password to store in the configuration (e.g. the obfuscated password itself)
- *
- * @throws Exception if failed to create security domain
- */
- public void createNewSecureIdentitySecurityDomain71(String securityDomainName, String username, String password)
- throws Exception {
-
- Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_SECURITY, SECURITY_DOMAIN, securityDomainName);
- ModelNode addTopNode = createRequest(ADD, addr);
- addTopNode.get(CACHE_TYPE).set("default");
-
- ModelNode addAuthNode = createRequest(ADD, addr.clone().add(AUTHENTICATION, CLASSIC));
- ModelNode loginModulesNode = addAuthNode.get(LOGIN_MODULES);
- ModelNode loginModule = new ModelNode();
- loginModule.get(CODE).set("SecureIdentity");
- loginModule.get(FLAG).set("required");
- ModelNode moduleOptions = loginModule.get(MODULE_OPTIONS);
- moduleOptions.setEmptyList();
- // TODO: we really want to use addExpression (e.g. ${rhq.server.database.user-name})
- // for username and password so rhq-server.properties can be used to set these.
- // However, AS7.1 doesn't support this yet - see https://issues.jboss.org/browse/AS7-5177
- moduleOptions.add(USERNAME, username);
- moduleOptions.add(PASSWORD, password);
- loginModulesNode.add(loginModule);
-
- ModelNode batch = createBatchRequest(addTopNode, addAuthNode);
-
- System.err.println("== security domain ==> " + batch.toJSONString(false));
-
- ModelNode results = execute(batch);
- if (!isSuccess(results)) {
- throw new FailureException(results, "Failed to create security domain [" + securityDomainName + "]");
- }
-
- return;
- }
-
- /**
- * Create a new security domain using the SecureIdentity authentication method.
- * This is used when you want to obfuscate a database password in the configuration.
- *
* This is the version for as7.2+ (e.g. eap 6.1)
*
* @param securityDomainName the name of the new security domain
@@ -139,11 +97,8 @@ public class SecurityDomainJBossASClient extends JBossASClient {
loginModule.get(FLAG).set("required");
ModelNode moduleOptions = loginModule.get(MODULE_OPTIONS);
moduleOptions.setEmptyList();
- // TODO: we really want to use addExpression (e.g. ${rhq.server.database.user-name})
- // for username and password so rhq-server.properties can be used to set these.
- // However, AS7.1 doesn't support this yet - see https://issues.jboss.org/browse/AS7-5177
- moduleOptions.add(USERNAME, username);
- moduleOptions.add(PASSWORD, password);
+ addPossibleExpression(moduleOptions, USERNAME, username);
+ addPossibleExpression(moduleOptions, PASSWORD, password);
ModelNode batch = createBatchRequest(addTopNode, addAuthNode, loginModule);
@@ -178,11 +133,8 @@ public class SecurityDomainJBossASClient extends JBossASClient {
loginModule.get(FLAG).set("required");
ModelNode moduleOptions = loginModule.get(MODULE_OPTIONS);
moduleOptions.setEmptyList();
- // TODO: we really want to use addExpression (e.g. ${rhq.server.database.user-name})
- // for username and password so rhq-server.properties can be used to set these.
- // However, AS7.1 doesn't support this yet - see https://issues.jboss.org/browse/AS7-5177
- moduleOptions.add(USERNAME, username);
- moduleOptions.add(PASSWORD, password);
+ addPossibleExpression(moduleOptions, USERNAME, username);
+ addPossibleExpression(moduleOptions, PASSWORD, password);
// login modules attribute must be a list - we only have one item in it, the loginModule
ModelNode loginModuleList = new ModelNode();
@@ -202,6 +154,14 @@ public class SecurityDomainJBossASClient extends JBossASClient {
return;
}
+ private void addPossibleExpression(ModelNode node, String name, String value) {
+ if (value != null && value.contains("${")) {
+ node.add(name, new ModelNode(ModelType.EXPRESSION).setExpression(value));
+ } else {
+ node.add(name, value);
+ }
+ }
+
/**
* Given the name of an existing security domain that uses the SecureIdentity authentication method,
* this returns the module options for that security domain authentication method. This includes
@@ -231,49 +191,6 @@ public class SecurityDomainJBossASClient extends JBossASClient {
/**
* Create a new security domain using the database server authentication method.
* This is used when you want to directly authenticate against a db entry.
- *
- * @param securityDomainName the name of the new security domain
- * @param dsJndiName the jndi name for the datasource to query against
- * @param principalsQuery the SQL query for selecting password info for a principal
- * @param rolesQuery the SQL query for selecting role info for a principal
- * @param hashAlgorithm if null defaults to "MD5"
- * @param hashEncoding if null defaults to "base64"
- * @throws Exception if failed to create security domain
- */
- public void createNewDatabaseServerSecurityDomain71(String securityDomainName, String dsJndiName,
- String principalsQuery, String rolesQuery, String hashAlgorithm,
- String hashEncoding) throws Exception {
-
- Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_SECURITY, SECURITY_DOMAIN, securityDomainName);
- ModelNode addTopNode = createRequest(ADD, addr);
- addTopNode.get(CACHE_TYPE).set("default");
-
- ModelNode addAuthNode = createRequest(ADD, addr.clone().add(AUTHENTICATION, CLASSIC));
- ModelNode loginModulesNode = addAuthNode.get(LOGIN_MODULES);
- ModelNode loginModule = new ModelNode();
- loginModule.get(CODE).set("Database");
- loginModule.get(FLAG).set("required");
- ModelNode moduleOptions = loginModule.get(MODULE_OPTIONS);
- moduleOptions.setEmptyList();
- moduleOptions.add(DS_JNDI_NAME, dsJndiName);
- moduleOptions.add(PRINCIPALS_QUERY, principalsQuery);
- moduleOptions.add(ROLES_QUERY, rolesQuery);
- moduleOptions.add(HASH_ALGORITHM, (null == hashAlgorithm ? "MD5" : hashAlgorithm));
- moduleOptions.add(HASH_ENCODING, (null == hashEncoding ? "base64" : hashEncoding));
- loginModulesNode.add(loginModule);
-
- ModelNode batch = createBatchRequest(addTopNode, addAuthNode);
- ModelNode results = execute(batch);
- if (!isSuccess(results)) {
- throw new FailureException(results, "Failed to create security domain [" + securityDomainName + "]");
- }
-
- return;
- }
-
- /**
- * Create a new security domain using the database server authentication method.
- * This is used when you want to directly authenticate against a db entry.
* This is for AS 7.2+ (e.g. EAP 6.1) and works around https://issues.jboss.org/browse/AS7-6527
*
* @param securityDomainName the name of the new security domain
diff --git a/modules/enterprise/server/appserver/src/main/dev-resources/bin/rhq-autoinstall.sh b/modules/enterprise/server/appserver/src/main/dev-resources/bin/rhq-autoinstall.sh
index fbbc397..5369ab2 100755
--- a/modules/enterprise/server/appserver/src/main/dev-resources/bin/rhq-autoinstall.sh
+++ b/modules/enterprise/server/appserver/src/main/dev-resources/bin/rhq-autoinstall.sh
@@ -18,8 +18,6 @@ do
eval ${_INSTALLER_SCRIPT}
if [ "$?" -eq "0" ]; then
echo Installer finished
- # most times, the installation was already done, but see if changes to rhq-server.properties requires a reconfiguration
- eval ${_INSTALLER_SCRIPT} --reconfig
break;
elif [ "$?" -eq "1" ]; then
echo The installer has been disabled - please fix rhq-server.properties
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 20ff84b..05619cb 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
@@ -495,16 +495,17 @@ rhq.communications.multicast-detector.port=16162
# Server-side SSL Security Configuration for HTTPS thru Tomcat
# These are used for browser https access and
# for incoming messages from agents over sslservlet transport.
-# Relative filenames are relative to jboss.server.config.dir.
-# [you cannot use ${x} variables in these rhq.server.tomcat settings]
+# [Due to issue https://issues.jboss.org/browse/WFLY-1177, you cannot change
+# rhq.server.tomcat.security.keystore.file or rhq.server.tomcat.security.truststore.file
+# after you install RHQ. If you need to change those again, you must manually do so in standalone-full.xml.]
rhq.server.tomcat.security.client-auth-mode=false
rhq.server.tomcat.security.secure-socket-protocol=TLS
rhq.server.tomcat.security.algorithm=SunX509
rhq.server.tomcat.security.keystore.alias=RHQ
-rhq.server.tomcat.security.keystore.file=rhq.keystore
+rhq.server.tomcat.security.keystore.file=${jboss.server.config.dir}/rhq.keystore
rhq.server.tomcat.security.keystore.password=RHQManagement
rhq.server.tomcat.security.keystore.type=JKS
-rhq.server.tomcat.security.truststore.file=rhq.truststore
+rhq.server.tomcat.security.truststore.file=${jboss.server.config.dir}/rhq.truststore
rhq.server.tomcat.security.truststore.password=RHQManagement
rhq.server.tomcat.security.truststore.type=JKS
@@ -637,32 +638,11 @@ rhq.sync.endpoint-address=false
</replace>
</target>
- <!-- This is so we can work around all the issues due to https://issues.jboss.org/browse/AS7-6120
- so once that is fixed, we don't have to run the installer "reconfig" automatically on startup of the server.
- Note that if we predeploy (i.e. are doing a dev build), rather than jump through more hoops for this,
- just assume the developer knows that if they change rhq-server.properties, they have to reconfig the server.
- We don't do anything in this target if we are building a dev build. -->
- <target name="add-auto-reconfig" unless="predeploy">
- <echo>Add auto-reconfig to rhq-server scripts so users don't have to when changing rhq-server.properties</echo>
- <replace file="${project.build.outputDirectory}/bin/rhq-server.sh">
- <replacefilter>
- <replacetoken># START SERVER</replacetoken>
- <replacevalue><![CDATA[export RHQ_SERVER_HOME; ${RHQ_SERVER_HOME}/bin/rhq-installer.sh --reconfig &]]></replacevalue>
- </replacefilter>
- </replace>
- <replace file="${project.build.outputDirectory}/bin/rhq-server.bat">
- <replacefilter>
- <replacetoken>rem START SERVER</replacetoken>
- <replacevalue><![CDATA[start /B %RHQ_SERVER_HOME%\bin\rhq-installer.bat --reconfig < nul > nul]]></replacevalue>
- </replacefilter>
- </replace>
- </target>
<target name="prepare-release"
description="If this is a release build, make sure it is properly prepared."
depends="initialize,
developer-release-message,
copy-dev-resources,
- add-auto-reconfig,
fix-perms,
deploy-postgres-ds,
deploy-oracle-ds">
diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java
index 26bc2f6..36da859 100644
--- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java
+++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java
@@ -47,7 +47,7 @@ public class Installer {
private InstallerConfiguration installerConfig;
private enum WhatToDo {
- DISPLAY_USAGE, DO_NOTHING, RECONFIGURE, TEST, SETUPDB, LIST_SERVERS, INSTALL
+ DISPLAY_USAGE, DO_NOTHING, TEST, SETUPDB, LIST_SERVERS, INSTALL
}
public static void main(String[] args) {
@@ -108,20 +108,6 @@ public class Installer {
}
continue;
}
- case RECONFIGURE: {
- try {
- final InstallerService installerService = new InstallerServiceImpl(installerConfig);
- final HashMap<String, String> serverProperties = installerService.getServerProperties();
- final boolean reconfigured = installerService.reconfigure(serverProperties);
- if (reconfigured) {
- LOG.info("Reconfiguration is complete.");
- }
- } catch (Exception e) {
- LOG.error(ThrowableUtil.getAllMessages(e));
- System.exit(EXIT_CODE_INSTALLATION_ERROR);
- }
- continue;
- }
case INSTALL: {
try {
final InstallerService installerService = new InstallerServiceImpl(installerConfig);
@@ -159,28 +145,25 @@ public class Installer {
usage.append("\t--force, -f: force the installer to try to install everything").append("\n");
usage.append("\t--listservers, -l: show list of known installed servers (install not performed)").append("\n");
usage.append("\t--setupdb, -b: only perform database schema creation or update").append("\n");
- usage.append("\t--reconfig, -r: resets some configuration settings in an installed server").append("\n");
usage.append("\t--dbpassword, -d: encodes a DB password for rhq-server.properties (install not performed)")
.append("\n");
LOG.info(usage);
}
private WhatToDo[] processArguments(String[] args) throws Exception {
- String sopts = "-:HD:h:p:d:bflrt";
+ String sopts = "-:HD:h:p:d:bflt";
LongOpt[] lopts = { new LongOpt("help", LongOpt.NO_ARGUMENT, null, 'H'),
new LongOpt("host", LongOpt.REQUIRED_ARGUMENT, null, 'h'),
new LongOpt("port", LongOpt.REQUIRED_ARGUMENT, null, 'p'),
new LongOpt("dbpassword", LongOpt.REQUIRED_ARGUMENT, null, 'd'),
new LongOpt("setupdb", LongOpt.NO_ARGUMENT, null, 'b'),
new LongOpt("listservers", LongOpt.NO_ARGUMENT, null, 'l'),
- new LongOpt("reconfig", LongOpt.NO_ARGUMENT, null, 'r'),
new LongOpt("force", LongOpt.NO_ARGUMENT, null, 'f'),
new LongOpt("test", LongOpt.NO_ARGUMENT, null, 't') };
boolean test = false;
boolean listservers = false;
boolean setupdb = false;
- boolean reconfig = false;
String dbpassword = null;
Getopt getopt = new Getopt("installer", args, sopts, lopts);
@@ -267,11 +250,6 @@ public class Installer {
break; // don't return, we need to allow more args to be processed, like -p or -h
}
- case 'r': {
- reconfig = true;
- break; // don't return, we need to allow more args to be processed, like -p or -h
- }
-
case 't': {
test = true;
break; // don't return, we need to allow more args to be processed, like -p or -h
@@ -286,10 +264,6 @@ public class Installer {
return new WhatToDo[] { WhatToDo.DO_NOTHING };
}
- if (reconfig) {
- return new WhatToDo[] { WhatToDo.RECONFIGURE };
- }
-
if (test || setupdb || listservers) {
ArrayList<WhatToDo> whatToDo = new ArrayList<WhatToDo>();
if (test) {
diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerService.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerService.java
index c1ffa48..6eff4b7 100644
--- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerService.java
+++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerService.java
@@ -121,23 +121,6 @@ public interface InstallerService {
String existingSchemaOption) throws Exception;
/**
- * This will take server properties and reconfigure an already-installed server
- * with those values if the settings were previously hardcoded to old values (as opposed to being
- * set to expressions that allow them to be overridden with system property settings).
- * Note that is function is here only to workaround various bugs in AS7
- * that force us to not be able to use expressions in certain app server subsystem attribute
- * settings - see https://issues.jboss.org/browse/AS7-6120. Once this issues are fixed, this
- * method will go away.
- *
- * @param serverProperties the new server properties
- * @return true if the reconfigure was at least attempted; false if the server isn't ready to be reconfigured
- * such as when it hasn't been fully installed yet
- * @throws Exception
- */
- @Deprecated
- boolean reconfigure(HashMap<String, String> serverProperties) throws Exception;
-
- /**
* Returns a list of all registered servers in the database.
*
* @param connectionUrl
diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java
index 95b4bc3..8173e68 100644
--- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java
+++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java
@@ -563,81 +563,6 @@ public class InstallerServiceImpl implements InstallerService {
return map;
}
- // This is here only to help users workaround https://issues.jboss.org/browse/AS7-6120.
- // It will go away once all the issues with expression support in AS7 are fixed.
- // Notice in this method we only reconfigure some things - only the subsystems/services
- // that didn't support expressions in their attributes are reconfigured here since it
- // is those whose values are hardcoded and we must alter to pick up changes to
- // rhq-server.properties. All other services can pick up the property value changes
- // make to rhq-server.properties on restart (since rhq-server.properties are system
- // properties set in the AS7 instance via -P option to AS7).
- @Override
- public boolean reconfigure(HashMap<String, String> serverProperties) throws Exception {
-
- // make sure we can connect using our configuration
- testModelControllerClient(serverProperties, 30);
-
- if (null == getInstallationResults()) {
- log("Run the installer on this server.");
- return false;
- }
-
- String appServerConfigDir = getAppServerConfigDir();
- ModelControllerClient mcc = null;
-
- try {
- mcc = getModelControllerClient();
-
- // Before we do anything, let's first make sure we really do need to reconfigure something.
- // Check to see if everything that didn't use expressions is still the same. If so,
- // just skip everything else and return immediate since there is nothing to do. We don't
- // even need to reload/restart the server in this case.
- try {
- if (ServerInstallUtil.isSameDatasourceSecurityDomainExisting(mcc, serverProperties)) {
- if (ServerInstallUtil.isSameMailServiceExisting(mcc, serverProperties)) {
- if (ServerInstallUtil.isSameWebConnectorsExisting(mcc, appServerConfigDir, serverProperties)) {
- if (ServerInstallUtil.isSameLoggingExisting(mcc, serverProperties)) {
- log("Nothing in the configuration changed that requires a reconfig - everything looks OK");
- return true; // nothing to do, return immediately
- }
- }
- }
- }
- } catch (Exception e) {
- log("Cannot determine if the config is the same, will reconfigure just in case", e);
- }
-
- // first, put the server in admin-only mode so we can start changing things around
- CoreJBossASClient coreClient = new CoreJBossASClient(mcc);
- coreClient.reload(true);
-
- // not sure if we have to, but see if we need to wait for the reload to finish
- testModelControllerClient(30);
-
- mcc = getModelControllerClient(); // get a new controller
-
- // create the security domain needed by the datasources
- ServerInstallUtil.createDatasourceSecurityDomain(mcc, serverProperties);
-
- // setup the email service
- ServerInstallUtil.setupMailService(mcc, serverProperties);
-
- // setup the secure Tomcat web connectors
- ServerInstallUtil.setupWebConnectors(mcc, appServerConfigDir, serverProperties);
-
- // setup the logging level
- ServerInstallUtil.configureLogging(mcc, serverProperties);
-
- // now restart - don't just reload, some of our stuff won't restart properly if we just reload
- coreClient = new CoreJBossASClient(mcc);
- coreClient.restart();
- } finally {
- safeClose(mcc);
- }
-
- return true;
- }
-
/**
* Makes sure the data is at least in the correct format (booleans are true/false, integers are valid numbers).
*
diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java
index 687e496..d6e0d10 100644
--- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java
+++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java
@@ -167,7 +167,7 @@ public class ServerInstallUtil {
LoggingJBossASClient client = new LoggingJBossASClient(mcc);
// we want to create our own category
- String val = buildExpression(ServerProperties.PROP_LOG_LEVEL, serverProperties, false); // enable when AS7-5321 is fixed
+ String val = buildExpression(ServerProperties.PROP_LOG_LEVEL, serverProperties, true);
client.setLoggerLevel("org.rhq", val);
LOG.info("Logging category org.rhq set to [" + val + "]");
}
@@ -209,7 +209,7 @@ public class ServerInstallUtil {
throws Exception {
String fromAddressExpr = buildExpression(ServerProperties.PROP_EMAIL_FROM_ADDRESS, serverProperties, true);
- String smtpHostExpr = buildExpression(ServerProperties.PROP_EMAIL_SMTP_HOST, serverProperties, false); // enable when AS7-5321 is fixed
+ String smtpHostExpr = buildExpression(ServerProperties.PROP_EMAIL_SMTP_HOST, serverProperties, true);
String smtpPortExpr = buildExpression(ServerProperties.PROP_EMAIL_SMTP_PORT, serverProperties, true);
// Tweek the mail configuration that comes out of box. Setup a batch request to write the proper attributes.
@@ -283,19 +283,13 @@ public class ServerInstallUtil {
public static void createDatasourceSecurityDomain(ModelControllerClient mcc,
HashMap<String, String> serverProperties) throws Exception {
- final String dbUsername = serverProperties.get(ServerProperties.PROP_DATABASE_USERNAME);
- final String obfuscatedPassword = serverProperties.get(ServerProperties.PROP_DATABASE_PASSWORD);
+ final String dbUsername = buildExpression(ServerProperties.PROP_DATABASE_USERNAME, serverProperties, true);
+ final String obfuscatedPassword = buildExpression(ServerProperties.PROP_DATABASE_PASSWORD, serverProperties,
+ true);
final SecurityDomainJBossASClient client = new SecurityDomainJBossASClient(mcc);
- final CoreJBossASClient coreClient = new CoreJBossASClient(mcc);
- String asVersion = coreClient.getAppServerVersion();
final String securityDomain = RHQ_DS_SECURITY_DOMAIN;
if (!client.isSecurityDomain(securityDomain)) {
- if (asVersion.startsWith("7.2")) {
- client.createNewSecureIdentitySecurityDomain72(securityDomain, dbUsername, obfuscatedPassword);
- }
- else {
- client.createNewSecureIdentitySecurityDomain71(securityDomain, dbUsername, obfuscatedPassword);
- }
+ client.createNewSecureIdentitySecurityDomain72(securityDomain, dbUsername, obfuscatedPassword);
LOG.info("Security domain [" + securityDomain + "] created");
} else {
LOG.info("Security domain [" + securityDomain + "] already exists, skipping the creation request");
@@ -384,21 +378,12 @@ public class ServerInstallUtil {
throws Exception {
final SecurityDomainJBossASClient client = new SecurityDomainJBossASClient(mcc);
- final CoreJBossASClient coreClient = new CoreJBossASClient(mcc);
- String asRelase = coreClient.getAppServerVersion();
final String securityDomain = RHQ_REST_SECURITY_DOMAIN;
if (!client.isSecurityDomain(securityDomain)) {
String dsJndiName = "java:jboss/datasources/" + RHQ_DATASOURCE_NAME_XA;
- if (asRelase.startsWith("7.2")) {
- client.createNewDatabaseServerSecurityDomain72(securityDomain, dsJndiName,
- "SELECT PASSWORD FROM RHQ_PRINCIPAL WHERE principal=?",
- "SELECT 'all', 'Roles' FROM RHQ_PRINCIPAL WHERE principal=?", null, null);
- }
- else {
- client.createNewDatabaseServerSecurityDomain71(securityDomain, dsJndiName,
- "SELECT PASSWORD FROM RHQ_PRINCIPAL WHERE principal=?",
- "SELECT 'all', 'Roles' FROM RHQ_PRINCIPAL WHERE principal=?", null, null);
- }
+ client.createNewDatabaseServerSecurityDomain72(securityDomain, dsJndiName,
+ "SELECT PASSWORD FROM RHQ_PRINCIPAL WHERE principal=?",
+ "SELECT 'all', 'Roles' FROM RHQ_PRINCIPAL WHERE principal=?", null, null);
LOG.info("Security domain [" + securityDomain + "] created");
} else {
LOG.info("Security domain [" + securityDomain + "] already exists, skipping the creation request");
@@ -1256,15 +1241,24 @@ public class ServerInstallUtil {
LOG.info("Creating https connector...");
ConnectorConfiguration connector = buildSecureConnectorConfiguration(configDirStr, serverProperties);
- // verify that we have a truststore file - if user is relying on our self-signed certs, we'll have to create one for them
+ // https://issues.jboss.org/browse/WFLY-1177 - we need to resolve the paths right now. the user won't be able
+ // to change these again in the future unless they go directly into standalone.xml and change it manually
String truststoreFileString = connector.getSslConfiguration().getCaCertificateFile();
+ truststoreFileString = resolveExpression(mcc, truststoreFileString);
+ connector.getSslConfiguration().setCaCertificateFile(truststoreFileString);
+
+ String keystoreFileString = connector.getSslConfiguration().getCertificateKeyFile();
+ keystoreFileString = resolveExpression(mcc, keystoreFileString);
+ connector.getSslConfiguration().setCertificateKeyFile(keystoreFileString);
+
+ // verify that we have a truststore file - if user is relying on our self-signed certs, we'll have to create one for them
if (truststoreFileString == null) {
LOG.warn("Missing a valid truststore location - you must specify a valid truststore location!");
} else {
File truststoreFile = new File(truststoreFileString);
if (!truststoreFile.exists()) {
// user didn't provide a truststore file, copy the keystore and use it as the truststore; tell the user about this
- File keystoreFile = new File(connector.getSslConfiguration().getCertificateKeyFile());
+ File keystoreFile = new File(keystoreFileString);
if (!keystoreFile.isFile()) {
LOG.warn("Missing both keystore [" + keystoreFile + "] and truststore [" + truststoreFile + "]");
} else {
@@ -1283,41 +1277,64 @@ public class ServerInstallUtil {
LOG.info("https connector created.");
if (client.isConnector(connectorName)) {
+ client.changeConnector(connectorName, "max-connections",
+ buildExpression("rhq.server.startup.web.max-connections", serverProperties, true));
client.changeConnector(connectorName, "redirect-port",
- buildExpression("rhq.server.socket.binding.port.https", serverProperties, false));
+ buildExpression("rhq.server.socket.binding.port.https", serverProperties, true));
} else {
LOG.warn("There doesn't appear to be a http connector configured already - this is strange.");
}
}
+ private static String resolveExpression(ModelControllerClient mcc, String expression) {
+ if (expression == null) {
+ return null;
+ }
+
+ CoreJBossASClient client = new CoreJBossASClient(mcc);
+ String resolvedExpression;
+ try {
+ resolvedExpression = client.resolveExpression(expression);
+
+ // https://issues.jboss.org/browse/WFLY-1177 - app server doesn't do recursive resolving, we have to do it here
+ while (resolvedExpression != null && resolvedExpression.contains("${")
+ && !resolvedExpression.equals(expression)) {
+ expression = resolvedExpression;
+ resolvedExpression = client.resolveExpression(expression);
+ }
+ } catch (Exception e) {
+ LOG.warn("Cannot resolve expression [" + expression + "]; will use it as-is but errors may occur later.");
+ resolvedExpression = expression;
+ }
+ return resolvedExpression;
+ }
+
private static ConnectorConfiguration buildSecureConnectorConfiguration(String configDirStr,
HashMap<String, String> serverProperties) {
SSLConfiguration ssl = new SSLConfiguration();
// truststore
- ssl.setCaCertificateFile(getAbsoluteFileLocation("rhq.server.tomcat.security.truststore.file",
- serverProperties, configDirStr)); // this cannot be an expression - AS7 doesn't support that now
+ ssl.setCaCertificateFile(buildExpression("rhq.server.tomcat.security.truststore.file", serverProperties, true));
ssl.setCaCertificationPassword(buildExpression("rhq.server.tomcat.security.truststore.password",
- serverProperties, false));
- ssl.setTruststoreType(buildExpression("rhq.server.tomcat.security.truststore.type", serverProperties, false));
+ serverProperties, true));
+ ssl.setTruststoreType(buildExpression("rhq.server.tomcat.security.truststore.type", serverProperties, true));
// keystore
- ssl.setCertificateKeyFile(getAbsoluteFileLocation("rhq.server.tomcat.security.keystore.file", serverProperties,
- configDirStr)); // this cannot be an expression - AS7 doesn't support that now
- ssl.setPassword(buildExpression("rhq.server.tomcat.security.keystore.password", serverProperties, false));
- ssl.setKeyAlias(buildExpression("rhq.server.tomcat.security.keystore.alias", serverProperties, false));
- ssl.setKeystoreType(buildExpression("rhq.server.tomcat.security.keystore.type", serverProperties, false));
+ ssl.setCertificateKeyFile(buildExpression("rhq.server.tomcat.security.keystore.file", serverProperties, true));
+ ssl.setPassword(buildExpression("rhq.server.tomcat.security.keystore.password", serverProperties, true));
+ ssl.setKeyAlias(buildExpression("rhq.server.tomcat.security.keystore.alias", serverProperties, true));
+ ssl.setKeystoreType(buildExpression("rhq.server.tomcat.security.keystore.type", serverProperties, true));
// SSL protocol config
- ssl.setProtocol(buildExpression("rhq.server.tomcat.security.secure-socket-protocol", serverProperties, false));
- ssl.setVerifyClient(buildExpression("rhq.server.tomcat.security.client-auth-mode", serverProperties, false));
+ ssl.setProtocol(buildExpression("rhq.server.tomcat.security.secure-socket-protocol", serverProperties, true));
+ ssl.setVerifyClient(buildExpression("rhq.server.tomcat.security.client-auth-mode", serverProperties, true));
// note: there doesn't appear to be a way for AS7 to support algorithm, like SunX509 or IbmX509
// so I think it just uses the JVM's default. This means "rhq.server.tomcat.security.algorithm" is unused
ConnectorConfiguration connector = new ConnectorConfiguration();
- connector.setMaxConnections(buildExpression("rhq.server.startup.web.max-connections", serverProperties, false));
+ connector.setMaxConnections(buildExpression("rhq.server.startup.web.max-connections", serverProperties, true));
connector.setScheme("https");
connector.setSocketBinding("https");
connector.setSslConfiguration(ssl);
@@ -1502,159 +1519,4 @@ public class ServerInstallUtil {
}
}
}
-
- /**
- * This checks to see if the logging settings have the same values as those found in the given properties.
- *
- * THIS IS ONLY HERE TO SUPPORT INSTALLER --reconfig OPTION WHICH SHOULD
- * GO AWAY ONCE AS7 SUPPORTS EXPRESSIONS WHERE WE NEED THEM - JIRA AS7-5321.
- * ONCE AS7 DOES THIS, THIS METHOD CAN GO AWAY.
- *
- * @param mcc the JBossAS management client
- * @param serverProperties contains the logging settings
- * @return true if the logging settings have the same values
- * @throws Exception
- */
- public static boolean isSameLoggingExisting(ModelControllerClient mcc, HashMap<String, String> serverProperties) {
- try {
- LoggingJBossASClient client = new LoggingJBossASClient(mcc);
- String currentLevel = client.getLoggerLevel("org.rhq");
- String newLevel = serverProperties.get(ServerProperties.PROP_LOG_LEVEL);
- return !isEmpty(currentLevel) && currentLevel.equalsIgnoreCase(newLevel);
- } catch (Exception e) {
- return false; // assume they aren't the same - this may be due to the category org.rhq just missing
- }
- }
-
- /**
- * This checks to see if the mail service already exists
- * and has the same settings as those found in the given properties.
- *
- * THIS IS ONLY HERE TO SUPPORT INSTALLER --reconfig OPTION WHICH SHOULD
- * GO AWAY ONCE AS7 SUPPORTS EXPRESSIONS WHERE WE NEED THEM - JIRA AS7-5321.
- * ONCE AS7 DOES THIS, THIS METHOD CAN GO AWAY.
- *
- * @param mcc the JBossAS management client
- * @param serverProperties contains the mail service settings
- * @return true if the mail service exists with the same settings
- * @throws Exception
- */
- public static boolean isSameMailServiceExisting(ModelControllerClient mcc, HashMap<String, String> serverProperties)
- throws Exception {
- // we know the only problem attribute we care about is the smtp host - that's the only
- // one we use that doesn't support expressions. So we only need to check this one
- Address addr = Address.root().add("socket-binding-group", "standard-sockets",
- "remote-destination-outbound-socket-binding", "mail-smtp");
- JBossASClient client = new JBossASClient(mcc);
- String currentHost = client.getStringAttribute("host", addr);
- String host = serverProperties.get(ServerProperties.PROP_EMAIL_SMTP_HOST);
- return !isEmpty(currentHost) && currentHost.equals(host);
- }
-
- /**
- * This checks to see if the security domain for the datasources already exists
- * and has the same username/password as those found in the given properties
- *
- * THIS IS ONLY HERE TO SUPPORT INSTALLER --reconfig OPTION WHICH SHOULD
- * GO AWAY ONCE AS7 SUPPORTS EXPRESSIONS WHERE WE NEED THEM - JIRA AS7-5321.
- * ONCE AS7 DOES THIS, THIS METHOD CAN GO AWAY.
- *
- * @param mcc the JBossAS management client
- * @param serverProperties contains the obfuscated password and username to compare
- * @return true if the domain exists with the same username and password
- * @throws Exception
- */
- public static boolean isSameDatasourceSecurityDomainExisting(ModelControllerClient mcc,
- HashMap<String, String> serverProperties) throws Exception {
-
- final String dbUsername = serverProperties.get(ServerProperties.PROP_DATABASE_USERNAME);
- final String obfuscatedPassword = serverProperties.get(ServerProperties.PROP_DATABASE_PASSWORD);
- final SecurityDomainJBossASClient client = new SecurityDomainJBossASClient(mcc);
- final String securityDomain = RHQ_DS_SECURITY_DOMAIN;
- boolean sameUsernamePassword = false;
- if (client.isSecurityDomain(securityDomain)) {
- boolean sameUsername = false;
- boolean samePassword = false;
- ModelNode opts;
- opts = client.getSecureIdentitySecurityDomainModuleOptions(securityDomain);
- if (opts != null) {
- List<ModelNode> optsList = opts.asList();
- for (ModelNode opt : optsList) {
- if (opt.has(SecurityDomainJBossASClient.USERNAME)) {
- sameUsername = dbUsername.equals(opt.get(SecurityDomainJBossASClient.USERNAME).asString());
- }
- if (opt.has(SecurityDomainJBossASClient.PASSWORD)) {
- samePassword = obfuscatedPassword.equals(opt.get(SecurityDomainJBossASClient.PASSWORD)
- .asString());
- }
- }
- }
- sameUsernamePassword = sameUsername & samePassword;
- }
- return sameUsernamePassword;
- }
-
- /**
- * This checks to see if the web connectors already exist
- * and have the same settings as those found in the given properties
- *
- * THIS IS ONLY HERE TO SUPPORT INSTALLER --reconfig OPTION WHICH SHOULD
- * GO AWAY ONCE AS7 SUPPORTS EXPRESSIONS WHERE WE NEED THEM - JIRA AS7-5321.
- * ONCE AS7 DOES THIS, THIS METHOD CAN GO AWAY.
- *
- * @param mcc the JBossAS management client
- * @param configDirStr location of a configuration directory where the keystore is to be stored
- * @param serverProperties contains the obfuscated password and username to compare
- * @return true if the domain exists with the same username and password
- * @throws Exception
- */
- public static boolean isSameWebConnectorsExisting(ModelControllerClient mcc, String appServerConfigDir,
- HashMap<String, String> serverProperties) throws Exception {
-
- HashMap<String, String> settingsToCheck = new HashMap<String, String>();
- WebJBossASClient client = new WebJBossASClient(mcc);
-
- // FIRST check the https connector
- ModelNode httpsNode = client.getConnector("https");
-
- ConnectorConfiguration connectorConfig = buildSecureConnectorConfiguration(appServerConfigDir, serverProperties);
- SSLConfiguration sslConfig = connectorConfig.getSslConfiguration();
-
- // check the https connector's main config
- settingsToCheck.clear();
- settingsToCheck.put("max-connections", connectorConfig.getMaxConnections());
- for (Map.Entry<String, String> propToCheck : settingsToCheck.entrySet()) {
- if (!httpsNode.get(propToCheck.getKey()).asString().equals(propToCheck.getValue())) {
- return false; // something is different, no need to check further, return false to say we are different
- }
- }
-
- // now check the https connector's ssl config
- ModelNode sslNode = httpsNode.get("ssl").get("configuration");
- settingsToCheck.clear();
- settingsToCheck.put("ca-certificate-file", sslConfig.getCaCertificateFile());
- settingsToCheck.put("ca-certificate-password", sslConfig.getCaCertificatePassword());
- settingsToCheck.put("certificate-key-file", sslConfig.getCertificateKeyFile());
- settingsToCheck.put("key-alias", sslConfig.getKeyAlias());
- settingsToCheck.put("keystore-type", sslConfig.getKeystoreType());
- settingsToCheck.put("password", sslConfig.getPassword());
- settingsToCheck.put("protocol", sslConfig.getProtocol());
- settingsToCheck.put("truststore-type", sslConfig.getTruststoreType());
- settingsToCheck.put("verify-client", sslConfig.getVerifyClient());
- for (Map.Entry<String, String> propToCheck : settingsToCheck.entrySet()) {
- if (!sslNode.get(propToCheck.getKey()).asString().equals(propToCheck.getValue())) {
- return false; // something is different, no need to check further, return false to say we are different
- }
- }
-
- // SECOND check the http connector
- ModelNode httpNode = client.getConnector("http");
- String nodeString = httpNode.get("redirect-port").asString();
- String propString = serverProperties.get("rhq.server.socket.binding.port.https");
- if (!nodeString.equals(propString)) {
- return false; // something is different, no need to check further, return false to say we are different
- }
-
- return true;
- }
}
11 years
[rhq] Branch 'feature/cassandra-backend' - .classpath modules/enterprise
by Jay Shaughnessy
.classpath | 31 ++++------
modules/enterprise/server/appserver/src/main/dev-resources/bin/rhq-ccm.bat | 2
modules/enterprise/server/plugins/drift-mongodb/pom.xml | 2
modules/enterprise/server/sars/agent-sar/pom.xml | 2
4 files changed, 16 insertions(+), 21 deletions(-)
New commits:
commit b5fac1771cc5c184c8686ec2d2ecda80e236b7aa
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed May 1 09:56:26 2013 -0400
A few eclispe/build/master-merge tweeks
diff --git a/.classpath b/.classpath
index 62c7e54..cc7cab4 100644
--- a/.classpath
+++ b/.classpath
@@ -269,7 +269,7 @@
<classpathentry exported="true" kind="var" path="M2_REPO/postgresql/postgresql/9.2-1002.jdbc4/postgresql-9.2-1002.jdbc4.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/jboss/jboss-cache/1.4.1.SP9/jboss-cache-1.4.1.SP9.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/hyperic/sigar/1.6.5.132-5/sigar-1.6.5.132-5.jar" sourcepath="/M2_REPO/org/hyperic/sigar/1.6.5.132-5/sigar-1.6.5.132-5-sources.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/jbossts/jbossjts/4.16.2.Final/jbossjts-4.16.2.Final.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/jbossts/jbossjts/4.16.4.Final/jbossjts-4.16.4.Final.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/apache/maven/maven-project/2.0.8/maven-project-2.0.8.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/apache/maven/maven-plugin-api/2.0.8/maven-plugin-api-2.0.8.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/codehaus/swizzle/swizzle-confluence/1.6.1/swizzle-confluence-1.6.1.jar"/>
@@ -304,31 +304,31 @@
<classpathentry exported="true" kind="var" path="M2_REPO/org/unitils/unitils-dbunit/3.1/unitils-dbunit-3.1.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/unitils/unitils-orm/3.1/unitils-orm-3.1.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/unitils/unitils-testng/3.1/unitils-testng-3.1.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/org/codehaus/jackson/jackson-core-asl/1.8.5/jackson-core-asl-1.8.5.jar" sourcepath="/M2_REPO/org/codehaus/jackson/jackson-core-asl/1.8.5/jackson-core-asl-1.8.5-sources.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/org/codehaus/jackson/jackson-mapper-asl/1.8.5/jackson-mapper-asl-1.8.5.jar" sourcepath="/M2_REPO/org/codehaus/jackson/jackson-mapper-asl/1.8.5/jackson-mapper-asl-1.8.5-sources.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/org/codehaus/jackson/jackson-core-asl/1.9.9/jackson-core-asl-1.9.9.jar" sourcepath="/M2_REPO/org/codehaus/jackson/jackson-core-asl/1.8.5/jackson-core-asl-1.8.5-sources.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/org/codehaus/jackson/jackson-mapper-asl/1.9.9/jackson-mapper-asl-1.9.9.jar" sourcepath="/M2_REPO/org/codehaus/jackson/jackson-mapper-asl/1.8.5/jackson-mapper-asl-1.8.5-sources.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/mongodb/mongo-java-driver/2.6.5/mongo-java-driver-2.6.5.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/com/googlecode/java-diff-utils/diffutils/1.2.1/diffutils-1.2.1.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/com/google/code/morphia/morphia/0.99/morphia-0.99.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/org/hibernate/hibernate-annotations/3.5.6-Final/hibernate-annotations-3.5.6-Final.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/org/hibernate/hibernate-core/4.0.1.Final/hibernate-core-4.0.1.Final.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/org/hibernate/hibernate-entitymanager/4.0.1.Final/hibernate-entitymanager-4.0.1.Final.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/org/hibernate/hibernate-annotations/3.5.0-Beta-2/hibernate-annotations-3.5.0-Beta-2.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/org/hibernate/hibernate-core/4.2.0.CR1/hibernate-core-4.2.0.CR1.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/org/hibernate/hibernate-entitymanager/4.2.0.CR1/hibernate-entitymanager-4.2.0.CR1.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/hibernate/hibernate-validator/4.2.0.Final/hibernate-validator-4.2.0.Final.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/hibernate/javax/persistence/hibernate-jpa-2.0-api/1.0.1.Final/hibernate-jpa-2.0-api-1.0.1.Final.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/infinispan/infinispan-core/5.1.2.FINAL/infinispan-core-5.1.2.FINAL.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/spec/javax/servlet/jboss-servlet-api_3.0_spec/1.0.1.Final/jboss-servlet-api_3.0_spec-1.0.1.Final.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/spec/javax/servlet/jboss-servlet-api_3.0_spec/1.0.2.Final/jboss-servlet-api_3.0_spec-1.0.2.Final.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/msc/jboss-msc/1.0.2.GA/jboss-msc-1.0.2.GA.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/jboss-dmr/1.1.1.Final/jboss-dmr-1.1.1.Final.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/as/jboss-as-naming/7.1.1.Final/jboss-as-naming-7.1.1.Final.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/as/jboss-as-server/7.1.1.Final/jboss-as-server-7.1.1.Final.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/as/jboss-as-naming/7.2.0.Alpha1-redhat-4/jboss-as-naming-7.2.0.Alpha1-redhat-4.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/as/jboss-as-server/7.2.0.Alpha1-redhat-4/jboss-as-server-7.2.0.Alpha1-redhat-4.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/staxmapper/1.1.0.Final/staxmapper-1.1.0.Final.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/modules/jboss-modules/1.1.1.GA/jboss-modules-1.1.1.GA.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/as/jboss-as-subsystem-test/7.1.1.Final/jboss-as-subsystem-test-7.1.1.Final.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/as/jboss-as-controller/7.1.1.Final/jboss-as-controller-7.1.1.Final.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/as/jboss-as-controller-client/7.1.1.Final/jboss-as-controller-client-7.1.1.Final.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/resteasy/resteasy-links/2.3.4.Final/resteasy-links-2.3.4.Final.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/resteasy/resteasy-jaxrs/2.3.4.Final/resteasy-jaxrs-2.3.4.Final.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/resteasy/resteasy-jackson-provider/2.3.4.Final/resteasy-jackson-provider-2.3.4.Final.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/resteasy/jaxrs-api/2.3.4.Final/jaxrs-api-2.3.4.Final.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/resteasy/resteasy-links/2.3.5.Final/resteasy-links-2.3.5.Final.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/resteasy/resteasy-jaxrs/2.3.5.Final/resteasy-jaxrs-2.3.5.Final.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/resteasy/resteasy-jackson-provider/2.3.5.Final/resteasy-jackson-provider-2.3.5.Final.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/resteasy/jaxrs-api/2.3.5.Final/jaxrs-api-2.3.5.Final.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/sasl/jboss-sasl/1.0.0.Final/jboss-sasl-1.0.0.Final.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/mockito/mockito-all/1.9.0/mockito-all-1.9.0.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/powermock/powermock-api-mockito/1.4.12/powermock-api-mockito-1.4.12.jar"/>
@@ -370,16 +370,11 @@
<classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/byteman/byteman-install/1.5.2/byteman-install-1.5.2.jar" sourcepath="M2_REPO/org/jboss/byteman/byteman-install/1.5.2/byteman-install-1.5.2-sources.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/byteman/byteman-submit/1.5.2/byteman-submit-1.5.2.jar" sourcepath="M2_REPO/org/jboss/byteman/byteman-submit/1.5.2/byteman-submit-1.5.2-sources.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/byteman/byteman-bmunit/1.5.2/byteman-bmunit-1.5.2.jar" sourcepath="M2_REPO/org/jboss/byteman/byteman-bmunit/1.5.2/byteman-bmunit-1.5.2-sources.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/org/hectorclient/hector-core/1.1-1/hector-core-1.1-1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/cassandra/cassandra-all/1.2.2/cassandra-all-1.2.2.jar"/>
<classpathentry kind="var" path="M2_REPO/com/datastax/cassandra/cassandra-driver-core/1.0.0-beta2-rhq-1.2.2-2/cassandra-driver-core-1.0.0-beta2-rhq-1.2.2-2.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/thrift/libthrift/0.7.0/libthrift-0.7.0.jar"/>
<classpathentry kind="var" path="M2_REPO/commons-cli/commons-cli/1.2/commons-cli-1.2.jar"/>
<classpathentry kind="var" path="M2_REPO/com/google/guava/guava/12.0/guava-12.0.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/org/apache/xmlgraphics/batik-transcoder/1.7/batik-transcoder-1.7.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/org/apache/xmlgraphics/batik-util/1.7/batik-util-1.7.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/org/apache/xmlgraphics/batik-svg-dom/1.7/batik-svg-dom-1.7.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/org/apache/xmlgraphics/batik-dom/1.7/batik-dom-1.7.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/cassandra/cassandra-thrift/1.2.2/cassandra-thrift-1.2.2.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/commons/commons-exec/1.1/commons-exec-1.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/jetty/aggregate/jetty-all/8.1.8.v20121106/jetty-all-8.1.8.v20121106.jar"/>
diff --git a/modules/enterprise/server/appserver/src/main/dev-resources/bin/rhq-ccm.bat b/modules/enterprise/server/appserver/src/main/dev-resources/bin/rhq-ccm.bat
index b861559..c043cd2 100644
--- a/modules/enterprise/server/appserver/src/main/dev-resources/bin/rhq-ccm.bat
+++ b/modules/enterprise/server/appserver/src/main/dev-resources/bin/rhq-ccm.bat
@@ -120,7 +120,7 @@ if not defined RHQ_SERVER_DEBUG set _RHQ_LOGLEVEL=INFO
set RHQ_CCM_JAVA_OPTS=%RHQ_CCM_JAVA_OPTS% -Djava.awt.headless=true -Drhq.server.properties-file=%RHQ_SERVER_HOME%\bin\rhq-server.properties -Drhq.ccm.logdir=%RHQ_SERVER_HOME%\logs -Drhq.ccm.loglevel=%_RHQ_LOGLEVEL%
rem Sample JPDA settings for remote socket debugging
-rem RHQ_CCM_JAVA_OPTS=%RHQ_CCM_JAVA_OPTS% -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y
+rem set RHQ_CCM_JAVA_OPTS=%RHQ_CCM_JAVA_OPTS% -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y
if defined RHQ_SERVER_DEBUG echo RHQ_CCM_JAVA_OPTS: %RHQ_CCM_JAVA_OPTS%
if defined RHQ_SERVER_DEBUG echo RHQ_CCM_ADDITIONAL_JAVA_OPTS: %RHQ_CCM_ADDITIONAL_JAVA_OPTS%
diff --git a/modules/enterprise/server/plugins/drift-mongodb/pom.xml b/modules/enterprise/server/plugins/drift-mongodb/pom.xml
index 39d7127..59ea469 100644
--- a/modules/enterprise/server/plugins/drift-mongodb/pom.xml
+++ b/modules/enterprise/server/plugins/drift-mongodb/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/enterprise/server/sars/agent-sar/pom.xml b/modules/enterprise/server/sars/agent-sar/pom.xml
index e5639f9..4946a7b 100644
--- a/modules/enterprise/server/sars/agent-sar/pom.xml
+++ b/modules/enterprise/server/sars/agent-sar/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server-sars-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
11 years
[rhq] Branch 'feature/cassandra-backend' - modules/enterprise
by John Sanda
modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Install.java | 248 ++++++----
1 file changed, 151 insertions(+), 97 deletions(-)
New commits:
commit e06a3130e13eb61c2292d7ab6c929d5a7bcb1201
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Apr 30 22:48:52 2013 -0400
add more detailed logging to install command
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 596de48..fe79183 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
@@ -195,7 +195,7 @@ public class Install extends ControlCommand {
}
}
} catch (Exception e) {
- throw new RHQControlException("Failed to install services", e);
+ throw new RHQControlException("An error occurred while executing the install command", e);
}
}
@@ -296,24 +296,31 @@ public class Install extends ControlCommand {
return DEFAULT_AGENT_BASEDIR;
}
- private int installStorageNode(File storageBasedir, CommandLine rhqctlCommandLine) throws Exception {
- log.debug("Installing RHQ storage node");
+ private int installStorageNode(File storageBasedir, CommandLine rhqctlCommandLine) throws IOException {
+ try {
+ log.info("Preparing to install RHQ storage node.");
- putProperty(RHQ_STORAGE_BASEDIR_PROP, storageBasedir.getAbsolutePath());
+ putProperty(RHQ_STORAGE_BASEDIR_PROP, storageBasedir.getAbsolutePath());
- org.apache.commons.exec.CommandLine commandLine = getCommandLine("rhq-storage-installer", "--dir",
- storageBasedir.getAbsolutePath());
+ org.apache.commons.exec.CommandLine commandLine = getCommandLine("rhq-storage-installer", "--dir",
+ storageBasedir.getAbsolutePath());
- if (rhqctlCommandLine.hasOption(STORAGE_CONFIG_OPTION)) {
- String[] args = toArray(loadStorageProperties(rhqctlCommandLine.getOptionValue(STORAGE_CONFIG_OPTION)));
- commandLine.addArguments(args);
- }
+ if (rhqctlCommandLine.hasOption(STORAGE_CONFIG_OPTION)) {
+ String[] args = toArray(loadStorageProperties(rhqctlCommandLine.getOptionValue(STORAGE_CONFIG_OPTION)));
+ commandLine.addArguments(args);
+ }
- Executor executor = new DefaultExecutor();
- executor.setWorkingDirectory(binDir);
- executor.setStreamHandler(new PumpStreamHandler());
+ Executor executor = new DefaultExecutor();
+ executor.setWorkingDirectory(binDir);
+ executor.setStreamHandler(new PumpStreamHandler());
- return executor.execute(commandLine);
+ int exitCode = executor.execute(commandLine);
+ log.info("The storage node installer has finished with an exit value of " + exitCode);
+ return exitCode;
+ } catch (IOException e) {
+ log.error("An error occurred while running the storage installer: " + e.getMessage());
+ throw e;
+ }
}
private Properties loadStorageProperties(String path) throws IOException {
@@ -333,61 +340,86 @@ public class Install extends ControlCommand {
return array;
}
- private void startRHQServerForInstallation() throws Exception {
+ private void startRHQServerForInstallation() throws IOException {
+ try {
+ log.info("Starting the RHQ server in preparation of running the installer");
- Executor executor = new DefaultExecutor();
- executor.setWorkingDirectory(binDir);
- executor.setStreamHandler(new PumpStreamHandler());
- org.apache.commons.exec.CommandLine commandLine;
+ Executor executor = new DefaultExecutor();
+ executor.setWorkingDirectory(binDir);
+ executor.setStreamHandler(new PumpStreamHandler());
+ org.apache.commons.exec.CommandLine commandLine;
- if (isWindows()) {
- // For windows we will [re-]install the server as a windows service, then start the service.
+ if (isWindows()) {
+ // For windows we will [re-]install the server as a windows service, then start the service.
- commandLine = getCommandLine("rhq-server", "stop");
- executor.execute(commandLine);
+ commandLine = getCommandLine("rhq-server", "stop");
+ executor.execute(commandLine);
- commandLine = getCommandLine("rhq-server", "remove");
- executor.execute(commandLine);
+ commandLine = getCommandLine("rhq-server", "remove");
+ executor.execute(commandLine);
- commandLine = getCommandLine("rhq-server", "install");
- executor.execute(commandLine);
+ commandLine = getCommandLine("rhq-server", "install");
+ executor.execute(commandLine);
- commandLine = getCommandLine("rhq-server", "start");
- executor.execute(commandLine);
+ commandLine = getCommandLine("rhq-server", "start");
+ executor.execute(commandLine);
- } else {
- // For *nix, just start the server in the background
- commandLine = getCommandLine("rhq-server", "start");
- executor.execute(commandLine, new DefaultExecuteResultHandler());
- }
+ } else {
+ // For *nix, just start the server in the background
+ commandLine = getCommandLine("rhq-server", "start");
+ executor.execute(commandLine, new DefaultExecuteResultHandler());
+ }
- // Wait for the server to complete it's startup
- commandLine = getCommandLine("rhq-installer", "--test");
+ // Wait for the server to complete it's startup
+ log.info("Waiting for server to complete its start up");
+ commandLine = getCommandLine("rhq-installer", "--test");
- int exitCode = executor.execute(commandLine);
- while (exitCode != 0) {
- exitCode = executor.execute(commandLine);
+ // TODO add a max retries (probably want it to be configurable)
+ int exitCode = executor.execute(commandLine);
+ while (exitCode != 0) {
+ log.debug("Still waiting for server to complete its start up");
+ exitCode = executor.execute(commandLine);
+ }
+
+ log.info("The server start up has completed");
+ } catch (IOException e) {
+ log.error("An error occurred while starting the RHQ server: " + e.getMessage());
+ throw e;
}
}
- private void installRHQServer() throws Exception {
- log.debug("Installing RHQ server");
+ private void installRHQServer() throws IOException {
+ try {
+ log.info("Installing RHQ server");
- org.apache.commons.exec.CommandLine commandLine = getCommandLine("rhq-installer");
- Executor executor = new DefaultExecutor();
- executor.setWorkingDirectory(binDir);
- executor.setStreamHandler(new PumpStreamHandler());
+ org.apache.commons.exec.CommandLine commandLine = getCommandLine("rhq-installer");
+ Executor executor = new DefaultExecutor();
+ executor.setWorkingDirectory(binDir);
+ executor.setStreamHandler(new PumpStreamHandler());
- executor.execute(commandLine, new DefaultExecuteResultHandler());
+ executor.execute(commandLine, new DefaultExecuteResultHandler());
+ log.info("The server installer is running");
+ } catch (IOException e) {
+ log.error("An error occurred while starting the server installer: " + e.getMessage());
+ }
}
private void waitForRHQServerToInitialize() throws Exception {
- while (!isRHQServerInitialized()) {
- Thread.sleep(5000);
+ try {
+ log.info("Waiting for RHQ server to initialize");
+ while (!isRHQServerInitialized()) {
+ Thread.sleep(5000);
+ }
+ } catch (IOException e) {
+ log.error("An error occurred while checking to see if the server is initialized: " + e.getMessage());
+ throw e;
+ } catch (InterruptedException e) {
+ // Don't think we need to log any details here
+ throw e;
}
}
- private boolean isRHQServerInitialized() throws Exception {
+ private boolean isRHQServerInitialized() throws IOException {
File logDir = new File(basedir, "logs");
BufferedReader reader = null;
@@ -415,24 +447,30 @@ public class Install extends ControlCommand {
}
}
- private void installAgent(File agentBasedir) throws Exception {
- log.debug("Installing RHQ agent");
+ private void installAgent(File agentBasedir) throws IOException {
+ try {
+ log.info("Installing RHQ agent");
- File agentInstallerJar = getAgentInstaller();
+ File agentInstallerJar = getAgentInstaller();
- putProperty(RHQ_AGENT_BASEDIR_PROP, agentBasedir.getAbsolutePath());
+ putProperty(RHQ_AGENT_BASEDIR_PROP, agentBasedir.getAbsolutePath());
- org.apache.commons.exec.CommandLine commandLine = new org.apache.commons.exec.CommandLine("java")
- .addArgument("-jar").addArgument(agentInstallerJar.getAbsolutePath())
- .addArgument("--install=" + agentBasedir.getParentFile().getAbsolutePath());
+ org.apache.commons.exec.CommandLine commandLine = new org.apache.commons.exec.CommandLine("java")
+ .addArgument("-jar").addArgument(agentInstallerJar.getAbsolutePath())
+ .addArgument("--install=" + agentBasedir.getParentFile().getAbsolutePath());
- Executor executor = new DefaultExecutor();
- executor.setWorkingDirectory(basedir);
- executor.setStreamHandler(new PumpStreamHandler());
+ Executor executor = new DefaultExecutor();
+ executor.setWorkingDirectory(basedir);
+ executor.setStreamHandler(new PumpStreamHandler());
- executor.execute(commandLine);
+ int exitValue = executor.execute(commandLine);
+ log.info("The agent installer finished running with exit value " + exitValue);
- new File(basedir, "rhq-agent-update.log").delete();
+ new File(basedir, "rhq-agent-update.log").delete();
+ } catch (IOException e) {
+ log.error("An error occurred while running the agent installer: " + e.getMessage());
+ throw e;
+ }
}
private File getAgentInstaller() {
@@ -447,25 +485,33 @@ public class Install extends ControlCommand {
}
private void configureAgent(File agentBasedir, CommandLine commandLine) throws Exception {
- if (commandLine.hasOption(AGENT_CONFIG_OPTION)) {
- replaceAgentConfigIfNecessary(commandLine);
- } else {
- File agentConfDir = new File(agentBasedir, "conf");
- File agentConfigFile = new File(agentConfDir, "agent-configuration.xml");
- agentConfigFile.delete();
+ try {
+ log.info("Configuring the RHQ agent");
+ if (commandLine.hasOption(AGENT_CONFIG_OPTION)) {
+ replaceAgentConfigIfNecessary(commandLine);
+ } else {
+ File agentConfDir = new File(agentBasedir, "conf");
+ File agentConfigFile = new File(agentConfDir, "agent-configuration.xml");
+ agentConfigFile.delete();
- Map<String, String> tokens = new TreeMap<String, String>();
- tokens.put("rhq.agent.server.bind-address", InetAddress.getLocalHost().getHostName());
+ Map<String, String> tokens = new TreeMap<String, String>();
+ tokens.put("rhq.agent.server.bind-address", InetAddress.getLocalHost().getHostName());
- InputStream inputStream = getClass().getResourceAsStream("/agent-configuration.xml");
- TokenReplacingReader reader = new TokenReplacingReader(new InputStreamReader(inputStream), tokens);
- BufferedWriter writer = new BufferedWriter(new FileWriter(agentConfigFile));
+ InputStream inputStream = getClass().getResourceAsStream("/agent-configuration.xml");
+ TokenReplacingReader reader = new TokenReplacingReader(new InputStreamReader(inputStream), tokens);
+ BufferedWriter writer = new BufferedWriter(new FileWriter(agentConfigFile));
- StreamUtil.copy(reader, writer);
+ StreamUtil.copy(reader, writer);
+ log.info("Finished configuring the agent");
+ }
+ } catch (Exception e) {
+ log.error("An error occurred while configuring the agent: " + e.getMessage());
+ throw e;
}
}
private void clearAgentPreferences() throws Exception {
+ log.info("Removing any existing agent preferences");
Preferences agentPrefs = Preferences.userRoot().node("/rhq-agent");
agentPrefs.removeNode();
agentPrefs.flush();
@@ -473,38 +519,46 @@ public class Install extends ControlCommand {
}
private void startAgent(File agentBasedir) throws Exception {
- Executor executor = new DefaultExecutor();
- File agentBinDir = new File(agentBasedir, "bin");
- executor.setWorkingDirectory(agentBinDir);
- executor.setStreamHandler(new PumpStreamHandler());
- org.apache.commons.exec.CommandLine commandLine;
+ try {
+ log.info("Starting RHQ agent");
+ Executor executor = new DefaultExecutor();
+ File agentBinDir = new File(agentBasedir, "bin");
+ executor.setWorkingDirectory(agentBinDir);
+ executor.setStreamHandler(new PumpStreamHandler());
+ org.apache.commons.exec.CommandLine commandLine;
- if (isWindows()) {
- // For windows we will [re-]install the server as a windows service, then start the service.
+ if (isWindows()) {
+ // For windows we will [re-]install the server as a windows service, then start the service.
- commandLine = getCommandLine("rhq-agent-wrapper", "stop");
- try {
- executor.execute(commandLine);
- } catch (Exception e) {
- // Ignore, service may not exist or be running, , script returns 1
- log.debug("Failed to stop agent service", e);
- }
+ commandLine = getCommandLine("rhq-agent-wrapper", "stop");
+ try {
+ executor.execute(commandLine);
+ } catch (Exception e) {
+ // Ignore, service may not exist or be running, , script returns 1
+ log.debug("Failed to stop agent service", e);
+ }
+
+ commandLine = getCommandLine("rhq-agent-wrapper", "remove");
+ try {
+ executor.execute(commandLine);
+ } catch (Exception e) {
+ // Ignore, service may not exist, script returns 1
+ log.debug("Failed to uninstall agent service", e);
+ }
- commandLine = getCommandLine("rhq-agent-wrapper", "remove");
- try {
+ commandLine = getCommandLine("rhq-agent-wrapper", "install");
executor.execute(commandLine);
- } catch (Exception e) {
- // Ignore, service may not exist, script returns 1
- log.debug("Failed to uninstall agent service", e);
}
- commandLine = getCommandLine("rhq-agent-wrapper", "install");
+ // For *nix, just start the server in the background, for Win, now that the service is installed, start it
+ commandLine = getCommandLine("rhq-agent-wrapper", "start");
executor.execute(commandLine);
- }
- // For *nix, just start the server in the background, for Win, now that the service is installed, start it
- commandLine = getCommandLine("rhq-agent-wrapper", "start");
- executor.execute(commandLine);
+ log.info("The agent has started up");
+ } catch (IOException e) {
+ log.error("An error occurred while starting the agent: " + e.getMessage());
+ throw e;
+ }
}
private void replaceServerPropertiesIfNecessary(CommandLine commandLine) {
11 years