modules/common/cassandra-installer/pom.xml | 2
modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java | 115 +++---
modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageProperty.java | 181 ++++++++++
modules/core/domain/src/main/java/org/rhq/core/domain/common/composite/SystemSetting.java | 16
modules/core/util/src/main/java/org/rhq/core/util/PropertiesFileUpdate.java | 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GeneralPropertiesAlertDefinitionForm.java | 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/SingleAlertDefinitionView.java | 12
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java | 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/CustomResourceTreeGrid.java | 9
modules/enterprise/gui/coregui/src/main/webapp/images/resources/folder_autogroup_closed.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/resources/folder_autogroup_opened.png |binary
modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-encode-password.bat | 4
modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-encode-password.sh | 43 ++
modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java | 55 ---
modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerProperties.java | 151 +++++++-
modules/enterprise/server/installer/src/main/resources/logging.properties | 6
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementAggregate.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDefinitionManagerBean.java | 22 -
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/MeasurementMetadataManagerBean.java | 82 ++--
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/PurgePluginsJob.java | 30 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/PurgeResourceTypesJob.java | 44 +-
modules/enterprise/server/server-control/pom.xml | 22 +
modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/RHQControl.java | 133 ++++++-
modules/enterprise/server/server-control/src/main/resources/logging.properties | 6
modules/enterprise/server/server-control/src/main/resources/module/main/module.xml | 32 -
modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/MeasurementCollector.java | 5
modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/MeasurementReader.java | 99 +++++
modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/Metrics.java | 15
modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/MinutesDateTimeService.java | 27 +
modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/SecondsDateTimeService.java | 27 +
modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/Simulator.java | 19 -
modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/SimulatorDateTimeService.java | 27 -
modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/plan/SimulationPlan.java | 74 ++++
modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/plan/SimulationPlanner.java | 71 +++
34 files changed, 1075 insertions(+), 271 deletions(-)
New commits:
commit 46f7ba232572716bb26c0e7ca6628978aaf51f6f
Merge: 0431c61 6c4b6c6
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Wed Oct 2 15:15:57 2013 -0400
Merge branch 'master' into nightly/rhq.jon
commit 6c4b6c60d566d2a27c43a1ede117c52472af2763
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Wed Oct 2 15:08:25 2013 +0200
Make sure testInterruptedComponentInvocationContext cannot read a wrong value (caughtInterruptedComponentInvocation is modified in another thread)
diff --git a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/inventory/ResourceContainerTest.java b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/inventory/ResourceContainerTest.java
index c7c2b77..ba94121 100644
--- a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/inventory/ResourceContainerTest.java
+++ b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/inventory/ResourceContainerTest.java
@@ -174,7 +174,7 @@ public class ResourceContainerTest {
private class MockResourceComponent implements ResourceComponent, OperationFacet {
static final String OPERATION_RESULT = "uninterrupted";
boolean naughty;
- boolean caughtInterruptedComponentInvocation;
+ volatile boolean caughtInterruptedComponentInvocation;
ResourceContext resourceContext;
MockResourceComponent(boolean naughty) {
commit 9118dcdb89cbb9cf7a67802b9890f222849579db
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Tue Oct 1 18:51:20 2013 +0200
Bug 1014300 - java.util.NoSuchElementException thrown when deleting RHQ plugins
Do not use the criteria query iterator which is buggy (besides it adds no value here: more lines and less readable code)
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDefinitionManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDefinitionManagerBean.java
index fba8a68..23bcc54 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDefinitionManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDefinitionManagerBean.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
+ * Copyright (C) 2005-2013 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -13,8 +13,8 @@
* 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.
+ * 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.enterprise.server.measurement;
@@ -51,7 +51,7 @@ import org.rhq.enterprise.server.util.CriteriaQueryRunner;
@Stateless
public class MeasurementDefinitionManagerBean implements MeasurementDefinitionManagerLocal,
MeasurementDefinitionManagerRemote {
- private Log log = LogFactory.getLog(MeasurementDefinitionManagerBean.class);
+ private static final Log LOG = LogFactory.getLog(MeasurementDefinitionManagerBean.class);
@PersistenceContext(unitName = RHQConstants.PERSISTENCE_UNIT_NAME)
private EntityManager entityManager;
@@ -95,15 +95,15 @@ public class MeasurementDefinitionManagerBean implements MeasurementDefinitionMa
entityManager.remove(def);
}
} catch (EntityNotFoundException enfe) {
- if (log.isDebugEnabled()) {
- log.debug("Definition # " + def.getId() + " not found: " + enfe.getMessage());
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Definition # " + def.getId() + " not found: " + enfe.getMessage());
}
} catch (PersistenceException pe) {
- if (log.isDebugEnabled()) {
- log.debug("Exception when deleting Definition # " + def.getId() + ": " + pe.getMessage());
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Exception when deleting Definition # " + def.getId() + ": " + pe.getMessage());
}
} catch (Exception e) {
- log.warn(e.fillInStackTrace());
+ LOG.warn(e.fillInStackTrace());
}
}
@@ -134,10 +134,8 @@ public class MeasurementDefinitionManagerBean implements MeasurementDefinitionMa
public PageList<MeasurementDefinition> findMeasurementDefinitionsByCriteria(Subject subject,
MeasurementDefinitionCriteria criteria) {
CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject, criteria);
- ;
-
CriteriaQueryRunner<MeasurementDefinition> queryRunner = new CriteriaQueryRunner<MeasurementDefinition>(
criteria, generator, entityManager);
return queryRunner.execute();
}
-}
\ No newline at end of file
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/MeasurementMetadataManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/MeasurementMetadataManagerBean.java
index cf813ca..51d3112 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/MeasurementMetadataManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/MeasurementMetadataManagerBean.java
@@ -1,8 +1,29 @@
+/*
+ * 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.enterprise.server.resource.metadata;
+import static org.rhq.core.domain.criteria.Criteria.Restriction.COLLECTION_ONLY;
+
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -26,18 +47,14 @@ import org.rhq.core.domain.measurement.MeasurementUnits;
import org.rhq.core.domain.measurement.NumericType;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.measurement.MeasurementDefinitionManagerLocal;
import org.rhq.enterprise.server.measurement.MeasurementScheduleManagerLocal;
-import org.rhq.enterprise.server.util.CriteriaQuery;
-import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
@Stateless
public class MeasurementMetadataManagerBean implements MeasurementMetadataManagerLocal {
-
- private final Log log = LogFactory.getLog(MeasurementMetadataManagerBean.class);
+ private static final Log LOG = LogFactory.getLog(MeasurementMetadataManagerBean.class);
@PersistenceContext(unitName = RHQConstants.PERSISTENCE_UNIT_NAME)
private EntityManager entityMgr;
@@ -54,7 +71,9 @@ public class MeasurementMetadataManagerBean implements MeasurementMetadataManage
@Override
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void updateMetadata(ResourceType existingType, ResourceType newType) {
- log.debug("Updating metric definitions for " + existingType);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Updating metric definitions for " + existingType);
+ }
existingType = entityMgr.find(ResourceType.class, existingType.getId());
Set<MeasurementDefinition> existingDefinitions = existingType.getMetricDefinitions();
@@ -63,15 +82,15 @@ public class MeasurementMetadataManagerBean implements MeasurementMetadataManage
Set<MeasurementDefinition> newTypeMetricDefinitions = getMetricDefinitions(newType);
if (existingDefinitions.isEmpty()) {
- if (log.isDebugEnabled()) {
- log.debug(existingType + " currently does not define any metric definitions.");
- log.debug("New metric definitions to be added: " + newType.getMetricDefinitions());
+ if (LOG.isDebugEnabled()) {
+ LOG.debug(existingType + " currently does not define any metric definitions. "
+ + "New metric definitions to be added: " + newType.getMetricDefinitions());
}
// They're all new.
for (MeasurementDefinition newDefinition : newType.getMetricDefinitions()) {
if (newDefinition.getDefaultInterval() < MeasurementSchedule.MINIMUM_INTERVAL) {
newDefinition.setDefaultInterval(MeasurementSchedule.MINIMUM_INTERVAL);
- log.info("Definition [" + newDefinition
+ LOG.info("Definition [" + newDefinition
+ "] has too short of a default interval, setting to minimum");
}
existingType.addMetricDefinition(newDefinition);
@@ -89,8 +108,8 @@ public class MeasurementMetadataManagerBean implements MeasurementMetadataManage
&& (existingDefinition.isPerMinute() == newDefinition.isPerMinute())) {
found = true;
- if (log.isDebugEnabled()) {
- log.debug("Updating existing metric definition: " + existingDefinition);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Updating existing metric definition: " + existingDefinition);
}
// We normally protect the user's interval settings. But the Availability metric is
@@ -112,7 +131,7 @@ public class MeasurementMetadataManagerBean implements MeasurementMetadataManage
// but we cannot allow too-short of an interval, so override it if necessary
if (existingDefinition.getDefaultInterval() < MeasurementSchedule.MINIMUM_INTERVAL) {
existingDefinition.setDefaultInterval(MeasurementSchedule.MINIMUM_INTERVAL);
- log.info("Definition [" + existingDefinition
+ LOG.info("Definition [" + existingDefinition
+ "] has too short of a default interval, setting to minimum");
}
@@ -128,7 +147,7 @@ public class MeasurementMetadataManagerBean implements MeasurementMetadataManage
if (!found) {
// It's new - create it
- log.info("Metadata update: Adding new " + newDefinition.getDataType().name().toLowerCase() + " definition ["
+ LOG.info("Metadata update: Adding new " + newDefinition.getDataType().name().toLowerCase() + " definition ["
+ newDefinition.getDisplayName() + "] to type " + existingType + "...");
existingType.addMetricDefinition(newDefinition);
entityMgr.persist(newDefinition);
@@ -150,7 +169,7 @@ public class MeasurementMetadataManagerBean implements MeasurementMetadataManage
// ... and remove them
existingDefinitions.removeAll(definitionsToDelete);
for (MeasurementDefinition definitionToDelete : definitionsToDelete) {
- log.info("Metadata update: Removing " + definitionToDelete.getDataType().name().toLowerCase() + " definition ["
+ LOG.info("Metadata update: Removing " + definitionToDelete.getDataType().name().toLowerCase() + " definition ["
+ definitionToDelete.getDisplayName() + "] from type " + existingType + "...");
measurementDefinitionMgr.removeMeasurementDefinition(definitionToDelete);
}
@@ -215,33 +234,24 @@ public class MeasurementMetadataManagerBean implements MeasurementMetadataManage
@Override
public void deleteMetadata(ResourceType existingType) {
- log.debug("Deleting metric definitions for " + existingType);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Deleting metric definitions for " + existingType);
+ }
MeasurementDefinitionCriteria criteria = new MeasurementDefinitionCriteria();
criteria.addFilterResourceTypeId(existingType.getId());
-
- //Use CriteriaQuery to automatically chunk/page through criteria query results
- CriteriaQueryExecutor<MeasurementDefinition, MeasurementDefinitionCriteria> queryExecutor = new CriteriaQueryExecutor<MeasurementDefinition, MeasurementDefinitionCriteria>() {
- @Override
- public PageList<MeasurementDefinition> execute(MeasurementDefinitionCriteria criteria) {
- return measurementDefinitionMgr
- .findMeasurementDefinitionsByCriteria(subjectMgr.getOverlord(), criteria);
- }
- };
-
- CriteriaQuery<MeasurementDefinition, MeasurementDefinitionCriteria> definitions = new CriteriaQuery<MeasurementDefinition, MeasurementDefinitionCriteria>(
- criteria, queryExecutor);
+ criteria.setRestriction(COLLECTION_ONLY);
// Remove the type's metric definitions. We do this separately, rather than just relying on cascade
// upon deletion of the ResourceType, because the removeMeasurementDefinition() will also take care
// of removing any associated schedules and those schedules' OOBs.
- if (definitions != null) {
- Iterator<MeasurementDefinition> defIter = definitions.iterator();
- while (defIter.hasNext()) {
- MeasurementDefinition def = defIter.next();
- measurementDefinitionMgr.removeMeasurementDefinition(def);
- defIter.remove();
+ List<MeasurementDefinition> definitions = Collections.emptyList();
+ do {
+ for (MeasurementDefinition definition : definitions) {
+ measurementDefinitionMgr.removeMeasurementDefinition(definition);
}
- }
+ definitions = measurementDefinitionMgr.findMeasurementDefinitionsByCriteria(subjectMgr.getOverlord(),
+ criteria);
+ } while (!definitions.isEmpty());
}
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/PurgePluginsJob.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/PurgePluginsJob.java
index 79e49b7..6aa3517 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/PurgePluginsJob.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/PurgePluginsJob.java
@@ -1,3 +1,22 @@
+/*
+ * 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.enterprise.server.scheduler.jobs;
import java.util.ArrayList;
@@ -19,8 +38,7 @@ import org.rhq.enterprise.server.util.LookupUtil;
* already been purged. Puring resource types is performed by {@link PurgeResourceTypesJob}.
*/
public class PurgePluginsJob extends AbstractStatefulJob {
-
- private static final Log log = LogFactory.getLog(PurgePluginsJob.class);
+ private static final Log LOG = LogFactory.getLog(PurgePluginsJob.class);
@Override
public void executeJobCode(JobExecutionContext context) throws JobExecutionException {
@@ -30,14 +48,18 @@ public class PurgePluginsJob extends AbstractStatefulJob {
for (Plugin plugin : plugins) {
if (pluginMgr.isReadyForPurge(plugin)) {
- log.debug("Preparing to purge plugin [" + plugin.getName() + "]");
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Preparing to purge plugin [" + plugin.getName() + "]");
+ }
pluginsToPurge.add(plugin);
}
}
if (!pluginsToPurge.isEmpty()) {
pluginMgr.purgePlugins(pluginsToPurge);
- log.debug("Purged " + pluginsToPurge.size() + " plugins");
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Purged " + pluginsToPurge.size() + " plugins");
+ }
}
}
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/PurgeResourceTypesJob.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/PurgeResourceTypesJob.java
index febeac2..7b24454 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/PurgeResourceTypesJob.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/PurgeResourceTypesJob.java
@@ -1,16 +1,37 @@
+/*
+ * 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.enterprise.server.scheduler.jobs;
+import java.util.List;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
+
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.enterprise.server.inventory.InventoryManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
-import java.util.List;
-
public class PurgeResourceTypesJob extends AbstractStatefulJob {
+ private static final Log LOG = LogFactory.getLog(PurgeResourceTypesJob.class);
private static class DeletionStats {
int numDeleted;
@@ -22,8 +43,6 @@ public class PurgeResourceTypesJob extends AbstractStatefulJob {
}
}
- private static final Log log = LogFactory.getLog(PurgeResourceTypesJob.class);
-
@Override
public void executeJobCode(JobExecutionContext context) throws JobExecutionException {
InventoryManagerLocal inventoryMgr = LookupUtil.getInventoryManager();
@@ -33,20 +52,25 @@ public class PurgeResourceTypesJob extends AbstractStatefulJob {
List<ResourceType> deletedTypes = inventoryMgr.getDeletedTypes();
for (ResourceType deletedType : deletedTypes) {
if (inventoryMgr.isReadyForPermanentRemoval(deletedType)) {
- log.debug("Permanently removing " + deletedType);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Permanently removing " + deletedType);
+ }
long startTime = System.currentTimeMillis();
inventoryMgr.purgeDeletedResourceType(deletedType);
long endTime = System.currentTimeMillis();
stats.numDeleted++;
- log.debug("Deleted " + deletedType + " in " + (endTime - startTime) + " ms");
- }
- else {
- log.debug(deletedType + " has been deleted but is not yet ready for permanent removal.");
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Deleted " + deletedType + " in " + (endTime - startTime) + " ms");
+ }
+ } else {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug(deletedType + " has been deleted but is not yet ready for permanent removal.");
+ }
}
}
long stopTotalTime = System.currentTimeMillis();
stats.deletionTime = stopTotalTime - startTotalTime;
- log.debug(stats);
+ LOG.debug(stats);
}
commit ccc56e6a8d8d2468b6867785ec72ac2cb9fb75eb
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Oct 1 21:54:05 2013 -0400
use the configured node addresses
diff --git a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/Simulator.java b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/Simulator.java
index 45179c5..32321e9 100644
--- a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/Simulator.java
+++ b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/Simulator.java
@@ -155,8 +155,7 @@ public class Simulator implements ShutdownManager {
private void createSchema(String[] nodes, int cqlPort) {
try {
log.info("Creating schema");
- SchemaManager schemaManager = new SchemaManager("rhqadmin", "1eeb2f255e832171df8592078de921bc",
- new String[] {"127.0.0.1"}, 9142);
+ SchemaManager schemaManager = new SchemaManager("rhqadmin", "1eeb2f255e832171df8592078de921bc", nodes, 9142);
schemaManager.install();
} catch (Exception e) {
throw new RuntimeException("Failed to start simulator. An error occurred during schema creation.", e);
commit 65dd352f3f787c4c2ee007db7f335f94e610c259
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Oct 1 20:18:55 2013 -0400
initial support for readers
diff --git a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/MeasurementReader.java b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/MeasurementReader.java
new file mode 100644
index 0000000..22da083
--- /dev/null
+++ b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/MeasurementReader.java
@@ -0,0 +1,99 @@
+package org.rhq.metrics.simulator;
+
+import java.util.Iterator;
+import java.util.concurrent.ThreadLocalRandom;
+
+import com.codahale.metrics.Timer;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.joda.time.Days;
+import org.joda.time.Duration;
+import org.joda.time.Hours;
+
+import org.rhq.core.domain.measurement.composite.MeasurementDataNumericHighLowComposite;
+import org.rhq.server.metrics.MetricsServer;
+
+/**
+ * @author John Sanda
+ */
+public class MeasurementReader implements Runnable {
+
+ private final Log log = LogFactory.getLog(MeasurementReader.class);
+
+ private long intervalRate;
+
+ private Metrics metrics;
+
+ private MetricsServer metricsServer;
+
+ private int startingSchedule;
+
+ private int batchSize;
+
+ public MeasurementReader(long intervalRate, Metrics metrics, MetricsServer metricsServer, int startingSchedule,
+ int batchSize) {
+ this.intervalRate = intervalRate;
+ this.metrics = metrics;
+ this.metricsServer = metricsServer;
+ this.startingSchedule = startingSchedule;
+ this.batchSize = batchSize;
+ }
+
+ @Override
+ public void run() {
+ log.info("Running metrics queries");
+
+ ThreadLocalRandom random = ThreadLocalRandom.current();
+ int bound = startingSchedule + batchSize;
+
+ findResourceDataForPast24Hours(random.nextInt(startingSchedule, bound));
+ findResourceDataForPastWeek(random.nextInt(startingSchedule, bound));
+ findResourceDataForPast2Weeks(random.nextInt(startingSchedule, bound));
+ findResourceDataForPast31Days(random.nextInt(startingSchedule, bound));
+ findResourceDataForPastYear(random.nextInt(startingSchedule, bound));
+
+ log.info("Finished running metrics queries");
+ }
+
+ private void findResourceDataForPast24Hours(int scheduleId) {
+ Duration duration = Hours.hours(24).toStandardSeconds().toStandardDuration();
+ findResourceData(scheduleId, duration, metrics.twentyFourHourResourceQueryTime);
+ }
+
+ private void findResourceDataForPastWeek(int scheduleId) {
+ Duration duration = Days.SEVEN.toStandardSeconds().minus(5).toStandardDuration();
+ findResourceData(scheduleId, duration, metrics.oneWeekResourceQueryTime);
+ }
+
+ private void findResourceDataForPast2Weeks(int scheduleId) {
+ Duration duration = Days.days(14).toStandardSeconds().minus(5).toStandardDuration();
+ findResourceData(scheduleId, duration, metrics.twoWeekResourceQueryTime);
+ }
+
+ private void findResourceDataForPast31Days(int scheduleId) {
+ Duration duration = Days.days(31).toStandardSeconds().minus(5).toStandardDuration();
+ findResourceData(scheduleId, duration, metrics.monthResourceQueryTime);
+ }
+
+ private void findResourceDataForPastYear(int scheduleId) {
+ Duration duration = Days.days(365).toStandardSeconds().minus(5).toStandardDuration();
+ findResourceData(scheduleId, duration, metrics.yearResourceQueryTime);
+ }
+
+ private void findResourceData(int scheduleId, Duration duration, Timer timer) {
+ long end = System.currentTimeMillis();
+ long start = end - (duration.getMillis() / intervalRate);
+ Timer.Context context = timer.time();
+ try {
+ Iterable<MeasurementDataNumericHighLowComposite> data = metricsServer.findDataForResource(scheduleId, start,
+ end, 60);
+ Iterator<MeasurementDataNumericHighLowComposite> iterator = data.iterator();
+ for (MeasurementDataNumericHighLowComposite datum : data) {
+
+ }
+ } finally {
+ context.stop();
+ }
+ }
+}
diff --git a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/Metrics.java b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/Metrics.java
index f7ea87a..59aa0dd 100644
--- a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/Metrics.java
+++ b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/Metrics.java
@@ -19,12 +19,27 @@ public class Metrics {
public final Timer totalAggregationTime;
+ public final Timer twentyFourHourResourceQueryTime;
+
+ public final Timer oneWeekResourceQueryTime;
+
+ public final Timer twoWeekResourceQueryTime;
+
+ public final Timer monthResourceQueryTime;
+
+ public final Timer yearResourceQueryTime;
+
public Metrics() {
registry = new MetricRegistry();
rawInserts = registry.meter(name(MeasurementCollector.class, "rawInserts"));
batchInsertTime = registry.timer(name(MeasurementCollector.class, "batchInsertTime"));
totalAggregationTime = registry.timer(name(MeasurementAggregator.class, "totalAggregationTime"));
+ twentyFourHourResourceQueryTime = registry.timer(name(MeasurementReader.class, "24HourResourceDataQuery"));
+ oneWeekResourceQueryTime = registry.timer(name(MeasurementReader.class, "oneWeekResourceQueryData"));
+ twoWeekResourceQueryTime = registry.timer(name(MeasurementReader.class, "twoWeekResourceQueryData"));
+ monthResourceQueryTime = registry.timer(name(MeasurementReader.class, "monthResourceQueryTime"));
+ yearResourceQueryTime = registry.timer(name(MeasurementReader.class, "yearResourceQueryTime"));
}
}
diff --git a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/Simulator.java b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/Simulator.java
index 4b250b4..45179c5 100644
--- a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/Simulator.java
+++ b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/Simulator.java
@@ -59,11 +59,14 @@ public class Simulator implements ShutdownManager {
final ScheduledExecutorService collectors = Executors.newScheduledThreadPool(
plan.getNumMeasurementCollectors(), new SimulatorThreadFactory());
final ExecutorService aggregationQueue = Executors.newSingleThreadExecutor(new SimulatorThreadFactory());
+ final ScheduledExecutorService readers = Executors.newScheduledThreadPool(plan.getNumReaders(),
+ new SimulatorThreadFactory());
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
shutdown(collectors, "collectors", 5);
+ shutdown(readers, "readers", 5);
shutdown(aggregators, "aggregators", 1);
shutdown(aggregationQueue, "aggregationQueue", Integer.MAX_VALUE);
}
@@ -96,6 +99,11 @@ public class Simulator implements ShutdownManager {
aggregators.scheduleAtFixedRate(measurementAggregator, 0, plan.getAggregationInterval(),
TimeUnit.MILLISECONDS);
+
+ MeasurementReader reader = new MeasurementReader(plan.getSimulationRate(), metrics, metricsServer, 0,
+ plan.getBatchSize());
+ readers.scheduleAtFixedRate(reader, 30, 30, TimeUnit.SECONDS);
+
try {
Thread.sleep(Minutes.minutes(plan.getSimulationTime()).toStandardDuration().getMillis());
} catch (InterruptedException e) {
diff --git a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/plan/SimulationPlan.java b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/plan/SimulationPlan.java
index dfe0695..33b3bbf 100644
--- a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/plan/SimulationPlan.java
+++ b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/plan/SimulationPlan.java
@@ -78,6 +78,12 @@ public class SimulationPlan {
private DateTimeService dateTimeService;
+ private int numReaders;
+
+ private long readInterval;
+
+ private long simulationRate;
+
public DateTimeService getDateTimeService() {
return dateTimeService;
}
@@ -165,4 +171,28 @@ public class SimulationPlan {
public void setIntervalType(IntervalType intervalType) {
this.intervalType = intervalType;
}
+
+ public int getNumReaders() {
+ return numReaders;
+ }
+
+ public void setNumReaders(int numReaders) {
+ this.numReaders = numReaders;
+ }
+
+ public long getReadInterval() {
+ return readInterval;
+ }
+
+ public void setReadInterval(long readInterval) {
+ this.readInterval = readInterval;
+ }
+
+ public long getSimulationRate() {
+ return simulationRate;
+ }
+
+ public void setSimulationRate(long simulationRate) {
+ this.simulationRate = simulationRate;
+ }
}
diff --git a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/plan/SimulationPlanner.java b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/plan/SimulationPlanner.java
index 95871bd..e601212 100644
--- a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/plan/SimulationPlanner.java
+++ b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/plan/SimulationPlanner.java
@@ -58,6 +58,7 @@ public class SimulationPlanner {
simulation.setAggregationInterval(getLong(root.get("aggregationInterval"), 2500L));
simulation.setMetricsServerConfiguration(createSecondsConfiguration());
simulation.setMetricsReportInterval(getInt(root.get("metricsReportInterval"), 30));
+ simulation.setSimulationRate(1440);
dateTimeService = new SecondsDateTimeService();
break;
case MINUTES:
@@ -66,12 +67,14 @@ public class SimulationPlanner {
simulation.setMetricsServerConfiguration(createMinutesConfiguration());
simulation.setMetricsReportInterval(getInt(root.get("metricsReportInterval"), 180));
simulation.setDateTimeService(new MinutesDateTimeService());
+ simulation.setSimulationRate(2400);
dateTimeService = new MinutesDateTimeService();
break;
default: // HOURS
simulation.setCollectionInterval(getLong(root.get("collectionInterval"), 30000L));
simulation.setAggregationInterval(3600000L);
simulation.setMetricsReportInterval(getInt(root.get("metricsReportInterval"), 1200));
+ simulation.setSimulationRate(1000);
dateTimeService = new DateTimeService();
}
commit 8393b06c97a9602a2bfed65b75354f2ddb78d3d2
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Tue Oct 1 17:44:41 2013 -0500
Fix for itest failures dues to properties not being correctly set for storage nodes.
diff --git a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/CassandraClusterManager.java b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/CassandraClusterManager.java
index a49d77d..dcecf5e 100644
--- a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/CassandraClusterManager.java
+++ b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/CassandraClusterManager.java
@@ -235,6 +235,7 @@ public class CassandraClusterManager {
private void getStorageClusterConfiguration() {
this.nodes = new String[deploymentOptions.getNumNodes()];
+ this.jmxPorts = new int[deploymentOptions.getNumNodes()];
for (int i = 0; i < deploymentOptions.getNumNodes(); ++i) {
this.nodes[i] = getLocalIPAddress(i + 1);
this.jmxPorts[i] = deploymentOptions.getJmxPort() + i;
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StrippedDownStartupBeanPreparation.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StrippedDownStartupBeanPreparation.java
index 2db60d8..50a57dd 100644
--- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StrippedDownStartupBeanPreparation.java
+++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StrippedDownStartupBeanPreparation.java
@@ -132,12 +132,20 @@ public class StrippedDownStartupBeanPreparation {
}
String cqlPort = System.getProperty("rhq.storage.cql-port");
- String gossipPort = System.getProperty("rhq.storage.gossip-port");
-
entityManager.createNativeQuery("update rhq_system_config set property_value = '" + cqlPort +
"', default_property_value = '" + cqlPort + "' where property_key = 'STORAGE_CQL_PORT'").executeUpdate();
+
+ String gossipPort = System.getProperty("rhq.storage.gossip-port");
entityManager.createNativeQuery("update rhq_system_config set property_value = '" + gossipPort +
"', default_property_value = '" + gossipPort + "' where property_key = 'STORAGE_GOSSIP_PORT'").executeUpdate();
+
+ String storageUserName = System.getProperty("rhq.storage.username");
+ entityManager.createNativeQuery("update rhq_system_config set property_value = '" + storageUserName +
+ "', default_property_value = '" + storageUserName + "' where property_key = 'STORAGE_USERNAME'").executeUpdate();
+
+ String storagePassword = System.getProperty("rhq.storage.password");
+ entityManager.createNativeQuery("update rhq_system_config set property_value = '" + storagePassword +
+ "', default_property_value = '" + storagePassword + "' where property_key = 'STORAGE_PASSWORD'").executeUpdate();
}
@Timeout
commit 3a81b7be6c2a86d41908e3df74d504c6b2133877
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Tue Oct 1 14:35:21 2013 -0700
[BZ 1014292] - Cancelling the confirmation dialog causes that buttons become inactive. The third state of SC.ask -> BooleanCallback(confirm) was not being handled. It can also be null when the close [x] button is hit. A refreshTableInfo was added to properly handle this state.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
index 9aeef30..91f836c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
@@ -595,7 +595,10 @@ public class Table<DS extends RPCDataSource> extends EnhancedHLayout implements
SC.ask(message, new BooleanCallback() {
public void execute(Boolean confirmed) {
- if (confirmed) {
+ if(null == confirmed){
+ refreshTableInfo();
+ }else if (confirmed) {
+ refreshTableInfo();
tableAction.action.executeAction(listGrid.getSelectedRecords(), null);
} else {
refreshTableInfo();
commit a11451c05fdf837b4f67a49d72c61b0c9e71f641
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Oct 1 15:32:47 2013 -0400
Bug 1006594 - use new tree icons for auto-groups and subcategories
work in the new UX provided icons for a clearer tree.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/CustomResourceTreeGrid.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/CustomResourceTreeGrid.java
index d751587..bfad2a4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/CustomResourceTreeGrid.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/CustomResourceTreeGrid.java
@@ -24,8 +24,8 @@ import com.smartgwt.client.widgets.tree.TreeNode;
import org.rhq.core.domain.resource.Resource;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceTreeDatasource.AutoGroupTreeNode;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceTreeDatasource.ResourceTreeNode;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceTreeDatasource.SubCategoryTreeNode;
/**
* @author Greg Hinkle
@@ -52,10 +52,11 @@ public class CustomResourceTreeGrid extends TreeGrid {
return ImageManager.getResourceIcon(resource.getResourceType().getCategory(), resource
.getCurrentAvailability().getAvailabilityType());
}
- } else if (record instanceof SubCategoryTreeNode) {
- return "resources/folder_mixed_" + (open ? "opened" : "closed") + ".png";
+ } else if (record instanceof AutoGroupTreeNode) {
+ return "resources/folder_autogroup_" + (open ? "opened" : "closed") + ".png";
} else {
- return "resources/folder_group_" + (open ? "opened" : "closed") + ".png";
+ // note - subcategory nodes use default folder icons
+ return super.getIcon(record, defaultState);
}
}
return null;
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/resources/folder_autogroup_closed.png b/modules/enterprise/gui/coregui/src/main/webapp/images/resources/folder_autogroup_closed.png
new file mode 100644
index 0000000..d85404d
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/resources/folder_autogroup_closed.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/resources/folder_autogroup_opened.png b/modules/enterprise/gui/coregui/src/main/webapp/images/resources/folder_autogroup_opened.png
new file mode 100644
index 0000000..33856c8
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/resources/folder_autogroup_opened.png differ
commit ad3703f5f88f547d397dc3612647970c8621b238
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Tue Oct 1 18:55:27 2013 +0200
[BZ 958169] - Modified alert definition is not saved on confirming the save message after clicking on 'Back to List' button - overriding the behavior of destroy method of the enhanced layout, because this class needs to get the data from child components before the destroy() is called. This was causing various JavaScript exceptions.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GeneralPropertiesAlertDefinitionForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GeneralPropertiesAlertDefinitionForm.java
index d501787..379e83d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GeneralPropertiesAlertDefinitionForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GeneralPropertiesAlertDefinitionForm.java
@@ -261,5 +261,4 @@ public class GeneralPropertiesAlertDefinitionForm extends DynamicForm implements
public boolean validate() {
return super.validate() && nameField.validate();
}
-
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/SingleAlertDefinitionView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/SingleAlertDefinitionView.java
index e24d1b4..9457e48 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/SingleAlertDefinitionView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/SingleAlertDefinitionView.java
@@ -64,12 +64,23 @@ public class SingleAlertDefinitionView extends EnhancedVLayout {
private TabSet tabSet;
private Tab generalPropertiesTab;
private HandlerRegistration handlerRegistration;
+ private boolean needsCleanup = false;
private boolean isAuthorizedToModifyAlertDefinitions;
public SingleAlertDefinitionView(AbstractAlertDefinitionsView alertDefView) {
this(alertDefView, null);
}
+
+ @Override
+ public void destroy() {
+ if (handlerRegistration == null) { // the leaving dialog has been answered
+ super.destroy();
+ needsCleanup = false;
+ } else {
+ needsCleanup = true;
+ }
+ }
public SingleAlertDefinitionView(final AbstractAlertDefinitionsView alertDefView, AlertDefinition alertDefinition) {
super();
@@ -285,6 +296,7 @@ public class SingleAlertDefinitionView extends EnhancedVLayout {
if (handlerRegistration != null) {
handlerRegistration.removeHandler();
handlerRegistration = null;
+ if (needsCleanup) destroy();
}
}
}
commit 10ebd20b9ec54d734e038f75c4043433d71545a9
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Tue Oct 1 11:13:50 2013 -0500
[BZ 1010265] One more update to align the exception handling with the current storage installer exception and error mechanism. The error handling is now local to where it occurs.
diff --git a/modules/common/cassandra-installer/pom.xml b/modules/common/cassandra-installer/pom.xml
index 46d2035..0524802 100644
--- a/modules/common/cassandra-installer/pom.xml
+++ b/modules/common/cassandra-installer/pom.xml
@@ -123,7 +123,7 @@
<id>dev</id>
<properties>
- <rhq.rootDir>../../../..</rhq.rootDir>
+ <rhq.rootDir>../../..</rhq.rootDir>
<rhq.containerDir>${rhq.rootDir}/${rhq.devContainerServerPath}</rhq.containerDir>
<rhq.deploymentDir>${rhq.containerDir}/modules/org/rhq/rhq-cassandra-installer/main</rhq.deploymentDir>
</properties>
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 29aa8d4..abf57e3 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
@@ -104,6 +104,8 @@ public class StorageInstaller {
public static final int STATUS_GOSSIP_PORT_CONFLICT = 10;
+ public static final int STATUS_UNKNOWN_HOST = 11;
+
private final String STORAGE_BASEDIR = "rhq-storage";
private final Log log = LogFactory.getLog(StorageInstaller.class);
@@ -437,8 +439,12 @@ public class StorageInstaller {
deployer.updateStorageAuthConf(addresses);
return installerInfo;
+ } catch (UnknownHostException unknownHostException) {
+ throw new StorageInstallerException(
+ "Failed to resolve requested binding address. Please check the installation instructions and host DNS settings. Unknown host "
+ + unknownHostException.getMessage(), unknownHostException, STATUS_UNKNOWN_HOST);
} catch (IOException e) {
- throw new StorageInstallerException("The upgrade cannot proceed. An unexpected I/O error occurred", e,
+ throw new StorageInstallerError("The upgrade cannot proceed. An unexpected I/O error occurred", e,
STATUS_IO_ERROR);
} catch (DeploymentException e) {
throw new StorageInstallerException("The installation cannot proceed. An error occurred during storage "
@@ -549,12 +555,17 @@ public class StorageInstaller {
deployer.updateStorageAuthConf(addresses);
return installerInfo;
+
+ } catch (UnknownHostException unknownHostException) {
+ throw new StorageInstallerException(
+ "Failed to resolve requested binding address. Please check the installation instructions and host DNS settings. Unknown host "
+ + unknownHostException.getMessage(), unknownHostException, STATUS_UNKNOWN_HOST);
+ } catch (IOException e) {
+ throw new StorageInstallerError("The upgrade cannot proceed. An unexpected I/O error occurred", e,
+ STATUS_IO_ERROR);
} catch (DeploymentException e) {
throw new StorageInstallerException("THe upgrade cannot proceed. An error occurred during the storage "
+ "node deployment", e, STATUS_DEPLOYMENT_ERROR);
- } catch (IOException e) {
- throw new StorageInstallerException("The upgrade cannot proceed. An unexpected I/O error occurred", e,
- STATUS_IO_ERROR);
}
}
@@ -935,11 +946,6 @@ public class StorageInstaller {
CommandLine cmdLine = parser.parse(installer.getOptions(), args);
int status = installer.run(cmdLine);
System.exit(status);
- } catch (UnknownHostException unknownHostException) {
- installer.log
- .error("Failed to resolve requested binding address. Please check the installation instructions and host DNS settings. "
- + unknownHostException.getMessage());
- throw unknownHostException;
} catch (ParseException parseException) {
installer.printUsage();
System.exit(STATUS_SHOW_USAGE);
commit 1dbbf9c6ec033a5a3732bf142b58b65bccf1a052
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Tue Oct 1 18:11:39 2013 +0200
Deprecating unused DATA_PURGE_* system settings.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/common/composite/SystemSetting.java b/modules/core/domain/src/main/java/org/rhq/core/domain/common/composite/SystemSetting.java
index d19e558..db85e0d 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/common/composite/SystemSetting.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/common/composite/SystemSetting.java
@@ -105,13 +105,16 @@ public enum SystemSetting {
DB_SCHEMA_VERSION("DB_SCHEMA_VERSION", PropertySimpleType.STRING, true, true),
- /** How long do we keep data compressed in hourly intervals? This is not configurable through "normal" means but direct DB update. */
+ /** @deprecated since RHQ 4.8.0. This is not used anymore */
+ @Deprecated
DATA_PURGE_1H_PERIOD("CAM_DATA_PURGE_1H", PropertySimpleType.LONG, true, true),
- /** How long do we keep data compressed in 6 hour intervals? This is not configurable through "normal" means but direct DB update. */
+ /** @deprecated since RHQ 4.8.0. This is not used anymore */
+ @Deprecated
DATA_PURGE_6H_PERIOD("CAM_DATA_PURGE_6H", PropertySimpleType.LONG, true, true),
- /** How long do we keep data compressed in 1 day intervals? This is not configurable through "normal" means but direct DB update. */
+ /** @deprecated since RHQ 4.8.0. This is not used anymore */
+ @Deprecated
DATA_PURGE_1D_PERIOD("CAM_DATA_PURGE_1D", PropertySimpleType.LONG, true, true),
/** The length of CoreGUI inactivity (no call to UserSessionManager.refresh()) before a CoreGUI session timeout, Default: 1 hour */
commit 6309a893b284b0894de40c57de4e0b5fa554e4b3
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Oct 1 12:04:45 2013 -0400
Since rhq-installer.sh|bat moved to bin/internal we can no longer instruct
users to use it for the --encodepassword option. Add new
bin/rhq-encode-password.sh|bat scripts to fix this, providing a more
obvious script for doing the encoding and protecting bin/internal.
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-encode-password.bat b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-encode-password.bat
new file mode 100644
index 0000000..ccd3841
--- /dev/null
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-encode-password.bat
@@ -0,0 +1,4 @@
+@echo off
+set RHQ_SERVER_BIN_DIR_PATH=%~dp0
+%RHQ_SERVER_BIN_DIR_PATH%/internal/rhq-installer --encodepassword
+endlocal
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-encode-password.sh b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-encode-password.sh
new file mode 100644
index 0000000..c4defb7
--- /dev/null
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-encode-password.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+# ----------------------------------------------------------------------
+# Determine what specific platform we are running on.
+# Set some platform-specific variables.
+# ----------------------------------------------------------------------
+
+case "`uname`" in
+ CYGWIN*) _CYGWIN=true
+ ;;
+ Linux*) _LINUX=true
+ ;;
+ Darwin*) _DARWIN=true
+ ;;
+ SunOS*) _SOLARIS=true
+ ;;
+ AIX*) _AIX=true
+ ;;
+esac
+
+# only certain platforms support the -e argument for readlink
+if [ -n "${_LINUX}${_SOLARIS}${_CYGWIN}" ]; then
+ _READLINK_ARG="-e"
+fi
+
+# ----------------------------------------------------------------------
+# Determine the RHQ Server installation directory.
+# If RHQ_SERVER_HOME is not defined, we will assume we are running
+# directly from the server installation's bin/internal directory.
+# ----------------------------------------------------------------------
+
+if [ -z "$RHQ_SERVER_HOME" ]; then
+ _DOLLARZERO=`readlink $_READLINK_ARG "$0" 2>/dev/null || echo "$0"`
+ RHQ_SERVER_HOME=`dirname "$_DOLLARZERO"`/..
+else
+ if [ ! -d "$RHQ_SERVER_HOME" ]; then
+ echo "ERROR! RHQ_SERVER_HOME is not pointing to a valid directory"
+ echo "RHQ_SERVER_HOME: $RHQ_SERVER_HOME"
+ exit 1
+ fi
+fi
+
+$RHQ_SERVER_HOME/bin/internal/rhq-installer.sh --encodepassword
commit 3ab3dd077d3750536da6528df506c88c7435b31b
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Tue Oct 1 18:04:30 2013 +0200
[BZ 1011971] - Deprecate SystemSetting.SERVER_VERSION
We have equivalent, more detailed, always up-to-date and per-server
information available in SystemManagerRemote.getProductInfo().
SERVER_VERSION would not be updated during server upgrades (this is
old behavior present at least as of RHQ 4.4.0).
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/common/composite/SystemSetting.java b/modules/core/domain/src/main/java/org/rhq/core/domain/common/composite/SystemSetting.java
index ef9360c..d19e558 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/common/composite/SystemSetting.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/common/composite/SystemSetting.java
@@ -95,7 +95,14 @@ public enum SystemSetting {
*/
ALLOW_RESOURCE_GENERIC_PROPERTIES_UPGRADE("RESOURCE_GENERIC_PROPERTIES_UPGRADE", PropertySimpleType.BOOLEAN, true, true),
+ /**
+ * @deprecated This attribute is no longer maintained and might not reflect the true version of the running server.
+ * Use {@code SystemManagerRemote.getProductInfo()} method to get at an equivalent and always up-to-date
+ * information.
+ */
+ @Deprecated
SERVER_VERSION("SERVER_VERSION", PropertySimpleType.STRING, true, true),
+
DB_SCHEMA_VERSION("DB_SCHEMA_VERSION", PropertySimpleType.STRING, true, true),
/** How long do we keep data compressed in hourly intervals? This is not configurable through "normal" means but direct DB update. */
commit f6777e901c32704c97b8d55ff5746cdb8984774e
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Oct 1 12:01:59 2013 -0400
fix compiler error
diff --git a/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageProperty.java b/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageProperty.java
index 3b9a5f1..9dca0bc 100644
--- a/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageProperty.java
+++ b/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageProperty.java
@@ -97,7 +97,7 @@ public enum StorageProperty {
throw new Exception("Properties file not found: [" + storagePropertiesFile.getAbsolutePath() + "]");
}
- PropertiesFileUpdate pfu = new PropertiesFileUpdate(storagePropertiesFile);
+ PropertiesFileUpdate pfu = new PropertiesFileUpdate(storagePropertiesFile.getAbsolutePath());
Properties props = pfu.loadExistingProperties();
final HashMap<String, String> map = new HashMap<String, String>(props.size());
for (Object property : props.keySet()) {
commit ae962d743b37fa119dfa800e9b5ad62406bd0abc
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Oct 1 11:07:38 2013 -0400
fix itest failure
diff --git a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/bundle/cassandra/conf/rhq.log4j-server.properties b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/bundle/cassandra/conf/rhq.log4j-server.properties
index fcea1b3..e1c0f5e 100644
--- a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/bundle/cassandra/conf/rhq.log4j-server.properties
+++ b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/bundle/cassandra/conf/rhq.log4j-server.properties
@@ -13,26 +13,33 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+
+# for production, you should probably set pattern to %c instead of %l.
+# (%l is slower.)
+
+# output messages into a rolling log file as well as stdout
+log4j.rootLogger=${rhq.storage.logging.level},stdout,R
+
+# stdout
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%5p %d{HH:mm:ss,SSS} %m%n
+
# rolling log file
-log4j.appender.R = org.apache.log4j.RollingFileAppender
+log4j.appender.R=org.apache.log4j.RollingFileAppender
+log4j.appender.R.maxFileSize=20MB
+log4j.appender.R.maxBackupIndex=50
+log4j.appender.R.layout=org.apache.log4j.PatternLayout
+log4j.appender.R.layout.ConversionPattern=%5p [%t] %d{ISO8601} %F (line %L) %m%n
# Edit the next line to point to your logs directory
-log4j.appender.R.File = ${rhq.storage.log.file}
-log4j.appender.R.Threshold = ${rhq.storage.logging.level}
-log4j.appender.R.layout = org.apache.log4j.PatternLayout
-log4j.appender.R.layout.ConversionPattern = %5p [%t] %d{ISO8601} %F (line %L) %m%n
-log4j.appender.R.maxBackupIndex = 50
-log4j.appender.R.maxFileSize = 20MB
-# stdout
-log4j.appender.stdout = org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern = %5p %d{HH:mm:ss,SSS} %m%n
+log4j.appender.R.File=${rhq.storage.log.file}
+log4j.appender.R.Threshold=${rhq.storage.logging.level}
+
# Application logging options
#log4j.logger.org.apache.cassandra=DEBUG
#log4j.logger.org.apache.cassandra.db=DEBUG
#log4j.logger.org.apache.cassandra.service.StorageProxy=DEBUG
+
# Adding this to avoid thrift logging disconnect errors.
-log4j.logger.org.apache.thrift.server.TNonblockingServer = ERROR
-# for production, you should probably set pattern to %c instead of %l.
-# (%l is slower.)
-# output messages into a rolling log file as well as stdout
-log4j.rootLogger = ${rhq.storage.logging.level},stdout,R
+log4j.logger.org.apache.thrift.server.TNonblockingServer=ERROR
+
commit 9f54a698eff7f8ad3c2dec46f11d9e331560116b
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Oct 1 10:48:52 2013 -0400
rename system properties set in surefire plugin configuration
diff --git a/modules/enterprise/server/server-metrics/pom.xml b/modules/enterprise/server/server-metrics/pom.xml
index 16eacd7..0b4c141 100644
--- a/modules/enterprise/server/server-metrics/pom.xml
+++ b/modules/enterprise/server/server-metrics/pom.xml
@@ -153,9 +153,9 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
- <rhq.cassandra.cluster.skip-shutdown>${skipClusterShutdown}</rhq.cassandra.cluster.skip-shutdown>
- <rhq.cassandra.cluster.dir>${rhq.cassandra.cluster.dir}</rhq.cassandra.cluster.dir>
- <rhq.cassandra.cluster.deploy>${deployCluster}</rhq.cassandra.cluster.deploy>
+ <rhq.storage.cluster.skip-shutdown>${skipClusterShutdown}</rhq.storage.cluster.skip-shutdown>
+ <rhq.storage.cluster.dir>${rhq.storage.cluster.dir}</rhq.storage.cluster.dir>
+ <rhq.storage.cluster.deploy>${deployCluster}</rhq.storage.cluster.deploy>
</systemPropertyVariables>
</configuration>
</plugin>
commit 8704dabea969d60c69961de8eab4b251f7ee0dcd
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Oct 1 09:58:47 2013 -0400
rename class
diff --git a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/MinutesDateTimeService.java b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/MinutesDateTimeService.java
new file mode 100644
index 0000000..f3eba82
--- /dev/null
+++ b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/MinutesDateTimeService.java
@@ -0,0 +1,27 @@
+package org.rhq.metrics.simulator;
+
+import org.joda.time.DateTime;
+import org.joda.time.Duration;
+
+import org.rhq.server.metrics.DateTimeService;
+
+/**
+ * @author John Sanda
+ */
+public class MinutesDateTimeService extends DateTimeService {
+
+ @Override
+ public DateTime getTimeSlice(DateTime dt, Duration duration) {
+ if (duration.equals(configuration.getRawTimeSliceDuration())) {
+ int seconds = ((dt.getMinuteOfHour() * 60) + dt.getSecondOfMinute()) / 150;
+ return dt.hourOfDay().roundFloorCopy().plusSeconds(seconds * 150);
+ } else if (duration.equals(configuration.getOneHourTimeSliceDuration())) {
+ int minutes = dt.minuteOfHour().get() / 15;
+ return dt.hourOfDay().roundFloorCopy().plusMinutes(minutes * 15);
+ } else if (duration.equals(configuration.getSixHourTimeSliceDuration())) {
+ return dt.hourOfDay().roundFloorCopy();
+ } else {
+ throw new IllegalArgumentException("The duration [" + duration + "] is not supported");
+ }
+ }
+}
diff --git a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/SimulatorDateTimeService.java b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/SimulatorDateTimeService.java
deleted file mode 100644
index c62340b..0000000
--- a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/SimulatorDateTimeService.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.rhq.metrics.simulator;
-
-import org.joda.time.DateTime;
-import org.joda.time.Duration;
-
-import org.rhq.server.metrics.DateTimeService;
-
-/**
- * @author John Sanda
- */
-public class SimulatorDateTimeService extends DateTimeService {
-
- @Override
- public DateTime getTimeSlice(DateTime dt, Duration duration) {
- if (duration.equals(configuration.getRawTimeSliceDuration())) {
- int seconds = ((dt.getMinuteOfHour() * 60) + dt.getSecondOfMinute()) / 150;
- return dt.hourOfDay().roundFloorCopy().plusSeconds(seconds * 150);
- } else if (duration.equals(configuration.getOneHourTimeSliceDuration())) {
- int minutes = dt.minuteOfHour().get() / 15;
- return dt.hourOfDay().roundFloorCopy().plusMinutes(minutes * 15);
- } else if (duration.equals(configuration.getSixHourTimeSliceDuration())) {
- return dt.hourOfDay().roundFloorCopy();
- } else {
- throw new IllegalArgumentException("The duration [" + duration + "] is not supported");
- }
- }
-}
diff --git a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/plan/SimulationPlanner.java b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/plan/SimulationPlanner.java
index 79e07da..95871bd 100644
--- a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/plan/SimulationPlanner.java
+++ b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/plan/SimulationPlanner.java
@@ -34,8 +34,8 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import org.joda.time.Minutes;
import org.joda.time.Seconds;
+import org.rhq.metrics.simulator.MinutesDateTimeService;
import org.rhq.metrics.simulator.SecondsDateTimeService;
-import org.rhq.metrics.simulator.SimulatorDateTimeService;
import org.rhq.server.metrics.DateTimeService;
import org.rhq.server.metrics.MetricsConfiguration;
@@ -65,8 +65,8 @@ public class SimulationPlanner {
simulation.setAggregationInterval(getLong(root.get("aggregationInterval"), 150000L));
simulation.setMetricsServerConfiguration(createMinutesConfiguration());
simulation.setMetricsReportInterval(getInt(root.get("metricsReportInterval"), 180));
- simulation.setDateTimeService(new SimulatorDateTimeService());
- dateTimeService = new SimulatorDateTimeService();
+ simulation.setDateTimeService(new MinutesDateTimeService());
+ dateTimeService = new MinutesDateTimeService();
break;
default: // HOURS
simulation.setCollectionInterval(getLong(root.get("collectionInterval"), 30000L));
commit f0f0dfea78cac58164075ff3b77c1972258a4aae
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Oct 1 09:42:43 2013 -0400
support sub-minute intervals
With sub-minute intervals the time slices are,
raw data --> 2.5 sec
1 hr data --> 15 sec
6 hr data --> 1 minute
Aggregation runs every 2.5 seconds. TTLs are set accordingly as well. The reason
for these compressed internvals is so that we can quickly generate a year's
worth of data to make observations about sizes on disk.
diff --git a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/MeasurementCollector.java b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/MeasurementCollector.java
index eeb508e..531ba96 100644
--- a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/MeasurementCollector.java
+++ b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/MeasurementCollector.java
@@ -35,6 +35,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.rhq.core.domain.measurement.MeasurementDataNumeric;
+import org.rhq.server.metrics.DateTimeService;
import org.rhq.server.metrics.MetricsServer;
import org.rhq.server.metrics.RawDataInsertedCallback;
@@ -53,10 +54,10 @@ public class MeasurementCollector implements Runnable {
private Metrics metrics;
- private SimulatorDateTimeService dateTimeService;
+ private DateTimeService dateTimeService;
public MeasurementCollector(int batchSize, int startingScheduleId, Metrics metrics, MetricsServer metricsServer,
- SimulatorDateTimeService dateTimeService) {
+ DateTimeService dateTimeService) {
this.batchSize = batchSize;
this.startingScheduleId = startingScheduleId;
this.metrics = metrics;
diff --git a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/SecondsDateTimeService.java b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/SecondsDateTimeService.java
new file mode 100644
index 0000000..7194079
--- /dev/null
+++ b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/SecondsDateTimeService.java
@@ -0,0 +1,27 @@
+package org.rhq.metrics.simulator;
+
+import org.joda.time.DateTime;
+import org.joda.time.Duration;
+
+import org.rhq.server.metrics.DateTimeService;
+
+/**
+ * @author John Sanda
+ */
+public class SecondsDateTimeService extends DateTimeService {
+
+ @Override
+ public DateTime getTimeSlice(DateTime dt, Duration duration) {
+ if (duration.equals(configuration.getRawTimeSliceDuration())) {
+ int milliseconds = (dt.getSecondOfMinute() * 1000) / 2500;
+ return dt.minuteOfHour().roundFloorCopy().plus(milliseconds * 2500);
+ } else if (duration.equals(configuration.getOneHourTimeSliceDuration())) {
+ int seconds = dt.getSecondOfMinute() / 15;
+ return dt.minuteOfHour().roundFloorCopy().plusSeconds(seconds * 15);
+ } else if (duration.equals(configuration.getSixHourTimeSliceDuration())) {
+ return dt.minuteOfHour().roundFloorCopy();
+ } else {
+ throw new IllegalArgumentException("The duration [" + duration + "] is not supported");
+ }
+ }
+}
diff --git a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/Simulator.java b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/Simulator.java
index 1ec9399..4b250b4 100644
--- a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/Simulator.java
+++ b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/Simulator.java
@@ -79,9 +79,7 @@ public class Simulator implements ShutdownManager {
metricsServer.setDAO(metricsDAO);
metricsServer.setConfiguration(plan.getMetricsServerConfiguration());
- SimulatorDateTimeService dateTimeService = new SimulatorDateTimeService();
- dateTimeService.setConfiguration(plan.getMetricsServerConfiguration());
- metricsServer.setDateTimeService(dateTimeService);
+ metricsServer.setDateTimeService(plan.getDateTimeService());
Metrics metrics = new Metrics();
@@ -92,8 +90,8 @@ public class Simulator implements ShutdownManager {
for (int i = 0; i < plan.getNumMeasurementCollectors(); ++i) {
collectors.scheduleAtFixedRate(new MeasurementCollector(plan.getBatchSize(),
- plan.getBatchSize() * i, metrics, metricsServer, dateTimeService), 0, plan.getCollectionInterval(),
- TimeUnit.MILLISECONDS);
+ plan.getBatchSize() * i, metrics, metricsServer, plan.getDateTimeService()), 0,
+ plan.getCollectionInterval(), TimeUnit.MILLISECONDS);
}
aggregators.scheduleAtFixedRate(measurementAggregator, 0, plan.getAggregationInterval(),
diff --git a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/plan/SimulationPlan.java b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/plan/SimulationPlan.java
index 630c0ca..dfe0695 100644
--- a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/plan/SimulationPlan.java
+++ b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/plan/SimulationPlan.java
@@ -25,6 +25,7 @@
package org.rhq.metrics.simulator.plan;
+import org.rhq.server.metrics.DateTimeService;
import org.rhq.server.metrics.MetricsConfiguration;
/**
@@ -32,6 +33,29 @@ import org.rhq.server.metrics.MetricsConfiguration;
*/
public class SimulationPlan {
+ public static enum IntervalType {
+ SECONDS("seconds"), MINUTES("minutes"), HOURS("hours");
+
+ private final String text;
+
+ IntervalType(String text) {
+ this.text = text;
+ }
+
+ public static IntervalType fromText(String text) {
+ if (text.equals("seconds")) {
+ return SECONDS;
+ }
+ if (text.equals("minutes")) {
+ return MINUTES;
+ }
+ if (text.equals("hours")) {
+ return HOURS;
+ }
+ throw new IllegalArgumentException(text + " is not a valid interval type");
+ }
+ }
+
private long collectionInterval;
private long aggregationInterval;
@@ -50,6 +74,18 @@ public class SimulationPlan {
private int metricsReportInterval;
+ private IntervalType intervalType;
+
+ private DateTimeService dateTimeService;
+
+ public DateTimeService getDateTimeService() {
+ return dateTimeService;
+ }
+
+ public void setDateTimeService(DateTimeService dateTimeService) {
+ this.dateTimeService = dateTimeService;
+ }
+
public long getCollectionInterval() {
return collectionInterval;
}
@@ -121,4 +157,12 @@ public class SimulationPlan {
public void setMetricsReportInterval(int metricsReportInterval) {
this.metricsReportInterval = metricsReportInterval;
}
+
+ public IntervalType getIntervalType() {
+ return intervalType;
+ }
+
+ public void setIntervalType(IntervalType intervalType) {
+ this.intervalType = intervalType;
+ }
}
diff --git a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/plan/SimulationPlanner.java b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/plan/SimulationPlanner.java
index 1674766..79e07da 100644
--- a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/plan/SimulationPlanner.java
+++ b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/plan/SimulationPlanner.java
@@ -34,6 +34,9 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import org.joda.time.Minutes;
import org.joda.time.Seconds;
+import org.rhq.metrics.simulator.SecondsDateTimeService;
+import org.rhq.metrics.simulator.SimulatorDateTimeService;
+import org.rhq.server.metrics.DateTimeService;
import org.rhq.server.metrics.MetricsConfiguration;
/**
@@ -46,12 +49,38 @@ public class SimulationPlanner {
JsonNode root = mapper.readTree(jsonFile);
SimulationPlan simulation = new SimulationPlan();
- simulation.setCollectionInterval(getLong(root.get("collectionInterval"), 1250L));
- simulation.setAggregationInterval(getLong(root.get("aggregationInterval"), 150000L)); // 2.5 minutes
+ simulation.setIntervalType(SimulationPlan.IntervalType.fromText(getString(root.get("intervalType"), "minutes")));
+ DateTimeService dateTimeService;
+
+ switch (simulation.getIntervalType()) {
+ case SECONDS:
+ simulation.setCollectionInterval(getLong(root.get("collectionInterval"), 20L));
+ simulation.setAggregationInterval(getLong(root.get("aggregationInterval"), 2500L));
+ simulation.setMetricsServerConfiguration(createSecondsConfiguration());
+ simulation.setMetricsReportInterval(getInt(root.get("metricsReportInterval"), 30));
+ dateTimeService = new SecondsDateTimeService();
+ break;
+ case MINUTES:
+ simulation.setCollectionInterval(getLong(root.get("collectionInterval"), 1250L));
+ simulation.setAggregationInterval(getLong(root.get("aggregationInterval"), 150000L));
+ simulation.setMetricsServerConfiguration(createMinutesConfiguration());
+ simulation.setMetricsReportInterval(getInt(root.get("metricsReportInterval"), 180));
+ simulation.setDateTimeService(new SimulatorDateTimeService());
+ dateTimeService = new SimulatorDateTimeService();
+ break;
+ default: // HOURS
+ simulation.setCollectionInterval(getLong(root.get("collectionInterval"), 30000L));
+ simulation.setAggregationInterval(3600000L);
+ simulation.setMetricsReportInterval(getInt(root.get("metricsReportInterval"), 1200));
+ dateTimeService = new DateTimeService();
+ }
+
+ dateTimeService.setConfiguration(simulation.getMetricsServerConfiguration());
+ simulation.setDateTimeService(dateTimeService);
+
simulation.setNumMeasurementCollectors(getInt(root.get("numMeasurementCollectors"), 5));
simulation.setSimulationTime(getInt(root.get("simulationTime"), 10));
simulation.setBatchSize(getInt(root.get("batchSize"), 5000));
- simulation.setMetricsReportInterval(getInt(root.get("metricsReportInterval"), 180));
String[] nodes;
if (root.get("nodes") == null || root.get("nodes").size() == 0) {
@@ -67,14 +96,10 @@ public class SimulationPlanner {
simulation.setCqlPort(getInt(root.get("cqlPort"), 9142));
- MetricsConfiguration serverConfiguration = createDefaultMetricsConfiguration();
- simulation.setMetricsServerConfiguration(serverConfiguration);
-
return simulation;
}
- private MetricsConfiguration createDefaultMetricsConfiguration() {
-
+ private MetricsConfiguration createMinutesConfiguration() {
MetricsConfiguration configuration = new MetricsConfiguration();
configuration.setRawTTL(Minutes.minutes(168).toStandardSeconds().getSeconds());
configuration.setRawRetention(Minutes.minutes(168).toStandardDuration());
@@ -94,6 +119,33 @@ public class SimulationPlanner {
return configuration;
}
+ private MetricsConfiguration createSecondsConfiguration() {
+ MetricsConfiguration configuration = new MetricsConfiguration();
+ configuration.setRawTTL(420);
+ configuration.setRawRetention(Seconds.seconds(420).toStandardDuration());
+ configuration.setRawTimeSliceDuration(Seconds.seconds(2).toStandardDuration().plus(500));
+
+ configuration.setOneHourTTL(Seconds.seconds(840).getSeconds());
+ configuration.setOneHourRetention(Seconds.seconds(840));
+ configuration.setOneHourTimeSliceDuration(Seconds.seconds(15).toStandardDuration());
+
+ configuration.setSixHourTTL(Seconds.seconds(1860).getSeconds());
+ configuration.setSixHourRetention(Seconds.seconds(1860));
+ configuration.setSixHourTimeSliceDuration(Seconds.seconds(60).toStandardDuration());
+
+ configuration.setTwentyFourHourTTL(Minutes.minutes(365).toStandardSeconds().getSeconds());
+ configuration.setTwentyFourHourRetention(Minutes.minutes(365));
+
+ return configuration;
+ }
+
+ private String getString(JsonNode node, String defaultValue) {
+ if (node == null) {
+ return defaultValue;
+ }
+ return node.asText();
+ }
+
private long getLong(JsonNode node, long defaultValue) {
if (node == null) {
return defaultValue;
commit 4f2756240bc1e32fad8c5ca94c813af696ef0ce7
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Oct 1 10:45:02 2013 -0400
limit dependencies by using core util only
diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerProperties.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerProperties.java
index 2233cea..b3209f9 100644
--- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerProperties.java
+++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerProperties.java
@@ -26,6 +26,7 @@ import java.util.Properties;
import java.util.Set;
import org.rhq.core.util.PropertiesFileUpdate;
+import org.rhq.core.util.StringUtil;
import org.rhq.core.util.obfuscation.PicketBoxObfuscator;
/**
@@ -268,7 +269,7 @@ public class ServerProperties {
for (String name : ServerProperties.BOOLEAN_PROPERTIES) {
String val = serverProperties.get(name);
- if (ServerInstallUtil.isEmpty(val) && OPTIONAL_PROPERTIES.contains(name)) {
+ if (StringUtil.isBlank(val) && OPTIONAL_PROPERTIES.contains(name)) {
continue;
}
if (!("true".equals(val) || "false".equals(val))) {
@@ -278,7 +279,7 @@ public class ServerProperties {
for (String name : ServerProperties.INTEGER_PROPERTIES) {
String val = serverProperties.get(name);
- if (ServerInstallUtil.isEmpty(val) && OPTIONAL_PROPERTIES.contains(name)) {
+ if (StringUtil.isBlank(val) && OPTIONAL_PROPERTIES.contains(name)) {
continue;
}
try {
@@ -295,7 +296,7 @@ public class ServerProperties {
}
for (String name : requiredStringProperties) {
String val = serverProperties.get(name);
- if (ServerInstallUtil.isEmpty(val)) {
+ if (StringUtil.isBlank(val)) {
dataErrors.append("[" + name + "] must exist and be set to a valid string value\n");
} else if (ServerProperties.OBFUSCATED_PROPERTIES.contains(name)) {
commit 331cc77b2ffb65320c5731d22d00147fb522cfb4
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Oct 1 10:44:35 2013 -0400
fix typo
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementAggregate.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementAggregate.java
index 7acc5f6..6f2bb6f 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementAggregate.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementAggregate.java
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-package org.rhq.enterprise.server.measurement;;
+package org.rhq.enterprise.server.measurement;
import java.io.Serializable;
commit aafabc790c03be5b038171fa3e27c5664aab0637
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Oct 1 09:47:19 2013 -0400
Bug 1002778 - Installer to prompt user for rhqadmin password, rather than using hard-coded default
Perform more up front validation of rhq-server.properties and rhq-storage.properties
when executing 'rhqctl install' in order to prevent doomed installation
attempts.
Moreover, add the ability to prompt for certain required settings. If not
set in the rhq-server.properties file rhqctl will now prompt for the
jboss.bind.address setting and the rhq.server.database.password setting. The
latter accepts plain text and will encode the value automatically prior to
updating rhq-server.properties.
- moved validation logic into ServerProperties and improved
- similar to ServerProperties, created StorageProperty (enum) with
built-in validation logic.
- decrease logging sensitivity to INFO for rhqctl and the server installer
- try to clean up what rhqctl spits out to the console
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 30a51a4..29aa8d4 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
@@ -106,19 +106,6 @@ public class StorageInstaller {
private final String STORAGE_BASEDIR = "rhq-storage";
- private static final String OPTION_HOSTNAME = "rhq.storage.hostname";
- private static final String OPTION_SEEDS = "rhq.storage.seeds";
- private static final String OPTION_CQL_PORT = "rhq.storage.cql-port";
- private static final String OPTION_JMX_PORT = "rhq.storage.jmx-port";
- private static final String OPTION_GOSSIP_PORT = "rhq.storage.gossip-port";
- private static final String OPTION_COMMITLOG = "rhq.storage.commitlog";
- private static final String OPTION_DATA = "rhq.storage.data";
- private static final String OPTION_SAVED_CACHES = "rhq.storage.saved-caches";
- private static final String OPTION_HEAP_SIZE = "rhq.storage.heap-size";
- private static final String OPTION_HEAP_NEW_SIZE = "rhq.storage.heap-new-size";
- private static final String OPTION_STACK_SIZE = "rhq.storage.stack-size";
- private static final String OPTION_VERIFY_DATA_DIRS_EMPTY = "rhq.storage.verify-data-dirs-empty";
-
private final Log log = LogFactory.getLog(StorageInstaller.class);
private Options options;
@@ -147,26 +134,27 @@ public class StorageInstaller {
storageBasedir = new File(basedir, STORAGE_BASEDIR);
logDir = new File(serverBasedir, "logs");
- Option hostname = new Option("n", OPTION_HOSTNAME, true,
+ Option hostname = new Option("n", StorageProperty.HOSTNAME.property(), true,
"The hostname or IP address on which the node will listen for "
+ "requests. Note that if a hostname is specified, the IP address is used. Defaults to the IP "
+ "address of the local host (which depending on hostname configuration may not be localhost).");
hostname.setArgName("HOSTNAME");
- Option seeds = new Option("s", OPTION_SEEDS, true, "A comma-delimited list of hostnames or IP addresses that "
- + "serve as contact points. Nodes use this list to find each other and to learn the cluster topology. "
- + "It does not need to specify all nodes in the cluster. Defaults to this node's hostname.");
+ Option seeds = new Option("s", StorageProperty.SEEDS.property(), true,
+ "A comma-delimited list of hostnames or IP addresses that "
+ + "serve as contact points. Nodes use this list to find each other and to learn the cluster topology. "
+ + "It does not need to specify all nodes in the cluster. Defaults to this node's hostname.");
seeds.setArgName("SEEDS");
- Option jmxPortOption = new Option("j", OPTION_JMX_PORT, true,
+ Option jmxPortOption = new Option("j", StorageProperty.JMX_PORT.property(), true,
"The port on which to listen for JMX connections. " + "Defaults to " + defaultJmxPort + ".");
jmxPortOption.setArgName("PORT");
- Option cqlPortOption = new Option("c", OPTION_CQL_PORT, true, "The port on which to "
+ Option cqlPortOption = new Option("c", StorageProperty.CQL_PORT.property(), true, "The port on which to "
+ "listen for client requests. Defaults to " + defaultCqlPort);
cqlPortOption.setArgName("PORT");
- Option gossipPortOption = new Option(null, OPTION_GOSSIP_PORT, true,
+ Option gossipPortOption = new Option(null, StorageProperty.GOSSIP_PORT.property(), true,
"The port on which to listen for requests " + " from other nodes. Defaults to " + defaultGossipPort);
gossipPortOption.setArgName("PORT");
@@ -178,15 +166,16 @@ public class StorageInstaller {
+ "after starting it. This option is ignored if the start option is not set. Defaults to true.");
checkStatus.setArgName("true|false");
- Option commitLogOption = new Option(null, OPTION_COMMITLOG, true, "The directory where the storage node keeps "
- + "commit log files. Defaults to " + getDefaultCommitLogDir() + ".");
+ Option commitLogOption = new Option(null, StorageProperty.COMMITLOG.property(), true,
+ "The directory where the storage node keeps " + "commit log files. Defaults to " + getDefaultCommitLogDir()
+ + ".");
commitLogOption.setArgName("DIR");
- Option dataDirOption = new Option(null, OPTION_DATA, true,
+ Option dataDirOption = new Option(null, StorageProperty.DATA.property(), true,
"The directory where the storage node keeps data files. " + "Defaults to " + getDefaultDataDir() + ".");
dataDirOption.setArgName("DIR");
- Option savedCachesDirOption = new Option(null, OPTION_SAVED_CACHES, true,
+ Option savedCachesDirOption = new Option(null, StorageProperty.SAVED_CACHES.property(), true,
"The directory where the storage node " + "keeps saved cache files. Defaults to "
+ getDefaultSavedCachesDir() + ".");
savedCachesDirOption.setArgName("DIR");
@@ -194,17 +183,17 @@ 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, OPTION_HEAP_SIZE, true,
+ Option heapSizeOption = new Option(null, StorageProperty.HEAP_SIZE.property(), 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. Defaults to "
+ defaultHeapSize);
- Option heapNewSizeOption = new Option(null, OPTION_HEAP_NEW_SIZE, true,
+ Option heapNewSizeOption = new Option(null, StorageProperty.HEAP_NEW_SIZE.property(), 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. Defaults to "
+ defaultHeapNewSize);
- Option stackSizeOption = new Option(null, OPTION_STACK_SIZE, true,
+ Option stackSizeOption = new Option(null, StorageProperty.STACK_SIZE.property(), true,
"The value to use for the thread stack size. "
+ "This value is passed directly to the -Xss option of the Java executable.");
@@ -212,7 +201,7 @@ public class StorageInstaller {
+ "where the existing RHQ server is installed.");
upgradeOption.setArgName("RHQ_SERVER_DIR");
- Option verifyDataDirsEmptyOption = new Option(null, OPTION_VERIFY_DATA_DIRS_EMPTY, true,
+ Option verifyDataDirsEmptyOption = new Option(null, StorageProperty.VERIFY_DATA_DIRS_EMPTY.property(), true,
"Will cause the installer " + "to abort if any of the data directories is not empty. Defaults to true.");
options = new Options().addOption(new Option("h", "help", false, "Show this message.")).addOption(hostname)
@@ -250,8 +239,8 @@ public class StorageInstaller {
log.info("Updating rhq-server.properties...");
Properties properties = new Properties();
properties.setProperty("rhq.storage.nodes", installerInfo.hostname);
- properties.setProperty(OPTION_CQL_PORT, Integer.toString(installerInfo.cqlPort));
- properties.setProperty(OPTION_GOSSIP_PORT, Integer.toString(installerInfo.gossipPort));
+ properties.setProperty(StorageProperty.CQL_PORT.property(), Integer.toString(installerInfo.cqlPort));
+ properties.setProperty(StorageProperty.GOSSIP_PORT.property(), Integer.toString(installerInfo.gossipPort));
serverPropertiesUpdater.update(properties);
@@ -335,21 +324,23 @@ public class StorageInstaller {
deploymentOptions.setListenAddress(installerInfo.hostname);
deploymentOptions.setRpcAddress(installerInfo.hostname);
- String seeds = cmdLine.getOptionValue(OPTION_SEEDS, installerInfo.hostname);
+ String seeds = cmdLine.getOptionValue(StorageProperty.SEEDS.property(), installerInfo.hostname);
deploymentOptions.setSeeds(seeds);
- String commitlogDir = cmdLine.getOptionValue(OPTION_COMMITLOG, getDefaultCommitLogDir().getAbsolutePath());
- String dataDir = cmdLine.getOptionValue(OPTION_DATA, getDefaultDataDir().getAbsolutePath());
- String savedCachesDir = cmdLine.getOptionValue(OPTION_SAVED_CACHES, getDefaultSavedCachesDir()
+ String commitlogDir = cmdLine.getOptionValue(StorageProperty.COMMITLOG.property(), getDefaultCommitLogDir()
+ .getAbsolutePath());
+ String dataDir = cmdLine.getOptionValue(StorageProperty.DATA.property(), getDefaultDataDir()
.getAbsolutePath());
+ String savedCachesDir = cmdLine.getOptionValue(StorageProperty.SAVED_CACHES.property(),
+ getDefaultSavedCachesDir().getAbsolutePath());
File commitLogDirFile = new File(commitlogDir);
File dataDirFile = new File(dataDir);
File savedCachesDirFile = new File(savedCachesDir);
installerInfo.logFile = new File(logDir, "rhq-storage.log");
- boolean verifyDataDirsEmpty = Boolean
- .valueOf(cmdLine.getOptionValue(OPTION_VERIFY_DATA_DIRS_EMPTY, "true"));
+ boolean verifyDataDirsEmpty = Boolean.valueOf(cmdLine.getOptionValue(
+ StorageProperty.VERIFY_DATA_DIRS_EMPTY.property(), "true"));
if (verifyDataDirsEmpty) {
// validate the three data directories are empty - if they are not, we are probably stepping on
// another storage node
@@ -373,20 +364,20 @@ public class StorageInstaller {
}
}
- installerInfo.jmxPort = getPort(cmdLine, OPTION_JMX_PORT, defaultJmxPort);
+ installerInfo.jmxPort = getPort(cmdLine, StorageProperty.JMX_PORT.property(), defaultJmxPort);
if (isPortBound(installerInfo.hostname, installerInfo.jmxPort, "jmx-port")) {
throw new StorageInstallerException("The jmx-port (" + installerInfo.jmxPort + ") is already in use. "
+ "Installation cannot proceed.", STATUS_JMX_PORT_CONFLICT);
}
- installerInfo.cqlPort = getPort(cmdLine, OPTION_CQL_PORT, defaultCqlPort);
- if (isPortBound(installerInfo.hostname, installerInfo.cqlPort, OPTION_CQL_PORT)) {
+ installerInfo.cqlPort = getPort(cmdLine, StorageProperty.CQL_PORT.property(), defaultCqlPort);
+ if (isPortBound(installerInfo.hostname, installerInfo.cqlPort, StorageProperty.CQL_PORT.property())) {
throw new StorageInstallerException("The cql-port (" + installerInfo.cqlPort + ") is already in use. "
+ "Installation cannot proceed.", STATUS_CQL_PORT_CONFLICT);
}
- installerInfo.gossipPort = getPort(cmdLine, OPTION_GOSSIP_PORT, defaultGossipPort);
- if (isPortBound(installerInfo.hostname, installerInfo.gossipPort, OPTION_GOSSIP_PORT)) {
+ installerInfo.gossipPort = getPort(cmdLine, StorageProperty.GOSSIP_PORT.property(), defaultGossipPort);
+ if (isPortBound(installerInfo.hostname, installerInfo.gossipPort, StorageProperty.GOSSIP_PORT.property())) {
throw new StorageInstallerException("The gossip-port (" + installerInfo.gossipPort
+ ") is already in use. " + "Installation cannot proceed.", STATUS_GOSSIP_PORT_CONFLICT);
}
@@ -404,10 +395,12 @@ public class StorageInstaller {
deploymentOptions.setGossipPort(installerInfo.gossipPort);
deploymentOptions.setJmxPort(installerInfo.jmxPort);
- deploymentOptions.setHeapSize(cmdLine.getOptionValue(OPTION_HEAP_SIZE, defaultHeapSize));
- deploymentOptions.setHeapNewSize(cmdLine.getOptionValue(OPTION_HEAP_NEW_SIZE, defaultHeapNewSize));
- if (cmdLine.hasOption(OPTION_STACK_SIZE)) {
- deploymentOptions.setStackSize(cmdLine.getOptionValue(OPTION_STACK_SIZE));
+ deploymentOptions
+ .setHeapSize(cmdLine.getOptionValue(StorageProperty.HEAP_SIZE.property(), defaultHeapSize));
+ deploymentOptions.setHeapNewSize(cmdLine.getOptionValue(StorageProperty.HEAP_NEW_SIZE.property(),
+ defaultHeapNewSize));
+ if (cmdLine.hasOption(StorageProperty.STACK_SIZE.property())) {
+ deploymentOptions.setStackSize(cmdLine.getOptionValue(StorageProperty.STACK_SIZE.property()));
}
// The out of box default for native_transport_max_threads is 128. We default
@@ -417,9 +410,9 @@ public class StorageInstaller {
deploymentOptions.load();
List<String> errors = new ArrayList<String>();
- checkPerms(options.getOption(OPTION_SAVED_CACHES), savedCachesDir, errors);
- checkPerms(options.getOption(OPTION_COMMITLOG), commitlogDir, errors);
- checkPerms(options.getOption(OPTION_DATA), dataDir, errors);
+ checkPerms(options.getOption(StorageProperty.SAVED_CACHES.property()), savedCachesDir, errors);
+ checkPerms(options.getOption(StorageProperty.COMMITLOG.property()), commitlogDir, errors);
+ checkPerms(options.getOption(StorageProperty.DATA.property()), dataDir, errors);
if (!errors.isEmpty()) {
log.error("Problems have been detected with one or more of the directories in which the storage "
@@ -913,7 +906,7 @@ public class StorageInstaller {
public Options getHelpOptions() {
Options helpOptions = new Options();
for (Option option : (Collection<Option>) options.getOptions()) {
- if (option.getLongOpt().equals(OPTION_VERIFY_DATA_DIRS_EMPTY)) {
+ if (option.getLongOpt().equals(StorageProperty.VERIFY_DATA_DIRS_EMPTY)) {
continue;
}
helpOptions.addOption(option);
diff --git a/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageProperty.java b/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageProperty.java
new file mode 100644
index 0000000..3b9a5f1
--- /dev/null
+++ b/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageProperty.java
@@ -0,0 +1,181 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2013 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.storage.installer;
+
+import java.io.File;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import org.rhq.core.util.PropertiesFileUpdate;
+
+public enum StorageProperty {
+ HOSTNAME("rhq.storage.hostname"), //
+ SEEDS("rhq.storage.seeds"), //
+ CQL_PORT("rhq.storage.cql-port"), //
+ JMX_PORT("rhq.storage.jmx-port"), //
+ GOSSIP_PORT("rhq.storage.gossip-port"), //
+ COMMITLOG("rhq.storage.commitlog"), //
+ DATA("rhq.storage.data"), //
+ SAVED_CACHES("rhq.storage.saved-caches"), //
+ HEAP_SIZE("rhq.storage.heap-size"), //
+ HEAP_NEW_SIZE("rhq.storage.heap-new-size"), //
+ STACK_SIZE("rhq.storage.stack-size"), //
+ VERIFY_DATA_DIRS_EMPTY("rhq.storage.verify-data-dirs-empty");
+
+ private static final HashSet<StorageProperty> STRINGS = new HashSet<StorageProperty>();
+ static {
+ // currently no required string properties
+ }
+
+ private static final HashSet<StorageProperty> INTEGERS = new HashSet<StorageProperty>();
+ static {
+ INTEGERS.add(CQL_PORT);
+ INTEGERS.add(JMX_PORT);
+ INTEGERS.add(GOSSIP_PORT);
+ }
+
+ private static final HashSet<StorageProperty> BOOLEANS = new HashSet<StorageProperty>();
+ static {
+ BOOLEANS.add(VERIFY_DATA_DIRS_EMPTY);
+ }
+
+ // validate optional non-string properties, if set
+ private static final HashSet<StorageProperty> OPTIONAL = new HashSet<StorageProperty>();
+ static {
+ OPTIONAL.add(CQL_PORT);
+ OPTIONAL.add(JMX_PORT);
+ OPTIONAL.add(GOSSIP_PORT);
+ OPTIONAL.add(VERIFY_DATA_DIRS_EMPTY);
+ }
+
+ private String property;
+
+ StorageProperty(String property) {
+ this.property = property;
+ }
+
+ public String property() {
+ return this.property;
+ }
+
+ @Override
+ public String toString() {
+ return this.property;
+ }
+
+ public static void validate(File storagePropertiesFile) throws Exception {
+ validate(storagePropertiesFile, null);
+ }
+
+ /**
+ * @param storagePropertiesFile
+ * @param additionalProperties additional properties that should be set (present and not empty). can be null.
+ * @throws Exception
+ */
+ public static void validate(File storagePropertiesFile, Set<StorageProperty> additionalProperties) throws Exception {
+ if (!storagePropertiesFile.isFile()) {
+ throw new Exception("Properties file not found: [" + storagePropertiesFile.getAbsolutePath() + "]");
+ }
+
+ PropertiesFileUpdate pfu = new PropertiesFileUpdate(storagePropertiesFile);
+ Properties props = pfu.loadExistingProperties();
+ final HashMap<String, String> map = new HashMap<String, String>(props.size());
+ for (Object property : props.keySet()) {
+ map.put(property.toString(), props.getProperty(property.toString()));
+ }
+
+ validate(map, additionalProperties);
+ }
+
+ public static void validate(Map<String, String> storageProperties) throws Exception {
+ validate(storageProperties, null);
+ }
+
+ /**
+ * @param storageProperties
+ * @param additionalProperties additional properties that should be set (present and not empty). can be null.
+ * @throws Exception
+ */
+ public static void validate(Map<String, String> storageProperties, Set<StorageProperty> additionalProperties)
+ throws Exception {
+ final StringBuilder dataErrors = new StringBuilder();
+
+ for (StorageProperty storageProperty : BOOLEANS) {
+ String val = storageProperties.get(storageProperty.property());
+ if (isEmpty(val) && OPTIONAL.contains(storageProperty)) {
+ continue;
+ }
+ if (!("true".equals(val) || "false".equals(val))) {
+ dataErrors
+ .append("[" + storageProperty + "] must exist and be set 'true' or 'false' : [" + val + "]\n");
+ }
+ }
+
+ for (StorageProperty storageProperty : StorageProperty.INTEGERS) {
+ String val = storageProperties.get(storageProperty.property);
+ if (isEmpty(val) && OPTIONAL.contains(storageProperty)) {
+ continue;
+ }
+ try {
+ Integer.parseInt(val);
+ } catch (NumberFormatException e) {
+ dataErrors.append("[" + storageProperty + "] must exist and be set to a number : [" + val + "]\n");
+ }
+ }
+
+ Set<StorageProperty> requiredStringProperties = new HashSet<StorageProperty>();
+ requiredStringProperties.addAll(STRINGS);
+ if (null != additionalProperties) {
+ requiredStringProperties.addAll(additionalProperties);
+ }
+ for (StorageProperty storageProperty : requiredStringProperties) {
+ String val = storageProperties.get(storageProperty.property);
+ if (isEmpty(val)) {
+ dataErrors.append("[" + storageProperty + "] must exist and be set to a valid string value\n");
+ }
+ }
+
+ for (String property : storageProperties.keySet()) {
+ boolean unknown = true;
+ for (StorageProperty storageProperty : EnumSet.allOf(StorageProperty.class)) {
+ if (storageProperty.property.equals(property)) {
+ unknown = false;
+ break;
+ }
+ }
+ if (unknown) {
+ dataErrors.append("[" + property
+ + "] property found in file but not recognized. Please fix or remove.\n");
+ }
+ }
+
+ if (dataErrors.length() > 0) {
+ throw new Exception("Validation errors:\n" + dataErrors.toString());
+ }
+ }
+
+ private static boolean isEmpty(String s) {
+ return s == null || s.trim().length() == 0;
+ }
+
+}
diff --git a/modules/core/util/src/main/java/org/rhq/core/util/PropertiesFileUpdate.java b/modules/core/util/src/main/java/org/rhq/core/util/PropertiesFileUpdate.java
index d419770..306d5d9 100644
--- a/modules/core/util/src/main/java/org/rhq/core/util/PropertiesFileUpdate.java
+++ b/modules/core/util/src/main/java/org/rhq/core/util/PropertiesFileUpdate.java
@@ -63,6 +63,15 @@ public class PropertiesFileUpdate {
}
/**
+ * Constructor given the .properties file.
+ *
+ * @param the properties file
+ */
+ public PropertiesFileUpdate(File file) {
+ this.file = file;
+ }
+
+ /**
* Updates the properties file so it will contain the key with the value. If value is <code>null</code>, an empty
* string will be used in the properties file. If the property does not yet exist in the properties file, it will be
* appended to the end of the file.
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 445f41e..6f9ccfe 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
@@ -23,10 +23,12 @@ import java.io.IOException;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Random;
+import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -130,7 +132,7 @@ public class InstallerServiceImpl implements InstallerService {
HashMap<String, String> serverProperties = preInstall();
// make sure the data is valid
- verifyDataFormats(serverProperties);
+ ServerProperties.validate(serverProperties);
// checks to make sure we can connect to the DB
final String dbUrl = serverProperties.get(ServerProperties.PROP_DATABASE_CONNECTION_URL);
@@ -294,6 +296,13 @@ public class InstallerServiceImpl implements InstallerService {
serverProperties.put(ServerProperties.PROP_STORAGE_PASSWORD, encodedStoragePassword);
}
+ // After manipulating the server props, sanity check them
+ Set<String> additionalProperties = new HashSet<String>();
+ additionalProperties.add(ServerProperties.PROP_MGMT_USER_PASSWORD);
+ additionalProperties.add(ServerProperties.PROP_STORAGE_USERNAME);
+ additionalProperties.add(ServerProperties.PROP_STORAGE_PASSWORD);
+ ServerProperties.validate(serverProperties, additionalProperties);
+
prepareDatabase(serverProperties, serverDetails, existingSchemaOption);
// perform stuff that has to get done via the JBossAS management client
@@ -354,9 +363,6 @@ public class InstallerServiceImpl implements InstallerService {
public void prepareDatabase(HashMap<String, String> serverProperties, ServerDetails serverDetails,
String existingSchemaOption) throws Exception {
- // since we are going to write out the properties file, we need to make sure the properties are valid
- verifyDataFormats(serverProperties);
-
// if we are in auto-install mode, ignore the server details passed in and build our own using the given server properties
// if not in auto-install mode, make sure user gave us the server details that we will need
final boolean autoInstallMode = ServerInstallUtil.isAutoinstallEnabled(serverProperties);
@@ -653,45 +659,6 @@ public class InstallerServiceImpl implements InstallerService {
}
/**
- * Makes sure the data is at least in the correct format (booleans are true/false, integers are valid numbers).
- *
- * @param serverProperties the server properties to check for correctness
- *
- * @throws Exception if the data was invalid
- */
- private void verifyDataFormats(HashMap<String, String> serverProperties) throws Exception {
- final StringBuilder dataErrors = new StringBuilder();
- for (Map.Entry<String, String> entry : serverProperties.entrySet()) {
- final String name = entry.getKey();
- if (ServerProperties.BOOLEAN_PROPERTIES.contains(name)) {
- final String newValue = entry.getValue();
- if (!(newValue.equals("true") || newValue.equals("false"))) {
- dataErrors.append("[" + name + "] must be 'true' or 'false' : [" + newValue + "]\n");
- }
- } else if (ServerProperties.INTEGER_PROPERTIES.contains(name)) {
- final String newValue = entry.getValue();
- try {
- Integer.parseInt(newValue);
- } catch (NumberFormatException e) {
- if (ServerInstallUtil.isEmpty(newValue) && name.equals(ServerProperties.PROP_CONNECTOR_BIND_PORT)) {
- // this is a special setting and is allowed to be empty
- } else {
- dataErrors.append("[" + name + "] must be a number : [" + newValue + "]\n");
- }
- }
- } else if (ServerProperties.STRING_PROPERTIES.contains(name)) {
- final String newValue = entry.getValue();
- if (ServerInstallUtil.isEmpty(newValue)) {
- dataErrors.append("[" + name + "] must be set to a valid string value\n");
- }
- }
- }
- if (dataErrors.length() > 0) {
- throw new Exception("Cannot install due to data errors:\n" + dataErrors.toString());
- }
- }
-
- /**
* Save the given properties to the server's .properties file.
*
* Note that this is private - it is not exposed to the installer UI. It should have no need to save
@@ -701,6 +668,8 @@ public class InstallerServiceImpl implements InstallerService {
* @throws Exception if failed to save the properties to the .properties file
*/
private void saveServerProperties(HashMap<String, String> serverProperties) throws Exception {
+ ServerProperties.validate(serverProperties);
+
final File serverPropertiesFile = getServerPropertiesFile();
final PropertiesFileUpdate propsFile = new PropertiesFileUpdate(serverPropertiesFile.getAbsolutePath());
diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerProperties.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerProperties.java
index 6ac264d..2233cea 100644
--- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerProperties.java
+++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerProperties.java
@@ -18,9 +18,16 @@
*/
package org.rhq.enterprise.server.installer;
+import java.io.File;
+import java.util.HashMap;
import java.util.HashSet;
+import java.util.Map;
+import java.util.Properties;
import java.util.Set;
+import org.rhq.core.util.PropertiesFileUpdate;
+import org.rhq.core.util.obfuscation.PicketBoxObfuscator;
+
/**
* Settings found in the rhq-server.properties file that controls the startup configuration of the server.
*
@@ -125,24 +132,20 @@ public class ServerProperties {
public static final String PROP_STORAGE_GOSSIP_PORT = "rhq.storage.gossip-port";
// this list contains all the properties that are to have boolean values (true | false)
- public static final Set<String> BOOLEAN_PROPERTIES;
+ private static final Set<String> BOOLEAN_PROPERTIES;
static {
BOOLEAN_PROPERTIES = new HashSet<String>();
- BOOLEAN_PROPERTIES.add(PROP_SECURITY_CLIENT_SERVER_AUTH_MODE_ENABLED);
- BOOLEAN_PROPERTIES.add(PROP_MM_AT_START);
- BOOLEAN_PROPERTIES.add(PROP_AUTOINSTALL_ENABLE);
BOOLEAN_PROPERTIES.add(PROP_AGENT_MULTICAST_DETECTOR_ENABLED);
+ BOOLEAN_PROPERTIES.add(PROP_AUTOINSTALL_ENABLE);
+ BOOLEAN_PROPERTIES.add(PROP_MM_AT_START);
+ BOOLEAN_PROPERTIES.add(PROP_SECURITY_CLIENT_SERVER_AUTH_MODE_ENABLED);
}
// this list contains all the properties that are to have integer values
- public static final Set<String> INTEGER_PROPERTIES;
+ private static final Set<String> INTEGER_PROPERTIES;
static {
INTEGER_PROPERTIES = new HashSet<String>();
- INTEGER_PROPERTIES.add(PROP_WEB_HTTP_PORT);
- INTEGER_PROPERTIES.add(PROP_WEB_HTTPS_PORT);
- INTEGER_PROPERTIES.add(PROP_CONNECTOR_BIND_PORT);
- INTEGER_PROPERTIES.add(PROP_EMAIL_SMTP_PORT);
- INTEGER_PROPERTIES.add(PROP_OPERATION_TIMEOUT);
+ INTEGER_PROPERTIES.add(PROP_AGENT_MULTICAST_DETECTOR_PORT);
INTEGER_PROPERTIES.add(PROP_CONCURRENCY_LIMIT_AVAIL_REPORT);
INTEGER_PROPERTIES.add(PROP_CONCURRENCY_LIMIT_CONTENT_DOWNLOAD);
INTEGER_PROPERTIES.add(PROP_CONCURRENCY_LIMIT_CONTENT_REPORT);
@@ -152,16 +155,50 @@ public class ServerProperties {
INTEGER_PROPERTIES.add(PROP_CONCURRENCY_LIMIT_MEAS_REPORT);
INTEGER_PROPERTIES.add(PROP_CONCURRENCY_LIMIT_MEASSCHED_REQ);
INTEGER_PROPERTIES.add(PROP_CONCURRENCY_LIMIT_WEBCONNS);
- INTEGER_PROPERTIES.add(PROP_AGENT_MULTICAST_DETECTOR_PORT);
+ INTEGER_PROPERTIES.add(PROP_CONNECTOR_BIND_PORT);
+ INTEGER_PROPERTIES.add(PROP_DATABASE_PORT);
+ INTEGER_PROPERTIES.add(PROP_EMAIL_SMTP_PORT);
+ INTEGER_PROPERTIES.add(PROP_OPERATION_TIMEOUT);
INTEGER_PROPERTIES.add(PROP_STORAGE_CQL_PORT);
INTEGER_PROPERTIES.add(PROP_STORAGE_GOSSIP_PORT);
+ INTEGER_PROPERTIES.add(PROP_WEB_HTTP_PORT);
+ INTEGER_PROPERTIES.add(PROP_WEB_HTTPS_PORT);
}
// this list contains all the properties that are to have non-empty string values
- public static final Set<String> STRING_PROPERTIES;
+ private static final Set<String> STRING_PROPERTIES;
static {
STRING_PROPERTIES = new HashSet<String>();
+ STRING_PROPERTIES.add(PROP_AUTOINSTALL_DATABASE);
+ STRING_PROPERTIES.add(PROP_DATABASE_TYPE);
+ STRING_PROPERTIES.add(PROP_DATABASE_CONNECTION_URL);
+ STRING_PROPERTIES.add(PROP_DATABASE_PASSWORD);
+ STRING_PROPERTIES.add(PROP_DATABASE_USERNAME);
+ STRING_PROPERTIES.add(PROP_DATABASE_SERVER_NAME);
+ STRING_PROPERTIES.add(PROP_DATABASE_DB_NAME);
+ STRING_PROPERTIES.add(PROP_DATABASE_HIBERNATE_DIALECT);
+ STRING_PROPERTIES.add(PROP_EMAIL_FROM_ADDRESS);
+ STRING_PROPERTIES.add(PROP_EMAIL_SMTP_HOST);
STRING_PROPERTIES.add(PROP_JBOSS_BIND_ADDRESS);
+ STRING_PROPERTIES.add(PROP_QUARTZ_DRIVER_DELEGATE_CLASS);
+ STRING_PROPERTIES.add(PROP_QUARTZ_LOCK_HANDLER_CLASS);
+ STRING_PROPERTIES.add(PROP_QUARTZ_SELECT_WITH_LOCK_SQL);
+ }
+
+ // this list contains all the STRING properties that are to have obfuscated values
+ private static final Set<String> OBFUSCATED_PROPERTIES;
+ static {
+ OBFUSCATED_PROPERTIES = new HashSet<String>();
+ OBFUSCATED_PROPERTIES.add(PROP_DATABASE_PASSWORD);
+ OBFUSCATED_PROPERTIES.add(PROP_MGMT_USER_PASSWORD);
+ OBFUSCATED_PROPERTIES.add(PROP_STORAGE_PASSWORD);
+ }
+
+ // this list contains all the non-STRING properties that can be unset when verified
+ private static final Set<String> OPTIONAL_PROPERTIES;
+ static {
+ OPTIONAL_PROPERTIES = new HashSet<String>();
+ OPTIONAL_PROPERTIES.add(PROP_CONNECTOR_BIND_PORT);
}
public static final Set<String> CLIENT_AUTH_MODES;
@@ -191,4 +228,91 @@ public class ServerProperties {
IBM_ALGOROTHM_SETTINGS.add(PROP_SECURITY_CLIENT_KEYSTORE_ALGORITHM);
IBM_ALGOROTHM_SETTINGS.add(PROP_SECURITY_CLIENT_TRUSTSTORE_ALGORITHM);
}
-}
\ No newline at end of file
+
+ public static void validate(File serverPropertiesFile) throws Exception {
+ validate(serverPropertiesFile, null);
+ }
+
+ /**
+ * @param serverPropertiesFile
+ * @param additionalProperties additional properties that should be set (present and not empty). can be null.
+ * @throws Exception
+ */
+ public static void validate(File serverPropertiesFile, Set<String> additionalProperties) throws Exception {
+ if (!serverPropertiesFile.isFile()) {
+ throw new Exception("Properties file not found: [" + serverPropertiesFile.getAbsolutePath() + "]");
+ }
+
+ PropertiesFileUpdate pfu = new PropertiesFileUpdate(serverPropertiesFile);
+ Properties props = pfu.loadExistingProperties();
+ final HashMap<String, String> map = new HashMap<String, String>(props.size());
+ for (Object property : props.keySet()) {
+ map.put(property.toString(), props.getProperty(property.toString()));
+ }
+
+ validate(map, additionalProperties);
+ }
+
+ public static void validate(Map<String, String> serverProperties) throws Exception {
+ validate(serverProperties, null);
+ }
+
+ /**
+ * @param serverProperties
+ * @param additionalProperties additional properties that should be set (present and not empty). can be null.
+ * @throws Exception
+ */
+ public static void validate(Map<String, String> serverProperties, Set<String> additionalProperties)
+ throws Exception {
+ final StringBuilder dataErrors = new StringBuilder();
+
+ for (String name : ServerProperties.BOOLEAN_PROPERTIES) {
+ String val = serverProperties.get(name);
+ if (ServerInstallUtil.isEmpty(val) && OPTIONAL_PROPERTIES.contains(name)) {
+ continue;
+ }
+ if (!("true".equals(val) || "false".equals(val))) {
+ dataErrors.append("[" + name + "] must exist and be set 'true' or 'false' : [" + val + "]\n");
+ }
+ }
+
+ for (String name : ServerProperties.INTEGER_PROPERTIES) {
+ String val = serverProperties.get(name);
+ if (ServerInstallUtil.isEmpty(val) && OPTIONAL_PROPERTIES.contains(name)) {
+ continue;
+ }
+ try {
+ Integer.parseInt(val);
+ } catch (NumberFormatException e) {
+ dataErrors.append("[" + name + "] must exist and be set to a number : [" + val + "]\n");
+ }
+ }
+
+ Set<String> requiredStringProperties = new HashSet<String>();
+ requiredStringProperties.addAll(STRING_PROPERTIES);
+ if (null != additionalProperties) {
+ requiredStringProperties.addAll(additionalProperties);
+ }
+ for (String name : requiredStringProperties) {
+ String val = serverProperties.get(name);
+ if (ServerInstallUtil.isEmpty(val)) {
+ dataErrors.append("[" + name + "] must exist and be set to a valid string value\n");
+
+ } else if (ServerProperties.OBFUSCATED_PROPERTIES.contains(name)) {
+ try {
+ PicketBoxObfuscator.decode(val);
+ } catch (Throwable e) {
+ dataErrors
+ .append("["
+ + name
+ + "] must be encoded for security reasons. The value is not valid, perhaps it is set to a plain text value? : ["
+ + val + "]\n");
+ }
+ }
+ }
+
+ if (dataErrors.length() > 0) {
+ throw new Exception("Validation errors:\n" + dataErrors.toString());
+ }
+ }
+}
diff --git a/modules/enterprise/server/installer/src/main/resources/logging.properties b/modules/enterprise/server/installer/src/main/resources/logging.properties
index 0affd97..6cd57d1 100644
--- a/modules/enterprise/server/installer/src/main/resources/logging.properties
+++ b/modules/enterprise/server/installer/src/main/resources/logging.properties
@@ -2,20 +2,20 @@
loggers=org.rhq
# Root logger level
-logger.level=${rhq.server.installer.loglevel:DEBUG}
+logger.level=${rhq.server.installer.loglevel:INFO}
# Root logger handlers
logger.handlers=FILE,CONSOLE
# Console handler configuration
handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler
handler.CONSOLE.properties=autoFlush
-handler.CONSOLE.level=${rhq.server.installer.loglevel:DEBUG}
+handler.CONSOLE.level=${rhq.server.installer.loglevel:INFO}
handler.CONSOLE.autoFlush=true
handler.CONSOLE.formatter=PATTERN
# File handler configuration
handler.FILE=org.jboss.logmanager.handlers.FileHandler
-handler.FILE.level=${rhq.server.installer.loglevel:DEBUG}
+handler.FILE.level=${rhq.server.installer.loglevel:INFO}
handler.FILE.properties=autoFlush,append,fileName
handler.FILE.autoFlush=true
handler.FILE.append=true
diff --git a/modules/enterprise/server/server-control/pom.xml b/modules/enterprise/server/server-control/pom.xml
index 9f53404..b4302f0 100644
--- a/modules/enterprise/server/server-control/pom.xml
+++ b/modules/enterprise/server/server-control/pom.xml
@@ -28,6 +28,18 @@
<dependency>
<groupId>${project.groupId}</groupId>
+ <artifactId>rhq-installer-util</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>rhq-cassandra-installer</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
<artifactId>rhq-jboss-as-dmr-client</artifactId>
<version>${project.version}</version>
</dependency>
@@ -105,6 +117,16 @@
<version>${project.version}</version>
</artifactItem>
<artifactItem>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>rhq-installer-util</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>rhq-cassandra-installer</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+ <artifactItem>
<groupId>org.rhq</groupId>
<artifactId>rhq-jboss-as-dmr-client</artifactId>
</artifactItem>
diff --git a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/RHQControl.java b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/RHQControl.java
index 2d8d54c..7ad3b62 100644
--- a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/RHQControl.java
+++ b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/RHQControl.java
@@ -22,18 +22,24 @@
* * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
-
package org.rhq.server.control;
+import java.io.Console;
import java.io.File;
import java.util.LinkedList;
import java.util.List;
+import java.util.Properties;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.rhq.core.util.PropertiesFileUpdate;
+import org.rhq.core.util.StringUtil;
import org.rhq.core.util.exception.ThrowableUtil;
+import org.rhq.core.util.obfuscation.Obfuscator;
+import org.rhq.enterprise.server.installer.ServerProperties;
+import org.rhq.storage.installer.StorageProperty;
/**
* @author John Sanda
@@ -67,21 +73,7 @@ public class RHQControl {
String commandName = findCommand(commands, args);
command = commands.get(commandName);
- // perform any up front validation we can at this point. Not that after this point we
- // lose stdin due to the use of ProcessExecutions.
- if ("install".equalsIgnoreCase(command.getName())) {
- File serverProperties = new File("bin/rhq-server.properties");
- File storageProperties = new File("bin/rhq-storage.properties");
-
- if (!serverProperties.isFile()) {
- throw new RHQControlException("Missing required configuration file, can not continue: ["
- + serverProperties.getAbsolutePath() + "]");
- }
- if (!storageProperties.isFile()) {
- throw new RHQControlException("Missing required configuration file, can not continue: ["
- + storageProperties.getAbsolutePath() + "]");
- }
- }
+ validateInstallCommand(command);
// in case the installer gets killed, prepare the shutdown hook to try the undo
abortHook.setCommand(command);
@@ -93,11 +85,18 @@ public class RHQControl {
} catch (UsageException e) {
printUsage();
} catch (RHQControlException e) {
- log.error(e.getMessage() + " [Cause: " + e.getCause() + "]", e);
undo = true;
+
+ Throwable rootCause = ThrowableUtil.getRootCause(e);
+ // Only show the messy stack trace if we're in debug mode. Otherwise keep it cleaner for the user...
+ if (log.isDebugEnabled()) {
+ log.error(rootCause.getMessage(), rootCause);
+ } else {
+ log.error(rootCause.getMessage());
+ }
} catch (Throwable t) {
- log.error(t);
undo = true;
+ log.error(t);
} finally {
abortHook.setCommand(null);
Runtime.getRuntime().removeShutdownHook(abortHook);
@@ -119,6 +118,97 @@ public class RHQControl {
return;
}
+ private void validateInstallCommand(ControlCommand command) {
+ if (!"install".equalsIgnoreCase(command.getName())) {
+ return;
+ }
+
+ // perform any up front validation we can at this point. Not that after this point we
+ // lose stdin due to the use of ProcessExecutions.
+ File serverPropertiesFile = new File("bin/rhq-server.properties");
+ File storagePropertiesFile = new File("bin/rhq-storage.properties");
+
+ if (!serverPropertiesFile.isFile()) {
+ throw new RHQControlException(
+ "The required rhq-server.properties file can not be found in the expected location ["
+ + serverPropertiesFile.getAbsolutePath() + "]. Installation is canceled.");
+ }
+
+ if (!storagePropertiesFile.isFile()) {
+ throw new RHQControlException(
+ "The required rhq-storage.properties file can not be found in the expected location ["
+ + storagePropertiesFile.getAbsolutePath() + "]. Installation is canceled.");
+ }
+
+ // Prompt for critical required values, if not yet set.
+ try {
+ PropertiesFileUpdate pfu = new PropertiesFileUpdate(serverPropertiesFile);
+ Properties props = pfu.loadExistingProperties();
+
+ promptForProperty(pfu, props, serverPropertiesFile.getName(), ServerProperties.PROP_JBOSS_BIND_ADDRESS,
+ false);
+ promptForProperty(pfu, props, serverPropertiesFile.getName(), ServerProperties.PROP_DATABASE_PASSWORD, true);
+
+ } catch (Throwable t) {
+ throw new RHQControlException("The rhq-server.properties file is not valid. Installation is canceled: "
+ + t.getMessage());
+ }
+
+ // Now, validate the property settings
+ try {
+ ServerProperties.validate(serverPropertiesFile);
+
+ } catch (Throwable t) {
+ throw new RHQControlException("The rhq-server.properties file is not valid. Installation is canceled: "
+ + t.getMessage());
+ }
+
+ try {
+ StorageProperty.validate(storagePropertiesFile);
+
+ } catch (Throwable t) {
+ throw new RHQControlException("The rhq-storage.properties file is not valid. Installation is canceled: "
+ + t.getMessage());
+ }
+ }
+
+ private void promptForProperty(PropertiesFileUpdate pfu, Properties props, String propertiesFileName,
+ String propertyName, boolean encode) throws Exception {
+
+ String propertyValue = props.getProperty(propertyName);
+ if (StringUtil.isBlank(propertyValue)) {
+
+ // prompt for the property value
+ Console console = System.console();
+ console.format("\nThe [%s] property is required but not set in [%s].\n", propertyName, propertiesFileName);
+ console.format("Do you want to set [%s] value now?\n", propertyName);
+ String response = "";
+ while (!(response.startsWith("n") || response.startsWith("y"))) {
+ response = String.valueOf(console.readLine("%s", "yes|no: ")).toLowerCase();
+ }
+ if (response.startsWith("n")) {
+ throw new RHQControlException("Please update the [" + propertiesFileName + "] file as required.");
+ }
+
+ do {
+ propertyValue = "";
+ while (StringUtil.isBlank(propertyValue)) {
+ propertyValue = String.valueOf(console.readLine("%s", propertyName
+ + ((encode ? " (enter as plain text): " : ": "))));
+ }
+
+ console.format("Is [" + propertyValue + "] correct?\n");
+ response = "";
+ while (!(response.startsWith("n") || response.startsWith("y"))) {
+ response = String.valueOf(console.readLine("%s", "yes|no: ")).toLowerCase();
+ }
+ } while (response.startsWith("n"));
+
+ props.setProperty(propertyName, encode ? Obfuscator.encode(propertyValue) : propertyValue);
+ pfu.update(props);
+ }
+ }
+
private String findCommand(Commands commands, String[] args) throws RHQControlException {
List<String> commandNames = new LinkedList<String>();
for (String arg : args) {
@@ -153,7 +243,12 @@ public class RHQControl {
System.exit(0);
} catch (RHQControlException e) {
Throwable rootCause = ThrowableUtil.getRootCause(e);
- control.log.error("There was an unxpected error: " + rootCause.getMessage(), rootCause);
+ // Only show the messy stack trace if we're in debug mode. Otherwise keep it cleaner for the user...
+ if (control.log.isDebugEnabled()) {
+ control.log.error("There was an unexpected error: " + rootCause.getMessage(), rootCause);
+ } else {
+ control.log.error("There was an unexpected error: " + rootCause.getMessage());
+ }
System.exit(1);
}
}
diff --git a/modules/enterprise/server/server-control/src/main/resources/logging.properties b/modules/enterprise/server/server-control/src/main/resources/logging.properties
index 9f69ca9..fefc9f6 100644
--- a/modules/enterprise/server/server-control/src/main/resources/logging.properties
+++ b/modules/enterprise/server/server-control/src/main/resources/logging.properties
@@ -2,20 +2,20 @@
loggers=org.rhq
# Root logger level
-logger.level=${rhq.control.loglevel:DEBUG}
+logger.level=${rhq.control.loglevel:INFO}
# Root logger handlers
logger.handlers=FILE,CONSOLE
# Console handler configuration
handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler
handler.CONSOLE.properties=autoFlush
-handler.CONSOLE.level=${rhq.control.loglevel:DEBUG}
+handler.CONSOLE.level=${rhq.control.loglevel:INFO}
handler.CONSOLE.autoFlush=true
handler.CONSOLE.formatter=PATTERN
# File handler configuration
handler.FILE=org.jboss.logmanager.handlers.FileHandler
-handler.FILE.level=${rhq.control.loglevel:DEBUG}
+handler.FILE.level=${rhq.control.loglevel:INFO}
handler.FILE.properties=autoFlush,append,fileName
handler.FILE.autoFlush=true
handler.FILE.append=false
diff --git a/modules/enterprise/server/server-control/src/main/resources/module/main/module.xml b/modules/enterprise/server/server-control/src/main/resources/module/main/module.xml
index 0cba6f7..1489d4c 100644
--- a/modules/enterprise/server/server-control/src/main/resources/module/main/module.xml
+++ b/modules/enterprise/server/server-control/src/main/resources/module/main/module.xml
@@ -1,26 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="${moduleName}">
- <main-class name="org.rhq.server.control.RHQControl" />
+ <main-class name="org.rhq.server.control.RHQControl"/>
<resources>
- <resource-root path="${project.build.finalName}.jar" />
- <resource-root path="rhq-core-util-${project.version}.jar" />
- <resource-root path="rhq-jboss-as-dmr-client-${project.version}.jar" />
+ <resource-root path="${project.build.finalName}.jar"/>
+ <resource-root path="rhq-core-util-${project.version}.jar"/>
+ <resource-root path="rhq-jboss-as-dmr-client-${project.version}.jar"/>
+ <resource-root path="rhq-installer-util-${project.version}.jar"/>
+ <resource-root path="rhq-cassandra-installer-${project.version}.jar"/>
</resources>
<dependencies>
- <module name="javax.api" />
- <module name="org.apache.commons.logging" />
- <module name="org.apache.commons.cli" />
- <module name="org.apache.commons.exec" />
- <module name="org.apache.commons.configuration" />
- <module name="org.apache.log4j" />
- <module name="sun.jdk" />
- <module name="org.jboss.as.controller-client" />
- <module name="org.jboss.dmr" />
- <module name="org.jboss.logmanager" services="import" />
- <module name="org.jboss.logging" />
+ <module name="javax.api"/>
+ <module name="org.apache.commons.logging"/>
+ <module name="org.apache.commons.cli"/>
+ <module name="org.apache.commons.exec"/>
+ <module name="org.apache.commons.configuration"/>
+ <module name="org.apache.log4j"/>
+ <module name="sun.jdk"/>
+ <module name="org.jboss.as.controller-client"/>
+ <module name="org.jboss.dmr"/>
+ <module name="org.jboss.logmanager" services="import"/>
+ <module name="org.jboss.logging"/>
<module name="org.picketbox"/>
</dependencies>
</module>
commit 51577591b76912243037e45a34b016575b06a057
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Tue Oct 1 13:45:48 2013 +0200
Adding empty .gitignore file to allow git to push an empty directory structure.
diff --git a/modules/enterprise/gui/downloads-war/src/main/webapp/WEB-INF/.gitignore b/modules/enterprise/gui/downloads-war/src/main/webapp/WEB-INF/.gitignore
new file mode 100644
index 0000000..a93362a
--- /dev/null
+++ b/modules/enterprise/gui/downloads-war/src/main/webapp/WEB-INF/.gitignore
@@ -0,0 +1 @@
+# this file is here just to allow the git to accept empty directory structure
commit 2e10c0199c7bf871379f5d322bfdfe0d2825d6d3
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Tue Oct 1 10:39:34 2013 +0200
Fix master-compile: rhq-downloads-war may not have a src/main/webapp directory (i.e. on fresh checkouts)
diff --git a/modules/enterprise/gui/downloads-war/pom.xml b/modules/enterprise/gui/downloads-war/pom.xml
index 9d694cb..c021f98 100644
--- a/modules/enterprise/gui/downloads-war/pom.xml
+++ b/modules/enterprise/gui/downloads-war/pom.xml
@@ -101,8 +101,10 @@
<copy todir="${classes.dir}" verbose="${rhq.verbose}">
<fileset dir="target/classes" />
</copy>
- <property name="deployment.dir" location="${rhq.deploymentDir}" />
+ <property name="deployment.dir" location="${rhq.deploymentDir}" />
<echo>*** Copying updated files from src${file.separator}main${file.separator}webapp${file.separator} to ${deployment.dir}${file.separator}...</echo>
+ <!-- Create src/main/webapp if it does not exist -->
+ <mkdir dir="${basedir}/src/main/webapp"/>
<copy todir="${deployment.dir}" verbose="${rhq.verbose}">
<fileset dir="${basedir}/src/main/webapp" />
</copy>