modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/CoreJBossASClient.java
| 12 ++
modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/MCCHelper.java
| 51 ++++++++++
modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/SecurityDomainJBossASClient.java
| 8 -
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemInfoManagerBean.java
| 12 ++
4 files changed, 76 insertions(+), 7 deletions(-)
New commits:
commit 565a1d6a70451e41bb8350a59ba27a1ac702f6d5
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Mar 27 13:22:00 2013 +0100
Add app-server information (version etc.) to the system information dump.
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 4521b35..5078d08 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
@@ -49,7 +49,7 @@ public class CoreJBossASClient extends JBossASClient {
* 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.
- *
+ *
* @return the AS JVM's system properties
* @throws Exception
*/
@@ -86,6 +86,16 @@ public class CoreJBossASClient extends JBossASClient {
return version;
}
+ public String getServerProductVersion() throws Exception {
+ final String version = getStringAttribute("product-version",
Address.root());
+ return version;
+ }
+
+ public String getServerProductName() throws Exception {
+ final String version = getStringAttribute("product-name",
Address.root());
+ return version;
+ }
+
public String getAppServerHomeDir() throws Exception {
final String[] address = { CORE_SERVICE, SERVER_ENVIRONMENT };
final String dir = getStringAttribute(true, "home-dir",
Address.root().add(address));
diff --git
a/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/MCCHelper.java
b/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/MCCHelper.java
new file mode 100644
index 0000000..b344963
--- /dev/null
+++
b/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/MCCHelper.java
@@ -0,0 +1,51 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2013 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+package org.rhq.common.jbossas.client.controller;
+
+import org.jboss.as.controller.client.ModelControllerClient;
+
+/**
+ * Helper class to get a ModelContollerClient for the RHQ default settings.
+ * This follows the methods in the Installer, but assumes defaults.
+ * @author Heiko W. Rupp
+ */
+public class MCCHelper {
+
+
+ public static ModelControllerClient getModelControllerClient() {
+ return getModelControllerClient("localhost",6999);
+ }
+
+ public static ModelControllerClient getModelControllerClient(String host,int port) {
+ ModelControllerClient client;
+ try {
+ if (host==null || host.isEmpty())
+ host = "localhost";
+
+ if (port <= 0)
+ port = 6999; // Default for RHQ TODO obtain from rhq-server.properties,
jboss.management.native.port=6999 ?
+ client = ModelControllerClient.Factory.create(host, port);
+ } catch (Exception e) {
+ throw new RuntimeException("Cannot obtain client connection to the app
server", e);
+ }
+ return client;
+ }
+
+}
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 10df849..f977f0a 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
@@ -147,8 +147,6 @@ public class SecurityDomainJBossASClient extends JBossASClient {
ModelNode batch = createBatchRequest(addTopNode, addAuthNode, loginModule);
- 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 + "]");
@@ -365,7 +363,7 @@ public class SecurityDomainJBossASClient extends JBossASClient {
}
- public void createNewSecurityDomain71(String securityDomainName,
LoginModuleRequest... loginModules) throws Exception {
+ private void createNewSecurityDomain71(String securityDomainName,
LoginModuleRequest... loginModules) throws Exception {
if (isSecurityDomain(securityDomainName)) {
removeSecurityDomain(securityDomainName);
@@ -379,8 +377,6 @@ public class SecurityDomainJBossASClient extends JBossASClient {
ModelNode addAuthNode = createRequest(ADD, addr.clone().add(AUTHENTICATION,
CLASSIC));
ModelNode loginModulesNode = addAuthNode.get(LOGIN_MODULES);
- ModelNode[] loginModuleNodes = new ModelNode[loginModules.length];
-
for (int i = 0, len = loginModules.length; i < len; ++i) {
ModelNode loginModule = new ModelNode();
loginModule.get(CODE).set(loginModules[i].getLoginModuleFQCN());
@@ -410,7 +406,7 @@ public class SecurityDomainJBossASClient extends JBossASClient {
return;
}
- public void createNewSecurityDomain72(String securityDomainName,
LoginModuleRequest... loginModules) throws Exception {
+ private void createNewSecurityDomain72(String securityDomainName,
LoginModuleRequest... loginModules) throws Exception {
if (isSecurityDomain(securityDomainName)) {
removeSecurityDomain(securityDomainName);
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemInfoManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemInfoManagerBean.java
index 27d4dfc..0bd1103 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemInfoManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemInfoManagerBean.java
@@ -9,6 +9,8 @@ import javax.ejb.Stateless;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.rhq.common.jbossas.client.controller.CoreJBossASClient;
+import org.rhq.common.jbossas.client.controller.MCCHelper;
import org.rhq.core.domain.alert.Alert;
import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.core.domain.auth.Subject;
@@ -59,6 +61,16 @@ public class SystemInfoManagerBean implements SystemInfoManagerLocal{
result.put("FullName", productInfo.getFullName());
result.put("Name", productInfo.getName());
+ try {
+ CoreJBossASClient coreClient = new
CoreJBossASClient(MCCHelper.getModelControllerClient());
+ result.put("AS version",coreClient.getAppServerVersion());
+ result.put("AS product version",
coreClient.getServerProductVersion());
+ result.put("AS product name", coreClient.getServerProductName());
+ result.put("AS config dir", coreClient.getAppServerConfigDir());
+ } catch (Exception e) {
+ result.put("AS*", "Not able to get AS props due to " +
e.getMessage());
+ }
+
SystemSettings systemSettings=systemManager.getSystemSettings(caller);
Map<String,String> settingsMap = systemSettings.toMap();
// Don't use putAll(), as we need to filter out passwords