modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/InfinispanJBossASClient.java | 184 ++++++++++
modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/JMSJBossASClient.java | 110 -----
modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/MessagingJBossASClient.java | 83 ++++
modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java | 3
modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java | 106 ++++-
5 files changed, 349 insertions(+), 137 deletions(-)
New commits:
commit 2ea9a8754ab9551c7c2472d579d8a83d55981f14
Author: Jay Shaughnessy <jshaughn(a)jshaughn.csb>
Date: Tue Sep 11 16:29:11 2012 -0400
More configuration generation in the installer
- add Infinispan cache config
- rename JMSJbossASClient to MessagingJBossASClient to follow
subsystem naming. Also, clean this up a bit.
- Support more of the config options we currently
use/need.
diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/InfinispanJBossASClient.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/InfinispanJBossASClient.java
new file mode 100644
index 0000000..dc60cc4
--- /dev/null
+++ b/modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/InfinispanJBossASClient.java
@@ -0,0 +1,184 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2012 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.common.jbossas.client.controller;
+
+import org.jboss.as.controller.client.ModelControllerClient;
+import org.jboss.dmr.ModelNode;
+
+/**
+ * Provides convenience methods associated with Infinispan cache management.
+ *
+ * @author Jay Shaughnessy
+ * @author John Mazzitelli
+ */
+public class InfinispanJBossASClient extends JBossASClient {
+
+ public static final String SUBSYSTEM_INFINISPAN = "infinispan";
+ public static final String CACHE_CONTAINER = "cache-container";
+ public static final String LOCAL_CACHE = "local-cache";
+
+ public InfinispanJBossASClient(ModelControllerClient client) {
+ super(client);
+ }
+
+ /**
+ * Checks to see if there is already a cache container with the given name.
+ *
+ * @param cacheContainerName the name to check
+ * @return true if there is a cache container with the given name already in existence
+ */
+ public boolean isCacheContainer(String cacheContainerName) throws Exception {
+ Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_INFINISPAN);
+ String haystack = CACHE_CONTAINER;
+ return null != findNodeInList(addr, haystack, cacheContainerName);
+ }
+
+ /**
+ * Checks to see if there is already a local cache with the given name.
+ *
+ * @param localCacheName the name to check
+ * @return true if there is a local cache with the given name already in existence
+ */
+ public boolean isLocalCache(String cacheContainerName, String localCacheName) throws Exception {
+ if (!isCacheContainer(cacheContainerName)) {
+ return false;
+ }
+
+ Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_INFINISPAN, CACHE_CONTAINER, cacheContainerName);
+ String haystack = LOCAL_CACHE;
+ return null != findNodeInList(addr, haystack, localCacheName);
+ }
+
+ /**
+ * Returns a ModelNode that can be used to create a cache container configuration for
+ * subsequent cache configuration. Callers are free to tweak the request that is returned,
+ * if they so choose, before asking the client to execute the request.
+ * <p>
+ * The JNDI name will be java:jboss/infinispan/<cacheContainerName>
+ * </p>
+ *
+ * @param name the name of the cache container
+ * @param defaultCacheName the name of the default cache. The referenced cache must be
+ * subsequently created.
+ *
+ * @return the request to create the cache container configuration.
+ */
+ public ModelNode createNewCacheContainerRequest(String name, String defaultCacheName) {
+ String dmrTemplate = "" //
+ + "{" //
+ + "\"default-cache-name\" => \"%s\" ," //
+ + "\"jndi-name\" => \"%s\" " //
+ + "}";
+
+ String jndiName = "java:jboss/infinispan/" + name;
+ String dmr = String.format(dmrTemplate, defaultCacheName, jndiName);
+
+ Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_INFINISPAN, CACHE_CONTAINER, name);
+ final ModelNode result = ModelNode.fromString(dmr);
+ result.get(OPERATION).set(ADD);
+ result.get(ADDRESS).set(addr.getAddressNode());
+
+ return result;
+ }
+
+ /**
+ * Returns a ModelNode that can be used to create a local cache. Callers are free to tweak the
+ * request that is returned, if they so choose, before asking the client to execute the request.
+ *
+ * @param localCacheName
+ * @param transactionMode if null, defaults to "NONE"
+ * @param evictionStrategy if null, defaults to "LRU"
+ * @param evictionMaxEntries if null, defaults to 50000
+ * @param expirationMaxIdle if null, defaults to 100000
+ * @param isolationLevel if null, defaults to REPEATABLE_READ (currently ignored)
+ *
+ * @return the request that can be used to create the local cache
+ * @Throws IllegalArgumentException if cacheContainerName does not correspond to a defined container
+ */
+ public ModelNode createNewLocalCacheRequest(String cacheContainerName, String localCacheName,
+ String transactionMode, String evictionStrategy, Long evictionMaxEntries, Long expirationMaxIdle,
+ String isolationLevel) throws Exception {
+
+ if (!isCacheContainer(cacheContainerName)) {
+ throw new IllegalArgumentException("cache-container does not exist [" + cacheContainerName + "]");
+ }
+
+ ModelNode[] result = new ModelNode[4];
+
+ // The cache
+ Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_INFINISPAN, CACHE_CONTAINER, cacheContainerName,
+ LOCAL_CACHE, localCacheName);
+ String dmrTemplate = "" //
+ + "{" //
+ + "\"isolation-level\" => \"%s\" " // TODO (jshaughn): ignored, why?
+ + "}";
+ String dmr = String.format(dmrTemplate, //
+ ((null == isolationLevel) ? "REPEATABLE_READ" : isolationLevel));
+
+ result[0] = ModelNode.fromString(dmr);
+ result[0].get(OPERATION).set(ADD);
+ result[0].get(ADDRESS).set(addr.getAddressNode());
+
+ // The cache eviction
+ addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_INFINISPAN, CACHE_CONTAINER, cacheContainerName, LOCAL_CACHE,
+ localCacheName, "eviction", "EVICTION");
+ dmrTemplate = "" //
+ + "{" //
+ + "\"strategy\" => \"%s\" ," //
+ + "\"max-entries\" => %dL " //
+ + "}";
+ dmr = String.format(dmrTemplate, //
+ ((null == evictionStrategy) ? "LRU" : evictionStrategy), //
+ ((null == evictionMaxEntries) ? 50000L : evictionMaxEntries));
+
+ result[1] = ModelNode.fromString(dmr);
+ result[1].get(OPERATION).set(ADD);
+ result[1].get(ADDRESS).set(addr.getAddressNode());
+
+ // The cache expiration
+ addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_INFINISPAN, CACHE_CONTAINER, cacheContainerName, LOCAL_CACHE,
+ localCacheName, "expiration", "EXPIRATION");
+ dmrTemplate = "" //
+ + "{" //
+ + "\"max-idle\" => %dL " //
+ + "}";
+ dmr = String.format(dmrTemplate, //
+ ((null == expirationMaxIdle) ? 100000L : expirationMaxIdle));
+
+ result[2] = ModelNode.fromString(dmr);
+ result[2].get(OPERATION).set(ADD);
+ result[2].get(ADDRESS).set(addr.getAddressNode());
+
+ // The cache transaction
+ addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_INFINISPAN, CACHE_CONTAINER, cacheContainerName, LOCAL_CACHE,
+ localCacheName, "transaction", "TRANSACTION");
+ dmrTemplate = "" //
+ + "{" //
+ + "\"mode\" => \"%s\" " //
+ + "}";
+ dmr = String.format(dmrTemplate, //
+ ((null == transactionMode) ? "NONE" : transactionMode));
+
+ result[3] = ModelNode.fromString(dmr);
+ result[3].get(OPERATION).set(ADD);
+ result[3].get(ADDRESS).set(addr.getAddressNode());
+
+ return createBatchRequest(result);
+ }
+}
diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/JMSJBossASClient.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/JMSJBossASClient.java
deleted file mode 100644
index b9e42c1..0000000
--- a/modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/JMSJBossASClient.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2012 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.common.jbossas.client.controller;
-
-import java.util.List;
-
-import org.jboss.as.controller.client.ModelControllerClient;
-import org.jboss.dmr.ModelNode;
-
-/**
- * Provides convenience methods associated with JMS management.
- *
- * @author Jay Shaughnessy
- * @author John Mazzitelli
- */
-public class JMSJBossASClient extends JBossASClient {
-
- public static final String SUBSYSTEM_MESSAGING = "messaging";
- public static final String HORNETQ_SERVER = "hornetq-server";
- public static final String JMS_QUEUE = "jms-queue";
- public static final String OP_ENABLE = "enable";
-
- public JMSJBossASClient(ModelControllerClient client) {
- super(client);
- }
-
- public boolean isQueueEnabled(String queueName) throws Exception {
- Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_MESSAGING, HORNETQ_SERVER, "default", JMS_QUEUE,
- queueName);
- ModelNode results = readResource(addr);
- boolean enabledFlag = false;
- if (results.hasDefined("enabled")) {
- ModelNode enabled = results.get("enabled");
- enabledFlag = enabled.asBoolean(false);
- }
- return enabledFlag;
- }
-
- public void enableQueue(String queueName) throws Exception {
- if (isQueueEnabled(queueName)) {
- return; // nothing to do - it's already enabled
- }
-
- Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_MESSAGING, HORNETQ_SERVER, "default", JMS_QUEUE,
- queueName);
- ModelNode request = createRequest(OP_ENABLE, addr);
- request.get(PERSISTENT).set(true);
- ModelNode results = execute(request);
- if (!isSuccess(results)) {
- throw new FailureException(results);
- }
- return; // everything is OK
- }
-
- /**
- * Checks to see if there is already a queue with the given name.
- *
- * @param queueName the name to check
- * @return true if there is a queue with the given name already in existence
- */
- public boolean isQueue(String queueName) throws Exception {
- Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_MESSAGING, HORNETQ_SERVER, "default");
- String haystack = JMS_QUEUE;
- return null != findNodeInList(addr, haystack, queueName);
- }
-
- /**
- * Returns a ModelNode that can be used to create a queue.
- * Callers are free to tweak the queue request that is returned,
- * if they so choose, before asking the client to execute the request.
- *
- * @param name the queue name
- * @param entryNames the jndiNames, each is prefixed with 'java:/'. Only supports one entry currently.
- *
- * @return the request that can be used to create the queue
- */
- public ModelNode createNewQueueRequest(String name, List<String> entryNames) {
-
- String dmrTemplate = "" //
- + "{" //
- + "\"entries\" => [\"%s\"] " //
- + "}";
-
- String dmr = String.format(dmrTemplate, entryNames.get(0));
-
- Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_MESSAGING, HORNETQ_SERVER, "default", JMS_QUEUE, name);
- final ModelNode request = ModelNode.fromString(dmr);
- request.get(OPERATION).set(ADD);
- request.get(ADDRESS).set(addr.getAddressNode());
-
- return request;
- }
-
-}
diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/MessagingJBossASClient.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/MessagingJBossASClient.java
new file mode 100644
index 0000000..85951eb
--- /dev/null
+++ b/modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/MessagingJBossASClient.java
@@ -0,0 +1,83 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2012 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.common.jbossas.client.controller;
+
+import java.util.List;
+
+import org.jboss.as.controller.client.ModelControllerClient;
+import org.jboss.dmr.ModelNode;
+
+/**
+ * Provides convenience methods associated with JMS management.
+ *
+ * @author Jay Shaughnessy
+ * @author John Mazzitelli
+ */
+public class MessagingJBossASClient extends JBossASClient {
+
+ public static final String SUBSYSTEM_MESSAGING = "messaging";
+ public static final String HORNETQ_SERVER = "hornetq-server";
+ public static final String JMS_QUEUE = "jms-queue";
+
+ public MessagingJBossASClient(ModelControllerClient client) {
+ super(client);
+ }
+
+ /**
+ * Checks to see if there is already a queue with the given name.
+ *
+ * @param queueName the name to check
+ * @return true if there is a queue with the given name already in existence
+ */
+ public boolean isQueue(String queueName) throws Exception {
+ Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_MESSAGING, HORNETQ_SERVER, "default");
+ String haystack = JMS_QUEUE;
+ return null != findNodeInList(addr, haystack, queueName);
+ }
+
+ /**
+ * Returns a ModelNode that can be used to create a queue.
+ * Callers are free to tweak the queue request that is returned,
+ * if they so choose, before asking the client to execute the request.
+ *
+ * @param name the queue name
+ * @param durable if null, default is "true"
+ * @param entryNames the jndiNames, each is prefixed with 'java:/'. Only supports one entry currently.
+ *
+ * @return the request that can be used to create the queue
+ */
+ public ModelNode createNewQueueRequest(String name, Boolean durable, List<String> entryNames) {
+
+ String dmrTemplate = "" //
+ + "{" //
+ + "\"durable\" => \"%s\", " //
+ + "\"entries\" => [\"%s\"] " //
+ + "}";
+
+ String dmr = String.format(dmrTemplate, ((null == durable) ? "true" : durable.toString()), entryNames.get(0));
+
+ Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_MESSAGING, HORNETQ_SERVER, "default", JMS_QUEUE, name);
+ final ModelNode request = ModelNode.fromString(dmr);
+ request.get(OPERATION).set(ADD);
+ request.get(ADDRESS).set(addr.getAddressNode());
+
+ return request;
+ }
+
+}
diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java
index ac7df1b..830b76b 100644
--- a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java
+++ b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java
@@ -574,6 +574,9 @@ public class InstallerGWTServiceImpl extends RemoteServiceServlet implements Ins
// create the security domain needed by REST
ServerInstallUtil.createRESTSecurityDomain(client, serverProperties);
+ // set up REST cache
+ ServerInstallUtil.createNewCaches(client, serverProperties);
+
// create the JDBC driver configurations for use by datasources
ServerInstallUtil.createNewJdbcDrivers(client, serverProperties);
diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java
index 8ee46cb..e80ad53 100644
--- a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java
+++ b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java
@@ -50,8 +50,9 @@ import org.rhq.common.jbossas.client.controller.Address;
import org.rhq.common.jbossas.client.controller.CoreJBossASClient;
import org.rhq.common.jbossas.client.controller.DatasourceJBossASClient;
import org.rhq.common.jbossas.client.controller.FailureException;
+import org.rhq.common.jbossas.client.controller.InfinispanJBossASClient;
import org.rhq.common.jbossas.client.controller.JBossASClient;
-import org.rhq.common.jbossas.client.controller.JMSJBossASClient;
+import org.rhq.common.jbossas.client.controller.MessagingJBossASClient;
import org.rhq.common.jbossas.client.controller.SecurityDomainJBossASClient;
import org.rhq.core.db.DatabaseType;
import org.rhq.core.db.DatabaseTypeFactory;
@@ -104,6 +105,8 @@ public class ServerInstallUtil {
private static final String JMS_ALERT_CONDITION_QUEUE = "AlertConditionQueue";
private static final String JMS_DRIFT_CHANGESET_QUEUE = "DriftChangesetQueue";
private static final String JMS_DRIFT_FILE_QUEUE = "DriftFileQueue";
+ private static final String RHQ_CACHE_CONTAINER = "rhq";
+ private static final String RHQ_CACHE = "rhqCache";
/**
* Configure the deployment scanner to get ready to deploy the application.
@@ -231,52 +234,60 @@ public class ServerInstallUtil {
public static void createNewJMSQueues(ModelControllerClient mcc, HashMap<String, String> serverProperties)
throws Exception {
- final JMSJBossASClient client = new JMSJBossASClient(mcc);
+ final MessagingJBossASClient client = new MessagingJBossASClient(mcc);
final List<String> entryNames = new ArrayList<String>();
- String queue = JMS_ALERT_CONDITION_QUEUE;
- if (!client.isQueue(queue)) {
+ // TODO (jshaughn): Prior to HornetQ we set recoveryRetries to 0: "don't redeliver messages on failure. It
+ // just causes more failures. just go straight to the dead messages by setting recoveryRetries to 0.
+ // This is equivalent to setting the dLQMaxResent property to 0 in the MessageDriven annotation in
+ // the class definition."
+ // HornetQ has different semantics, and may behave well with default settings. If not, we'll
+ // likely need to add specific <address-setting> elements for our queues, which set
+ // max-delivery-attempts to 0. The documented default is 10.
+
+ String queueName = JMS_ALERT_CONDITION_QUEUE;
+ if (!client.isQueue(queueName)) {
entryNames.clear();
- entryNames.add("queue/" + queue);
- ModelNode request = client.createNewQueueRequest(queue, entryNames);
+ entryNames.add("queue/" + queueName);
+ ModelNode request = client.createNewQueueRequest(queueName, true, entryNames);
ModelNode results = client.execute(request);
- if (!JMSJBossASClient.isSuccess(results)) {
- throw new FailureException(results, "Failed to create JMS Queue [" + queue + "]");
+ if (!MessagingJBossASClient.isSuccess(results)) {
+ throw new FailureException(results, "Failed to create JMS Queue [" + queueName + "]");
} else {
- LOG.info("JMS queue [" + queue + "] created");
+ LOG.info("JMS queue [" + queueName + "] created");
}
} else {
- LOG.info("JMS Queue [" + queue + "] already exists, skipping the creation request");
+ LOG.info("JMS Queue [" + queueName + "] already exists, skipping the creation request");
}
-
- queue = JMS_DRIFT_CHANGESET_QUEUE;
- if (!client.isQueue(queue)) {
+
+ queueName = JMS_DRIFT_CHANGESET_QUEUE;
+ if (!client.isQueue(queueName)) {
entryNames.clear();
- entryNames.add("queue/" + queue);
- ModelNode request = client.createNewQueueRequest(queue, entryNames);
+ entryNames.add("queue/" + queueName);
+ ModelNode request = client.createNewQueueRequest(queueName, true, entryNames);
ModelNode results = client.execute(request);
- if (!JMSJBossASClient.isSuccess(results)) {
- throw new FailureException(results, "Failed to create JMS Queue [" + queue + "]");
+ if (!MessagingJBossASClient.isSuccess(results)) {
+ throw new FailureException(results, "Failed to create JMS Queue [" + queueName + "]");
} else {
- LOG.info("JMS queue [" + queue + "] created");
+ LOG.info("JMS queue [" + queueName + "] created");
}
} else {
- LOG.info("JMS Queue [" + queue + "] already exists, skipping the creation request");
+ LOG.info("JMS Queue [" + queueName + "] already exists, skipping the creation request");
}
- queue = JMS_DRIFT_FILE_QUEUE;
- if (!client.isQueue(queue)) {
+ queueName = JMS_DRIFT_FILE_QUEUE;
+ if (!client.isQueue(queueName)) {
entryNames.clear();
- entryNames.add("queue/" + queue);
- ModelNode request = client.createNewQueueRequest(queue, entryNames);
+ entryNames.add("queue/" + queueName);
+ ModelNode request = client.createNewQueueRequest(queueName, true, entryNames);
ModelNode results = client.execute(request);
- if (!JMSJBossASClient.isSuccess(results)) {
- throw new FailureException(results, "Failed to create JMS Queue [" + queue + "]");
+ if (!MessagingJBossASClient.isSuccess(results)) {
+ throw new FailureException(results, "Failed to create JMS Queue [" + queueName + "]");
} else {
- LOG.info("JMS queue [" + queue + "] created");
+ LOG.info("JMS queue [" + queueName + "] created");
}
} else {
- LOG.info("JMS Queue [" + queue + "] already exists, skipping the creation request");
+ LOG.info("JMS Queue [" + queueName + "] already exists, skipping the creation request");
}
}
@@ -304,6 +315,47 @@ public class ServerInstallUtil {
}
/**
+ * Creates the Infinispan caches for RHQ.
+ *
+ * @param mcc the JBossAS management client
+ * @param serverProperties contains the obfuscated password to store in the security domain
+ * @throws Exception
+ */
+ public static void createNewCaches(ModelControllerClient mcc, HashMap<String, String> serverProperties)
+ throws Exception {
+
+ final InfinispanJBossASClient client = new InfinispanJBossASClient(mcc);
+ final String cacheContainerName = RHQ_CACHE_CONTAINER;
+ final String localCacheName = RHQ_CACHE;
+ if (!client.isCacheContainer(cacheContainerName)) {
+ ModelNode request = client.createNewCacheContainerRequest(cacheContainerName, localCacheName);
+ ModelNode results = client.execute(request);
+ if (!MessagingJBossASClient.isSuccess(results)) {
+ throw new FailureException(results, "Failed to create Cache container [" + cacheContainerName + "]");
+ } else {
+ LOG.info("Cache container [" + cacheContainerName + "] created");
+ }
+
+ } else {
+ LOG.info("Cache container [" + cacheContainerName + "] already exists, skipping the creation request");
+ }
+
+ if (!client.isLocalCache(cacheContainerName, localCacheName)) {
+ ModelNode request = client.createNewLocalCacheRequest(cacheContainerName, localCacheName, null, null, null,
+ null, null);
+ ModelNode results = client.execute(request);
+ if (!MessagingJBossASClient.isSuccess(results)) {
+ throw new FailureException(results, "Failed to create Local Cache [" + localCacheName + "]");
+ } else {
+ LOG.info("Local Cache [" + localCacheName + "] created");
+ }
+
+ } else {
+ LOG.info("Local Cache [" + localCacheName + "] already exists, skipping the creation request");
+ }
+ }
+
+ /**
* Creates JDBC driver configurations so the datasources can properly connect to the backend databases.
* This will attempt to create drivers for all supported databases, not just for the database type that
* is currently configured.