modules/core/dbutils/pom.xml
| 8
modules/core/dbutils/src/main/java/org/rhq/core/db/OracleDatabaseType.java
| 23
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
| 197 ++++-
modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
| 12
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/EventContext.java
| 7
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventPoller.java
| 61 +
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventResourceComponentHelper.java
| 160 ++--
modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventContextImpl.java
| 3
modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventManager.java
| 7
modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementSenderRunner.java
| 27
modules/enterprise/binding/src/main/java/org/rhq/bindings/output/TabularWriter.java
| 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/InitializableView.java
| 7
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java
| 388 +++++-----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
| 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
| 45 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
| 34
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
| 15
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
| 11
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
| 10
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java
| 26
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionDataSource.java
| 9
modules/enterprise/remoting/cli/pom.xml
| 8
modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/ClientMain.java
| 26
modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/commands/RecordCommand.java
| 8
modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/commands/VersionCommand.java
| 49 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
| 34
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
| 38
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/jaxb/adapter/ResourceListAdapter.java
| 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/jaxb/adapter/WsResource.java
| 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDefinitionManagerBean.java
| 10
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementScheduleManagerBean.java
| 41 -
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
| 43 -
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerBean.java
| 18
modules/plugins/platform/src/main/java/org/rhq/plugins/platform/FileSystemComponent.java
| 46 -
34 files changed, 837 insertions(+), 546 deletions(-)
New commits:
commit 6aa861d99b836c576370ad1b0695b95d53eb0faf
Merge: dc1deaf 20221ed
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Wed Feb 1 13:48:04 2012 -0500
Merge branch 'release/jon3.0.x' into rc/jon3.0.1.GA
commit 20221edea965c18481e54b97d2b60ceb50bb1cea
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Tue Jan 31 17:12:36 2012 -0500
[BZ 784678] prevent NPE from occurring if -f option is not passed to CLI record
command - instead throw a command line
parse exception with an informative error message
(
https://bugzilla.redhat.com/show_bug.cgi?id=784678)
(cherry picked from commit 55a89fae4b11ca5a8fecb668b87dbcef2bc04cf9)
diff --git
a/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/commands/RecordCommand.java
b/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/commands/RecordCommand.java
index e1244ae..f3363aa 100644
---
a/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/commands/RecordCommand.java
+++
b/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/commands/RecordCommand.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
+ * Copyright (C) 2005-2012 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -98,8 +98,12 @@ public class RecordCommand implements ClientCommand {
code = getopt.getopt();
}
+ if (recordArgs.file == null) {
+ throw new CommandLineParseException("The file option must be
specified.");
+ }
+
if (recordArgs.recordState == null) {
- throw new CommandLineParseException("Either the start or stop option
must be specified");
+ throw new CommandLineParseException("Either the start or stop option
must be specified.");
}
return recordArgs;
commit 05fa50e1833a66f2e12dd59bd55839c2b258e765
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Tue Jan 31 16:43:11 2012 -0500
[BZ 785218] fix so -v/--version option does not print redundant info
(
https://bugzilla.redhat.com/show_bug.cgi?id=785218)
(cherry picked from commit 3c0e9542e0ddfa60828ea44c37af715a79bfcc6b)
diff --git
a/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/ClientMain.java
b/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/ClientMain.java
index 191c537..d4444fe 100755
---
a/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/ClientMain.java
+++
b/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/ClientMain.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2009 Red Hat, Inc.
+ * Copyright (C) 2005-2012 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -82,6 +82,7 @@ public class ClientMain {
private String user;
private String pass;
private ArrayList<String> notes = new ArrayList<String>();
+ private boolean showDetailedVersion;
// reference to the webservice reference factory
private RemoteClient remoteClient;
@@ -403,7 +404,7 @@ public class ClientMain {
}
private void displayUsage() {
- outputWriter.println("rhq-cli.sh [-h] [-u user] [-p pass] [-P] [-s host] [-t
port] [-f file]|[-c command]");
+ outputWriter.println("rhq-cli.sh [-h] [-u user] [-p pass] [-P] [-s host] [-t
port] [-v] [-f file]|[-c command]");
}
void processArguments(String[] args) throws IllegalArgumentException, IOException {
@@ -478,10 +479,10 @@ public class ClientMain {
setHost(getopt.getOptarg());
break;
}
- case 'r': {
- setTransport(getopt.getOptarg());
- break;
- }
+ case 'r': {
+ setTransport(getopt.getOptarg());
+ break;
+ }
case 't': {
String portArg = getopt.getOptarg();
try {
@@ -492,15 +493,20 @@ public class ClientMain {
break;
}
case 'v': {
- String versionString = Version.getProductNameAndVersionBuildInfo();
- outputWriter.println(versionString);
+ showDetailedVersion = true;
break;
}
}
}
if (interactiveMode) {
- outputWriter.println(Version.getProductNameAndVersion());
+ String version = (showDetailedVersion) ?
Version.getProductNameAndVersionBuildInfo() :
+ Version.getProductNameAndVersion();
+ outputWriter.println(version);
+ if (showDetailedVersion && args.length == 1) {
+ // If -v was the only option specified, exit after printing the version.
+ System.exit(0);
+ }
}
if (user != null && pass != null) {
@@ -516,7 +522,7 @@ public class ClientMain {
}
if (!interactiveMode) {
- commands.get("exec").execute(this, execCmdLine.toArray(new String[]
{}));
+ commands.get("exec").execute(this, execCmdLine.toArray(new
String[execCmdLine.size()]));
}
}
commit a4a6b535f5431652372af02cf77483e8d5f6ae03
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Tue Jan 31 16:08:05 2012 -0500
[BZ 784983] fix output of CLI version command
(
https://bugzilla.redhat.com/show_bug.cgi?id=784983)
(cherry picked from commit 43f016c9d9da95d2f5ea1bed4d1ee7fdbf9e07c3)
diff --git a/modules/enterprise/remoting/cli/pom.xml
b/modules/enterprise/remoting/cli/pom.xml
index d94c40b..8ed89b5 100644
--- a/modules/enterprise/remoting/cli/pom.xml
+++ b/modules/enterprise/remoting/cli/pom.xml
@@ -178,14 +178,6 @@
</includes>
<archive>
<index>true</index>
- <manifestEntries>
- <Implementation-Title>${rhq.product.name} -
${project.name}</Implementation-Title>
-
<Implementation-Version>${project.version}</Implementation-Version>
- <Specification-Vendor>org.jboss</Specification-Vendor>
- <Specification-Title>JBossWS</Specification-Title>
-
<Specification-Version>${jbossws-native-dist.version}</Specification-Version>
- <Build-Number>${buildNumber}</Build-Number>
- </manifestEntries>
</archive>
</configuration>
</plugin>
diff --git
a/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/commands/VersionCommand.java
b/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/commands/VersionCommand.java
index d27c3f3..2df0b72 100644
---
a/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/commands/VersionCommand.java
+++
b/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/commands/VersionCommand.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
+ * Copyright (C) 2005-2012 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -19,7 +19,10 @@
package org.rhq.enterprise.client.commands;
import java.util.Properties;
+import java.util.jar.Attributes;
+import gnu.getopt.Getopt;
+import gnu.getopt.LongOpt;
import org.rhq.enterprise.client.ClientMain;
import org.rhq.enterprise.client.Version;
@@ -35,26 +38,56 @@ public class VersionCommand implements ClientCommand {
}
public boolean execute(ClientMain client, String[] args) {
- if (args.length <= 1) {
+ VersionArgs versionArgs = parseArgs(args);
+ if (versionArgs.verbose) {
client.getPrintWriter().println(Version.getVersionPropertiesAsString());
} else {
Properties props = Version.getVersionProperties();
- for (int i = 1; i < args.length; i++) {
- client.getPrintWriter().println(args[i] + "=" +
props.getProperty(args[i], "<unknown>"));
- }
+ String version =
props.getProperty(Attributes.Name.IMPLEMENTATION_VERSION.toString());
+ client.getPrintWriter().println(version);
}
+
return true;
}
public String getSyntax() {
- return "version [prop name]...";
+ return getPromptCommandString() + " [-v | --verbose]";
}
public String getHelp() {
- return "Show version information and properties";
+ return "Show CLI version information";
}
public String getDetailedHelp() {
- return getHelp();
+ return getHelp() + ". If no arguments are specified, the CLI's version
is printed. If the verbose option is "
+ + "specified, the values of the main attributes from the CLI jar's
MANIFEST.MF are printed.";
+ }
+
+ private VersionArgs parseArgs(String[] args) {
+ String shortOpts = "-:v";
+ LongOpt[] longOpts = {
+ new LongOpt("verbose", LongOpt.OPTIONAL_ARGUMENT, null,
'v')
+ };
+ Getopt getopt = new Getopt("exec", args, shortOpts, longOpts);
+
+ VersionArgs versionArgs = new VersionArgs();
+
+ int code = getopt.getopt();
+ while (code != -1) {
+ switch (code) {
+ case ':':
+ throw new IllegalArgumentException("Illegal option.");
+ case 'v':
+ versionArgs.verbose = true;
+ break;
+ }
+ code = getopt.getopt();
+ }
+
+ return versionArgs;
+ }
+
+ private static class VersionArgs {
+ boolean verbose;
}
}
\ No newline at end of file
commit d44638c22a94b4997fd3a5af9f27b642bed97ef0
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Jan 31 15:20:14 2012 -0500
[Bug 773435 - Enabled event sources cause initial resource component start to time
out]
lazily access sigar on the first polling, which happens after container
initialization.
Conflicts:
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventPoller.java
diff --git
a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventPoller.java
b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventPoller.java
index bcc42de..30cd3e5 100644
---
a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventPoller.java
+++
b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventPoller.java
@@ -46,28 +46,21 @@ import org.rhq.core.pluginapi.event.EventPoller;
*
* @author Ian Springer
*/
-public class LogFileEventPoller implements EventPoller {
+public class LogFileEventPoller implements EventPoller {
private final Log log = LogFactory.getLog(this.getClass());
private String eventType;
private File logFile;
private FileInfo logFileInfo;
private LogEntryProcessor entryProcessor;
+ private EventContext eventContext;
- public LogFileEventPoller(EventContext eventContext, String eventType, File logFile,
LogEntryProcessor entryProcessor) {
- SigarProxy sigar = eventContext.getSigar();
+ public LogFileEventPoller(EventContext eventContext, String eventType, File logFile,
+ LogEntryProcessor entryProcessor) {
this.eventType = eventType;
this.logFile = logFile;
- if (sigar != null) {
- try {
- this.logFileInfo = new
LogFileInfo(sigar.getFileInfo(logFile.getPath()));
- } catch (SigarException e) {
- throw new RuntimeException("Failed to obtain file info for log file
[" + this.logFile + "].", e);
- }
- } else {
- log.warn("SIGAR is unavailable - cannot poll log file [" +
this.logFile + "] for events.");
- }
this.entryProcessor = entryProcessor;
+ this.eventContext = eventContext;
}
@NotNull
@@ -80,11 +73,26 @@ public class LogFileEventPoller implements EventPoller {
return this.logFile.getPath();
}
+ // we can't get the FileInfo in the constructor because pollers are constructed
during pc initialization, and
+ // at that time the eventManager is not available (and so we can't get sigar).
+ private FileInfo getFileInfo() {
+ if (null == this.logFileInfo) {
+ try {
+ SigarProxy sigar = eventContext.getSigar();
+ this.logFileInfo = new
LogFileInfo(sigar.getFileInfo(logFile.getPath()));
+ // once we have the file info we can let go of the event context, just in
case that's useful
+ this.eventContext = null;
+
+ } catch (SigarException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ return this.logFileInfo;
+ }
+
@Nullable
public Set<Event> poll() {
- if (this.logFileInfo == null) {
- return null;
- }
if (!this.logFile.exists()) {
log.warn("Log file [" + this.logFile + "] being polled does
not exist.");
return null;
@@ -93,23 +101,25 @@ public class LogFileEventPoller implements EventPoller {
log.error("Log file [" + this.logFile + "] being polled is a
directory, not a regular file.");
return null;
}
+ FileInfo fileInfo;
try {
- if (!this.logFileInfo.changed()) {
+ fileInfo = getFileInfo();
+ if (!fileInfo.changed()) {
return null;
}
} catch (SigarException e) {
throw new RuntimeException(e);
}
- return processNewLines();
+ return processNewLines(fileInfo);
}
- private Set<Event> processNewLines() {
+ private Set<Event> processNewLines(FileInfo fileInfo) {
Set<Event> events = null;
Reader reader = null;
try {
reader = new FileReader(this.logFile);
- long offset = getOffset();
+ long offset = getOffset(fileInfo);
if (offset > 0) {
reader.skip(offset);
@@ -130,24 +140,24 @@ public class LogFileEventPoller implements EventPoller {
return events;
}
- private long getOffset() {
- FileInfo previousFileInfo = this.logFileInfo.getPreviousInfo();
+ private long getOffset(FileInfo fileInfo) {
+ FileInfo previousFileInfo = fileInfo.getPreviousInfo();
if (previousFileInfo == null) {
if (log.isDebugEnabled()) {
log.debug(this.logFile + ": first stat");
}
- return this.logFileInfo.getSize();
+ return fileInfo.getSize();
}
- if (this.logFileInfo.getInode() != previousFileInfo.getInode()) {
+ if (fileInfo.getInode() != previousFileInfo.getInode()) {
if (log.isDebugEnabled()) {
log.debug(this.logFile + ": file inode changed");
}
return -1;
}
- if (this.logFileInfo.getSize() < previousFileInfo.getSize()) {
+ if (fileInfo.getSize() < previousFileInfo.getSize()) {
if (log.isDebugEnabled()) {
log.debug(this.logFile + ": file truncated");
}
@@ -155,7 +165,7 @@ public class LogFileEventPoller implements EventPoller {
}
if (log.isDebugEnabled()) {
- long diff = this.logFileInfo.getSize() - previousFileInfo.getSize();
+ long diff = fileInfo.getSize() - previousFileInfo.getSize();
log.debug(this.logFile + ": " + diff + " new bytes");
}
commit db02533c122d00f11bcfdda3531db5567558a144
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Jan 31 15:05:24 2012 -0500
[Bug 785022 - Server upgrade fails if db-uprade.xml task is unable to created index
when index already exists]
Applying suggested fix from loleary. Could not apply patch successfully
so manually reapplied the fix, which is to protect create/drop index
stmts with ignoreErrors="true".
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index 7dd68d4..2ffdfe5 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -296,7 +296,7 @@
</schema-directSQL>
<schema-alterColumn table="RHQ_SERVER"
column="OPERATION_MODE" nullable="FALSE" />
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_SERVER unique constraint on
NAME">
CREATE UNIQUE INDEX rhq_server_name_unique ON rhq_server (name)
</statement>
@@ -853,7 +853,7 @@
</schemaSpec>
<schemaSpec version="2.24">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_MEASUREMENT_BLINE index on
SCHEDULE_ID">
CREATE INDEX rhq_meas_baseline_sid_idx ON rhq_measurement_bline
(schedule_id)
</statement>
@@ -1078,7 +1078,7 @@
</schemaSpec>
<schemaSpec version="2.36">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Deleting unique constraint on
RHQ_MEASUREMENT_DEF">
DROP INDEX RHQ_METRIC_DEF_KEY_IDX
</statement>
@@ -1093,7 +1093,7 @@
WHERE NUMERIC_TYPE = 0
</statement>
</schema-directSQL>
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating unique index on RHQ_MEASUREMENT_DEF
(RESOURCE_TYPE_ID, NAME, RAW_NUMERIC_TYPE)">
CREATE UNIQUE INDEX RHQ_METRIC_DEF_KEY_IDX ON RHQ_MEASUREMENT_DEF
(RESOURCE_TYPE_ID, NAME, RAW_NUMERIC_TYPE)
</statement>
@@ -1193,49 +1193,77 @@
<!-- RHQ 1448 -->
<schemaSpec version="2.44">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R00
(SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R00_SID_IDX ON RHQ_MEAS_DATA_NUM_R00
(schedule_id)
- </statement>
+ </statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R01
(SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R01_SID_IDX ON RHQ_MEAS_DATA_NUM_R01
(schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R02
(SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R02_SID_IDX ON RHQ_MEAS_DATA_NUM_R02
(schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R03
(SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R03_SID_IDX ON RHQ_MEAS_DATA_NUM_R03
(schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R04
(SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R04_SID_IDX ON RHQ_MEAS_DATA_NUM_R04
(schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R05
(SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R05_SID_IDX ON RHQ_MEAS_DATA_NUM_R05
(schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R06
(SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R06_SID_IDX ON RHQ_MEAS_DATA_NUM_R06
(schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R07
(SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R07_SID_IDX ON RHQ_MEAS_DATA_NUM_R07
(schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R08
(SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R08_SID_IDX ON RHQ_MEAS_DATA_NUM_R08
(schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R09
(SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R09_SID_IDX ON RHQ_MEAS_DATA_NUM_R09
(schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R10
(SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R10_SID_IDX ON RHQ_MEAS_DATA_NUM_R10
(schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R11
(SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R11_SID_IDX ON RHQ_MEAS_DATA_NUM_R11
(schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R12
(SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R12_SID_IDX ON RHQ_MEAS_DATA_NUM_R12
(schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R13
(SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R13_SID_IDX ON RHQ_MEAS_DATA_NUM_R13
(schedule_id)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R14
(SCHEDULE_ID)">
CREATE INDEX RHQ_MEAS_DATA_R14_SID_IDX ON RHQ_MEAS_DATA_NUM_R14
(schedule_id)
</statement>
@@ -1300,7 +1328,7 @@
</schemaSpec>
<schemaSpec version="2.50">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on
RHQ_RESOURCE_ERROR.RESOURCE_ID">
CREATE INDEX RHQ_RES_ERROR_IDX_RES_ID ON RHQ_RESOURCE_ERROR
(RESOURCE_ID)
</statement>
@@ -1313,12 +1341,12 @@
</schemaSpec>
<schemaSpec version="2.52">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Deleting unique name constraint on
RHQ_RESOURCE_GROUP">
DROP INDEX RHQ_RES_GROUP_NAME
</statement>
</schema-directSQL>
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Deleting unique name constraint on
RHQ_RESOURCE_GROUP">
CREATE INDEX RHQ_RES_GROUP_NAME ON RHQ_RESOURCE_GROUP (name)
</statement>
@@ -1348,57 +1376,87 @@
</schemaSpec>
<schemaSpec version="2.55">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on TIME_STAMP column of
RHQ_MEASUREMENT_DATA_NUM_1H">
CREATE INDEX RHQ_MEAS_DATA_1H_TIME_IDX ON
RHQ_MEASUREMENT_DATA_NUM_1H(TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on TIME_STAMP column of
RHQ_MEASUREMENT_DATA_NUM_6H">
CREATE INDEX RHQ_MEAS_DATA_6H_TIME_IDX ON
RHQ_MEASUREMENT_DATA_NUM_6H(TIME_STAMP)
</statement>
</schema-directSQL>
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R00
(TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R00_TS_IDX ON RHQ_MEAS_DATA_NUM_R00
(TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R01
(TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R01_TS_IDX ON RHQ_MEAS_DATA_NUM_R01
(TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R02
(TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R02_TS_IDX ON RHQ_MEAS_DATA_NUM_R02
(TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R03
(TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R03_TS_IDX ON RHQ_MEAS_DATA_NUM_R03
(TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R04
(TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R04_TS_IDX ON RHQ_MEAS_DATA_NUM_R04
(TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R05
(TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R05_TS_IDX ON RHQ_MEAS_DATA_NUM_R05
(TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R06
(TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R06_TS_IDX ON RHQ_MEAS_DATA_NUM_R06
(TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R07
(TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R07_TS_IDX ON RHQ_MEAS_DATA_NUM_R07
(TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R08
(TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R08_TS_IDX ON RHQ_MEAS_DATA_NUM_R08
(TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R09
(TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R09_TS_IDX ON RHQ_MEAS_DATA_NUM_R09
(TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R10
(TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R10_TS_IDX ON RHQ_MEAS_DATA_NUM_R10
(TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R11
(TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R11_TS_IDX ON RHQ_MEAS_DATA_NUM_R11
(TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R12
(TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R12_TS_IDX ON RHQ_MEAS_DATA_NUM_R12
(TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R13
(TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R13_TS_IDX ON RHQ_MEAS_DATA_NUM_R13
(TIME_STAMP)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating index on RHQ_MEAS_DATA_NUM_R14
(TIME_STAMP)">
CREATE INDEX RHQ_MEAS_DATA_R14_TS_IDX ON RHQ_MEAS_DATA_NUM_R14
(TIME_STAMP)
</statement>
@@ -1406,49 +1464,77 @@
</schemaSpec>
<schemaSpec version="2.56">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on
RHQ_MEAS_DATA_R00_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R00_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on
RHQ_MEAS_DATA_R01_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R01_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on
RHQ_MEAS_DATA_R02_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R02_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on
RHQ_MEAS_DATA_R03_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R03_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on
RHQ_MEAS_DATA_R04_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R04_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on
RHQ_MEAS_DATA_R05_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R05_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on
RHQ_MEAS_DATA_R06_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R06_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on
RHQ_MEAS_DATA_R07_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R07_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on
RHQ_MEAS_DATA_R08_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R08_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on
RHQ_MEAS_DATA_R09_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R09_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on
RHQ_MEAS_DATA_R10_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R10_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on
RHQ_MEAS_DATA_R11_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R11_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on
RHQ_MEAS_DATA_R12_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R12_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on
RHQ_MEAS_DATA_R13_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R13_SID_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping index on
RHQ_MEAS_DATA_R14_SID_IDX">
DROP INDEX RHQ_MEAS_DATA_R14_SID_IDX
</statement>
@@ -1456,7 +1542,7 @@
</schemaSpec>
<schemaSpec version="2.57">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Create index on
RHQ_CONFIG_PROPERTY(PARENT_LIST_ID)">
CREATE INDEX RHQ_CONFIG_PROP_idx_list_key ON
RHQ_CONFIG_PROPERTY(PARENT_LIST_ID)
</statement>
@@ -1683,6 +1769,8 @@
FOREIGN KEY ( REPO_GROUP_TYPE_ID )
REFERENCES RHQ_REPO_GROUP_TYPE ( ID )
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_REPO_GROUP_IDX
ON RHQ_REPO_GROUP ( NAME, REPO_GROUP_TYPE_ID )
@@ -1842,7 +1930,7 @@
<schema-alterColumn table="RHQ_DISTRIBUTION"
column="BASE_PATH" nullable="false" />
<schema-addColumn table="RHQ_DISTRIBUTION"
column="LAST_MODIFIED" columnType="LONG" />
<schema-alterColumn table="RHQ_DISTRIBUTION"
column="LAST_MODIFIED" nullable="false" />
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_DISTRIBUTION_IDX ON RHQ_DISTRIBUTION (
LABEL, BASE_PATH )
</statement>
@@ -1947,6 +2035,8 @@
FOREIGN KEY (DISTRIBUTION_ID)
REFERENCES RHQ_DISTRIBUTION ( ID )
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_DISTRIBUTION_FILE_IDX
ON RHQ_DISTRIBUTION_FILE ( DISTRIBUTION_ID, RELATIVE_FILENAME )
@@ -2019,7 +2109,7 @@
</schema-directSQL>
<!-- Fix bug:538157 -->
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE INDEX RHQ_REPO_PKG_VER_MAP_IDX
ON RHQ_REPO_PKG_VERSION_MAP ( PACKAGE_VERSION_ID )
@@ -2040,10 +2130,12 @@
<schemaSpec version="2.69.2">
<!-- plugin names must be unique only if they are deployed on the same
side (agent vs. server) -->
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping unique index on RHQ_PLUGIN
(NAME)">
DROP INDEX RHQ_PLUGIN_NAME_IDX
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating unique index on RHQ_PLUGIN (NAME,
DEPLOYMENT) so server plugin names need not be unique with agent plugins">
CREATE UNIQUE INDEX RHQ_PLUGIN_NAME_DEPLOY_IDX ON RHQ_PLUGIN
(NAME, DEPLOYMENT)
</statement>
@@ -2086,7 +2178,7 @@
<schema-addColumn table="RHQ_ALERT_NOTIF_LOG"
column="MESSAGE" columnType="VARCHAR2" precision="4000"
/>
</schemaSpec>
<schemaSpec version="2.70.3">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Dropping unique index
RHQ_ALERT_IDX_ALERT">
DROP INDEX RHQ_ALERT_IDX_ALERT
</statement>
@@ -2127,7 +2219,7 @@
<schema-deleteColumn table="RHQ_ALERT"
column="triggered_operation" />
</schemaSpec>
<schemaSpec version="2.70.7">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Recreating RHQ_ALERT_IDX_ALERT as non-unique
index">
CREATE INDEX RHQ_ALERT_IDX_ALERT ON RHQ_ALERT_NOTIF_LOG
(alert_id)
</statement>
@@ -2168,13 +2260,17 @@
<schema-addColumn table="RHQ_ADVISORY"
column="LAST_MODIFIED" columnType="LONG" />
<schema-alterColumn table="RHQ_ADVISORY"
column="LAST_MODIFIED" nullable="false" />
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_ADVISORY_NAME_UQ ON RHQ_ADVISORY (
ADVISORY_NAME )
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_ADVISORY_UQ ON RHQ_ADVISORY ( ADVISORY )
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE INDEX RHQ_ADVISORY_UDATE_IDX ON RHQ_ADVISORY (UPDATE_DATE
)
</statement>
@@ -2193,7 +2289,7 @@
<schema-alterColumn table="RHQ_ADVISORY_PACKAGE"
column="PACKAGE_VERSION_ID" nullable="false" />
<schema-addColumn table="RHQ_ADVISORY_PACKAGE"
column="LAST_MODIFIED" columnType="LONG" />
<schema-alterColumn table="RHQ_ADVISORY_PACKAGE"
column="LAST_MODIFIED" nullable="false" />
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_ADVISORY_PACKAGE_IDX ON
RHQ_ADVISORY_PACKAGE ( ADVISORY_ID, PACKAGE_VERSION_ID )
</statement>
@@ -2234,7 +2330,7 @@
<schema-alterColumn table="RHQ_ADVISORY_CVE"
column="CVE_ID" nullable="false" />
<schema-addColumn table="RHQ_ADVISORY_CVE"
column="LAST_MODIFIED" columnType="LONG" />
<schema-alterColumn table="RHQ_ADVISORY_CVE"
column="LAST_MODIFIED" nullable="false" />
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_ADVISORY_CVE_IDX ON RHQ_ADVISORY_CVE (
ADVISORY_ID, CVE_ID )
</statement>
@@ -2266,7 +2362,7 @@
<schema-alterColumn table="RHQ_ADVISORY_BUGLIST"
column="BUG_ID" nullable="false" />
<schema-addColumn table="RHQ_ADVISORY_BUGLIST"
column="LAST_MODIFIED" columnType="LONG" />
<schema-alterColumn table="RHQ_ADVISORY_BUGLIST"
column="LAST_MODIFIED" nullable="false" />
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_ADVISORY_BUG_IDX ON RHQ_ADVISORY_BUGLIST (
ADVISORY_ID, BUG_ID )
</statement>
@@ -2365,6 +2461,8 @@
FOREIGN KEY (RESOURCE_TYPE_ID)
REFERENCES RHQ_RESOURCE_TYPE (ID)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_BUNDLE_TYPE unique
constraint">
CREATE UNIQUE INDEX RHQ_BUNDLE_TYPE_UNIQUE ON RHQ_BUNDLE_TYPE
(name)
</statement>
@@ -2406,6 +2504,8 @@
FOREIGN KEY (PACKAGE_TYPE_ID)
REFERENCES RHQ_PACKAGE_TYPE (ID)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_BUNDLE unique
constraint">
CREATE UNIQUE INDEX RHQ_BUNDLE_UNIQUE ON RHQ_BUNDLE
(bundle_type_id, name)
</statement>
@@ -2444,6 +2544,8 @@
FOREIGN KEY (CONFIG_DEF_ID)
REFERENCES RHQ_CONFIG_DEF (ID)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_BUNDLE_VERSION unique
constraint">
CREATE UNIQUE INDEX RHQ_BUNDLE_VERSION_UNIQUE ON
RHQ_BUNDLE_VERSION (bundle_id, name, version)
</statement>
@@ -2539,6 +2641,8 @@
FOREIGN KEY (GROUP_ID)
REFERENCES RHQ_RESOURCE_GROUP (ID)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_BUNDLE_DESTINATION unique
constraint">
CREATE UNIQUE INDEX RHQ_BUNDLE_DESTINATION_UNIQUE
ON RHQ_BUNDLE_DESTINATION (bundle_id, group_id, deploy_dir)
@@ -2630,6 +2734,8 @@
FOREIGN KEY (RESOURCE_ID)
REFERENCES RHQ_RESOURCE (ID)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_BUNDLE_RES_DEPLOY unique
constraint on dep-resource mapping">
CREATE UNIQUE INDEX RHQ_BUNDLE_RES_DEPLOY_IDX
ON RHQ_BUNDLE_RES_DEPLOY (BUNDLE_DEPLOYMENT_ID, RESOURCE_ID)
@@ -2788,6 +2894,8 @@
FOREIGN KEY ( ROLE_ID )
REFERENCES RHQ_ROLE (ID)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement>
CREATE UNIQUE INDEX RHQ_ROLE_LDAP_GROUP_IDX
ON RHQ_ROLE_LDAP_GROUP ( ROLE_ID, LDAP_GROUP_NAME )
@@ -2996,10 +3104,12 @@
</schemaSpec>
<schemaSpec version="2.87">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Drop non-unique RHQ_RES_TYPE_IDX_PLG_NAME
index">
DROP INDEX RHQ_RES_TYPE_IDX_PLG_NAME
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Recreate RHQ_RES_TYPE_IDX_PLG_NAME index as
unique">
CREATE UNIQUE INDEX RHQ_RES_TYPE_IDX_PLG_NAME ON
RHQ_RESOURCE_TYPE (name, plugin)
</statement>
@@ -3007,10 +3117,12 @@
</schemaSpec>
<schemaSpec version="2.88">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Add end time index on call time data to
speed up purges">
CREATE INDEX RHQ_CT_DA_VA_END_TIM_IDX ON RHQ_CALLTIME_DATA_VALUE
(end_time)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Add index on measurement definition numeric
type">
CREATE INDEX RHQ_METRIC_DEF_NT_IDX ON RHQ_MEASUREMENT_DEF
(numeric_type)
</statement>
@@ -3131,7 +3243,7 @@
</schemaSpec>
<schemaSpec version="2.92.4">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Add index on measurement data 1d table
timestamp">
CREATE INDEX RHQ_MEAS_DATA_1D_TIME_IDX ON
RHQ_MEASUREMENT_DATA_NUM_1D (time_stamp)
</statement>
@@ -3294,6 +3406,8 @@
<statement desc="Changing primary key of
RHQ_OPERATION_SCHEDULE to ID. Step2/3...">
ALTER TABLE RHQ_OPERATION_SCHEDULE ADD PRIMARY KEY (ID)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Changing primary key of
RHQ_OPERATION_SCHEDULE to ID. Step3/3...">
CREATE UNIQUE INDEX RHQ_OPERATION_SCHEDULE_KEY_IDX ON
RHQ_OPERATION_SCHEDULE (JOB_NAME, JOB_GROUP)
</statement>
@@ -3607,10 +3721,12 @@
</schemaSpec>
<schemaSpec version="2.113">
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_ALERT_CONDITION_LOG index on
CONDITION_ID">
CREATE INDEX RHQ_ALERT_COND_LOG_COND_IDX ON
RHQ_ALERT_CONDITION_LOG (CONDITION_ID)
</statement>
+ </schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_MEASUREMENT_SCHED index on
RESOURCE_ID">
CREATE INDEX RHQ_MEAS_SCHED_RESID_IDX ON RHQ_MEASUREMENT_SCHED
(RESOURCE_ID)
</statement>
@@ -3667,7 +3783,7 @@
REFERENCES RHQ_CONFIG (ID)
</statement>
</schema-directSQL>
- <schema-directSQL>
+ <schema-directSQL ignoreError="true">
<statement desc="Creating unique index on RESOURCE_TYPE_ID
and NAME columns">
CREATE UNIQUE INDEX RHQ_TYPE_DEF_NAME ON RHQ_DRIFT_DEF_TEMPLATE (
RESOURCE_TYPE_ID, NAME )
</statement>
commit 72bb3d37c84b3af4250c5daee87438be9d9fbb26
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Nov 11 10:57:33 2011 -0500
log message reporting invalid numeric metrics at DEBUG, rather than WARN,
to avoid flooding the agent log with repetitive messages
(cherry picked from commit 542a30ca6d0eaebbee5365c756955255ba367e4e)
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementSenderRunner.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementSenderRunner.java
index 5cee6a6..a9136d1 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementSenderRunner.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementSenderRunner.java
@@ -90,15 +90,34 @@ public class MeasurementSenderRunner implements
Callable<MeasurementReport>, Run
Iterator<MeasurementDataNumeric> iter =
report.getNumericData().iterator();
while (iter.hasNext()) {
MeasurementDataNumeric numeric = iter.next();
- Double v = numeric.getValue();
- if (v == null || v.isInfinite() || v.isNaN()) {
- LOG.warn("Numeric " + numeric.getName() + " with id "
+ numeric.getScheduleId()
- + " is invalid, value was '" + v + "'");
+ Double value = numeric.getValue();
+ if (value == null || value.isInfinite() || value.isNaN()) {
+ if (LOG.isDebugEnabled()) {
+ String stringValue = getStringValue(value);
+ LOG.debug("Numeric metric [" + numeric.getName() + "]
with schedule id [" + numeric.getScheduleId()
+ + "] is invalid - value is [" + stringValue +
"].");
+ }
iter.remove();
}
}
}
+ private String getStringValue(Double value) {
+ String stringValue;
+ if (value == null) {
+ stringValue = "null";
+ } else if (value.isNaN()) {
+ stringValue = "Double.NaN";
+ } else if (value == Double.POSITIVE_INFINITY) {
+ stringValue = "Double.POSITIVE_INFINITY";
+ } else if (value == Double.NEGATIVE_INFINITY) {
+ stringValue = "Double.NEGATIVE_INFINITY";
+ } else {
+ stringValue = value.toString();
+ }
+ return stringValue;
+ }
+
public void run() {
try {
call();
commit b9ccebed287c8cc86ad4e601b3ceb23ec0520770
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Jan 31 13:32:08 2012 -0500
[Bug 772771 - Agent not syncing updated plugin config at startup]
The resource mtime was not being properly updated when completing the
plugin config sync. If the agent was down at update time it would not
know to sync the resource on startup, or at any point until perhaps
the resource was modified in some other way, or the plugin config was
changed when the agent was up.
Also, in general Resource.setAgentSynchronizationNeeded() should be called
by any code performing an update that requires agent sync. The
Resource.setMtime() method should not be called for this purpose, but
rather only when manual mtime manipulation is required.
- fixed plugin config update
- converted setMtime calls to be setAgentSynchronizationNeeded() where appropriate
- added a missing call to setAgentSynchronizationNeeded() in DiscoveryBossBean
- trivial
-- fixed a method name typo
-- fixed some compiler warnings
-- removed some dead code
Conflicts:
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementScheduleManagerBean.java
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
index dd5da1b..c90ed4e 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
@@ -83,7 +83,7 @@ import org.rhq.core.domain.util.Summary;
* Represents an RHQ managed resource (i.e. a platform, server, or service).
*/
@Entity
-@NamedQueries( {
+@NamedQueries({
@NamedQuery(name = Resource.QUERY_FIND_PROBLEM_RESOURCES_ALERT_ADMIN, query =
"" //
+ " SELECT DISTINCT new
org.rhq.core.domain.resource.composite.ProblemResourceComposite"
+ " ( "
@@ -1302,6 +1302,12 @@ public class Resource implements Comparable<Resource>,
Serializable {
return this.mtime;
}
+ /**
+ * Call this directly only when needing manual manipulation of the mtime. Otherwise,
you probably want to
+ * call {@link #setAgentSynchronizationNeeded()}.
+ *
+ * @param mtime
+ */
public void setMtime(long mtime) {
this.mtime = mtime;
}
@@ -1336,8 +1342,6 @@ public class Resource implements Comparable<Resource>,
Serializable {
*
* For a list of changes that the agent cares about, see
InventoryManager.mergeResource(Resource, Resource)
*/
-
- // @PreUpdate
public void setAgentSynchronizationNeeded() {
this.mtime = System.currentTimeMillis();
}
@@ -1434,7 +1438,7 @@ public class Resource implements Comparable<Resource>,
Serializable {
return schedules;
}
- public void setSchendules(Set<MeasurementSchedule> schedules) {
+ public void setSchedules(Set<MeasurementSchedule> schedules) {
this.schedules = schedules;
}
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index 5b88fe5..60550be 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -136,7 +136,6 @@ import org.rhq.enterprise.server.util.QuartzUtil;
* @author John Mazzitelli
* @author Ian Springer
*/
-@SuppressWarnings({ "UnnecessaryLocalVariable",
"UnnecessaryReturnStatement" })
@Stateless
@XmlType(namespace = ServerVersion.namespace)
public class ConfigurationManagerBean implements ConfigurationManagerLocal,
ConfigurationManagerRemote {
@@ -220,6 +219,7 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
Resource resource = update.getResource();
// link to the newer, persisted configuration object -- regardless of errors
+ resource.setAgentSynchronizationNeeded();
resource.setPluginConfiguration(update.getConfiguration());
if (response.getStatus() == ConfigurationUpdateStatus.SUCCESS) {
@@ -1242,17 +1242,6 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
return configService.validate(configuration, resourceId, isStructured);
}
- private boolean isRawSupported(int resourceId) {
- Resource resource = entityManager.find(Resource.class, resourceId);
- ConfigurationDefinition configDef =
resource.getResourceType().getResourceConfigurationDefinition();
- if (configDef == null) {
- return false;
- }
-
- return (ConfigurationFormat.STRUCTURED_AND_RAW ==
configDef.getConfigurationFormat() || (ConfigurationFormat.RAW == configDef
- .getConfigurationFormat()));
- }
-
private boolean isStructuredAndRawSupported(int resourceId) {
Resource resource = entityManager.find(Resource.class, resourceId);
ConfigurationDefinition configDef =
resource.getResourceType().getResourceConfigurationDefinition();
@@ -1691,7 +1680,6 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
}
public Configuration getConfiguration(Subject subject, int configurationId) {
- @SuppressWarnings({ "UnnecessaryLocalVariable" })
Configuration configuration = getConfigurationById(configurationId);
return configuration;
}
@@ -2337,7 +2325,6 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
return out;
}
- @SuppressWarnings("unchecked")
public PageList<ResourceConfigurationUpdate>
findResourceConfigurationUpdatesByCriteria(Subject subject,
ResourceConfigurationUpdateCriteria criteria) {
CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject,
criteria);
@@ -2346,8 +2333,8 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
"resource", subject.getId());
}
- CriteriaQueryRunner<ResourceConfigurationUpdate> queryRunner = new
CriteriaQueryRunner(criteria, generator,
- entityManager);
+ CriteriaQueryRunner<ResourceConfigurationUpdate> queryRunner = new
CriteriaQueryRunner<ResourceConfigurationUpdate>(
+ criteria, generator, entityManager);
PageList<ResourceConfigurationUpdate> updates = queryRunner.execute();
@@ -2371,7 +2358,6 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
return updates;
}
- @SuppressWarnings("unchecked")
public PageList<PluginConfigurationUpdate>
findPluginConfigurationUpdatesByCriteria(Subject subject,
PluginConfigurationUpdateCriteria criteria) {
CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject,
criteria);
@@ -2380,8 +2366,8 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
"resource", subject.getId());
}
- CriteriaQueryRunner<PluginConfigurationUpdate> queryRunner = new
CriteriaQueryRunner(criteria, generator,
- entityManager);
+ CriteriaQueryRunner<PluginConfigurationUpdate> queryRunner = new
CriteriaQueryRunner<PluginConfigurationUpdate>(
+ criteria, generator, entityManager);
PageList<PluginConfigurationUpdate> updates = queryRunner.execute();
@@ -2405,7 +2391,6 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
return updates;
}
- @SuppressWarnings("unchecked")
public PageList<GroupResourceConfigurationUpdate>
findGroupResourceConfigurationUpdatesByCriteria(Subject subject,
GroupResourceConfigurationUpdateCriteria criteria) {
CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject,
criteria);
@@ -2414,8 +2399,8 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
subject.getId());
}
- CriteriaQueryRunner<GroupResourceConfigurationUpdate> queryRunner = new
CriteriaQueryRunner(criteria,
- generator, entityManager);
+ CriteriaQueryRunner<GroupResourceConfigurationUpdate> queryRunner = new
CriteriaQueryRunner<GroupResourceConfigurationUpdate>(
+ criteria, generator, entityManager);
PageList<GroupResourceConfigurationUpdate> updates =
queryRunner.execute();
@@ -2438,7 +2423,6 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
return updates;
}
- @SuppressWarnings("unchecked")
public PageList<GroupPluginConfigurationUpdate>
findGroupPluginConfigurationUpdatesByCriteria(Subject subject,
GroupPluginConfigurationUpdateCriteria criteria) {
CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject,
criteria);
@@ -2447,8 +2431,8 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
subject.getId());
}
- CriteriaQueryRunner<GroupPluginConfigurationUpdate> queryRunner = new
CriteriaQueryRunner(criteria, generator,
- entityManager);
+ CriteriaQueryRunner<GroupPluginConfigurationUpdate> queryRunner = new
CriteriaQueryRunner<GroupPluginConfigurationUpdate>(
+ criteria, generator, entityManager);
PageList<GroupPluginConfigurationUpdate> updates = queryRunner.execute();
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
index 2ea6234..7609492 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
@@ -21,6 +21,7 @@ package org.rhq.enterprise.server.discovery;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
+import java.util.Date;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
@@ -29,7 +30,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
-import java.util.Date;
import javax.ejb.EJB;
import javax.ejb.Stateless;
@@ -44,12 +44,12 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-
import org.quartz.JobDataMap;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.SimpleTrigger;
+
import org.rhq.core.clientapi.agent.PluginContainerException;
import org.rhq.core.clientapi.agent.discovery.InvalidPluginConfigurationClientException;
import org.rhq.core.clientapi.agent.upgrade.ResourceUpgradeRequest;
@@ -314,16 +314,15 @@ public class DiscoveryBossBean implements DiscoveryBossLocal,
DiscoveryBossRemot
final String randomSuffix = UUID.randomUUID().toString();
final String triggerName = TRIGGER_PREFIX + " - " + randomSuffix;
- SimpleTrigger trigger = new SimpleTrigger(triggerName, DEFAULT_JOB_GROUP,
- new Date());
+ SimpleTrigger trigger = new SimpleTrigger(triggerName, DEFAULT_JOB_GROUP, new
Date());
JobDataMap jobDataMap = new JobDataMap();
jobDataMap.put(AgentInventoryStatusUpdateJob.KEY_TRIGGER_NAME, triggerName);
jobDataMap.put(AgentInventoryStatusUpdateJob.KEY_TRIGGER_GROUP_NAME,
DEFAULT_JOB_GROUP);
AgentInventoryStatusUpdateJob.externalizeJobValues(jobDataMap,
- AgentInventoryStatusUpdateJob.PLATFORMS_COMMA_LIST, platforms);
+ AgentInventoryStatusUpdateJob.PLATFORMS_COMMA_LIST, platforms);
AgentInventoryStatusUpdateJob.externalizeJobValues(jobDataMap,
- AgentInventoryStatusUpdateJob.SERVERS_COMMA_LIST, servers);
+ AgentInventoryStatusUpdateJob.SERVERS_COMMA_LIST, servers);
trigger.setJobName(DEFAULT_JOB_NAME);
trigger.setJobGroup(DEFAULT_JOB_GROUP);
@@ -333,7 +332,7 @@ public class DiscoveryBossBean implements DiscoveryBossLocal,
DiscoveryBossRemot
scheduler.scheduleJob(trigger);
} else {
JobDetail jobDetail = new JobDetail(DEFAULT_JOB_NAME, DEFAULT_JOB_GROUP,
- AgentInventoryStatusUpdateJob.class);
+ AgentInventoryStatusUpdateJob.class);
scheduler.scheduleJob(jobDetail, trigger);
}
} catch (SchedulerException e) {
@@ -357,10 +356,10 @@ public class DiscoveryBossBean implements DiscoveryBossLocal,
DiscoveryBossRemot
AgentClient agentClient = agentManager.getAgentClient(platform.getAgent());
try {
agentClient.getDiscoveryAgentService().synchronizeInventory(
- entityManager.find(ResourceSyncInfo.class, platform.getId()));
+ entityManager.find(ResourceSyncInfo.class, platform.getId()));
} catch (Exception e) {
log.warn("Could not perform commit synchronization with agent for
platform [" + platform.getName()
- + "]", e);
+ + "]", e);
}
}
for (Resource server : servers) {
@@ -369,10 +368,10 @@ public class DiscoveryBossBean implements DiscoveryBossLocal,
DiscoveryBossRemot
AgentClient agentClient =
agentManager.getAgentClient(server.getAgent());
try {
agentClient.getDiscoveryAgentService().synchronizeInventory(
- entityManager.find(ResourceSyncInfo.class, server.getId()));
+ entityManager.find(ResourceSyncInfo.class, server.getId()));
} catch (Exception e) {
log.warn("Could not perform commit synchronization with agent
for server [" + server.getName()
- + "]", e);
+ + "]", e);
}
}
}
@@ -511,6 +510,7 @@ public class DiscoveryBossBean implements DiscoveryBossLocal,
DiscoveryBossRemot
}
}
+ @SuppressWarnings("deprecation")
public Set<ResourceUpgradeResponse>
upgradeResources(Set<ResourceUpgradeRequest> upgradeRequests) {
Set<ResourceUpgradeResponse> result = new
HashSet<ResourceUpgradeResponse>();
@@ -588,8 +588,9 @@ public class DiscoveryBossBean implements DiscoveryBossLocal,
DiscoveryBossRemot
private ResourceUpgradeResponse upgradeResource(@NotNull Resource resource,
ResourceUpgradeRequest upgradeRequest,
boolean allowGenericPropertiesUpgrade) {
if (upgradeRequest.getUpgradeErrorMessage() != null) {
- ResourceError error = new ResourceError(resource, ResourceErrorType.UPGRADE,
upgradeRequest
- .getUpgradeErrorMessage(), upgradeRequest.getUpgradeErrorStackTrace(),
upgradeRequest.getTimestamp());
+ ResourceError error = new ResourceError(resource, ResourceErrorType.UPGRADE,
+ upgradeRequest.getUpgradeErrorMessage(),
upgradeRequest.getUpgradeErrorStackTrace(),
+ upgradeRequest.getTimestamp());
resourceManager.addResourceError(error);
return null;
}
@@ -767,8 +768,8 @@ public class DiscoveryBossBean implements DiscoveryBossLocal,
DiscoveryBossRemot
continue;
}
}
- existingResource = resourceManager.getResourceByParentAndKey(overlord,
existingParent, resource
- .getResourceKey(), resourceType.getPlugin(),
resourceType.getName());
+ existingResource = resourceManager.getResourceByParentAndKey(overlord,
existingParent,
+ resource.getResourceKey(), resourceType.getPlugin(),
resourceType.getName());
}
if (existingResource != null) {
@@ -871,6 +872,7 @@ public class DiscoveryBossBean implements DiscoveryBossLocal,
DiscoveryBossRemot
if (existingResource.getInventoryStatus() == InventoryStatus.DELETED) {
existingResource.setInventoryStatus(InventoryStatus.COMMITTED);
existingResource.setPluginConfiguration(updatedResource.getPluginConfiguration());
+ existingResource.setAgentSynchronizationNeeded();
}
for (Resource childResource : updatedResource.getChildResources()) {
@@ -1021,14 +1023,14 @@ public class DiscoveryBossBean implements DiscoveryBossLocal,
DiscoveryBossRemot
// Do one query per 1000 Resource id's to prevent Oracle from failing because
of an IN clause with more
// than 1000 items.
- List<Resource> resources = new ArrayList(resourceIds.length);
+ List<Resource> resources = new
ArrayList<Resource>(resourceIds.length);
fromIndex = 0;
while (fromIndex < resourceIds.length) {
int toIndex = (resourceIds.length < (fromIndex + 1000)) ?
resourceIds.length : (fromIndex + 1000);
int[] resourceIdSubArray = Arrays.copyOfRange(resourceIds, fromIndex,
toIndex);
PageList<Resource> batchResources =
resourceManager.findResourceByIds(subject, resourceIdSubArray, false,
- PageControl.getUnlimitedInstance());
+ PageControl.getUnlimitedInstance());
resources.addAll(batchResources);
fromIndex = toIndex;
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/jaxb/adapter/ResourceListAdapter.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/jaxb/adapter/ResourceListAdapter.java
index c899487..964d84c 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/jaxb/adapter/ResourceListAdapter.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/jaxb/adapter/ResourceListAdapter.java
@@ -160,7 +160,7 @@ class WsResourceListWrapper extends Resource {
destination.setProductVersion(source.getProductVersion());
destination.setResourceConfiguration(source.getResourceConfiguration());
destination.setResourceConfigurationUpdates(source.getResourceConfigurationUpdates());
- destination.setSchendules(source.getSchedules());
+ destination.setSchedules(source.getSchedules());
destination.setUuid(source.getUuid());
//handle the problematic references that would cause cycles if used by storing
only ids.
if (source.getParentResource() != null) {
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/jaxb/adapter/WsResource.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/jaxb/adapter/WsResource.java
index 20d1c95..3c74f06 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/jaxb/adapter/WsResource.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/jaxb/adapter/WsResource.java
@@ -116,7 +116,7 @@ class WsResource extends Resource {
destination.setProductVersion(source.getProductVersion());
destination.setResourceConfiguration(source.getResourceConfiguration());
destination.setResourceConfigurationUpdates(source.getResourceConfigurationUpdates());
- destination.setSchendules(source.getSchedules());
+ destination.setSchedules(source.getSchedules());
destination.setUuid(source.getUuid());
//handle the problematic references that would cause cycles if used by storing
only ids.
if (source.getParentResource() != null) {
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 8a21886..fba8a68 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
@@ -74,8 +74,6 @@ public class MeasurementDefinitionManagerBean implements
MeasurementDefinitionMa
* @param def the MeasuremendDefinition to delete
*/
public void removeMeasurementDefinition(MeasurementDefinition def) {
- long now = System.currentTimeMillis();
-
// First remove the schedules and associated OOBs.
List<MeasurementSchedule> schedules = def.getSchedules();
Iterator<MeasurementSchedule> schedIter = schedules.iterator();
@@ -86,8 +84,7 @@ public class MeasurementDefinitionManagerBean implements
MeasurementDefinitionMa
sched.setBaseline(null);
}
oobManager.removeOOBsForSchedule(subjectManager.getOverlord(), sched);
- // IMPORTANT: Update the mtime to tell the Agent this Resource needs to be
synced.
- sched.getResource().setMtime(now);
+ sched.getResource().setAgentSynchronizationNeeded();
entityManager.remove(sched);
schedIter.remove();
}
@@ -134,14 +131,13 @@ public class MeasurementDefinitionManagerBean implements
MeasurementDefinitionMa
return results;
}
- @SuppressWarnings("unchecked")
public PageList<MeasurementDefinition>
findMeasurementDefinitionsByCriteria(Subject subject,
MeasurementDefinitionCriteria criteria) {
CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject,
criteria);
;
- CriteriaQueryRunner<MeasurementDefinition> queryRunner = new
CriteriaQueryRunner(criteria, generator,
- entityManager);
+ 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/measurement/MeasurementScheduleManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementScheduleManagerBean.java
index e5df592..bbc2a1d 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementScheduleManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementScheduleManagerBean.java
@@ -23,21 +23,14 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
+import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.Date;
import java.util.UUID;
-import org.quartz.Trigger;
-import org.quartz.Scheduler;
-import org.quartz.JobDetail;
-import org.quartz.JobDataMap;
-import org.quartz.SimpleTrigger;
-import org.quartz.SchedulerException;
-
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
@@ -51,6 +44,12 @@ import javax.sql.DataSource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.quartz.JobDataMap;
+import org.quartz.JobDetail;
+import org.quartz.Scheduler;
+import org.quartz.SchedulerException;
+import org.quartz.SimpleTrigger;
+import org.quartz.Trigger;
import org.jboss.annotation.IgnoreDependency;
@@ -317,13 +316,13 @@ public class MeasurementScheduleManagerBean implements
MeasurementScheduleManage
return;
}
- @RequiredPermissions( { @RequiredPermission(Permission.MANAGE_INVENTORY),
+ @RequiredPermissions({ @RequiredPermission(Permission.MANAGE_INVENTORY),
@RequiredPermission(Permission.MANAGE_SETTINGS) })
public void disableAllDefaultCollections(Subject subject) {
entityManager.createNamedQuery(MeasurementDefinition.DISABLE_ALL).executeUpdate();
}
- @RequiredPermissions( { @RequiredPermission(Permission.MANAGE_INVENTORY),
+ @RequiredPermissions({ @RequiredPermission(Permission.MANAGE_INVENTORY),
@RequiredPermission(Permission.MANAGE_SETTINGS) })
public void disableAllSchedules(Subject subject) {
entityManager.createNamedQuery(MeasurementSchedule.DISABLE_ALL).executeUpdate();
@@ -331,11 +330,10 @@ public class MeasurementScheduleManagerBean implements
MeasurementScheduleManage
}
public void createSchedulesForExistingResources(ResourceType type,
MeasurementDefinition newDefinition) {
- long now = System.currentTimeMillis();
List<Resource> resources = type.getResources();
if (resources != null) {
for (Resource res : resources) {
- res.setMtime(now); // changing MTime tells the agent this resource needs
to be synced
+ res.setAgentSynchronizationNeeded();
MeasurementSchedule sched = new MeasurementSchedule(newDefinition, res);
sched.setInterval(newDefinition.getDefaultInterval());
entityManager.persist(sched);
@@ -648,16 +646,10 @@ public class MeasurementScheduleManagerBean implements
MeasurementScheduleManage
final String randomSuffix = UUID.randomUUID().toString();
final String jobName = DEFAULT_AGENT_JOB + " - " + randomSuffix;
- JobDetail jobDetail = new JobDetail(
- jobName,
- DEFAULT_AGENT_GROUP,
- NotifyAgentsOfScheduleUpdatesJob.class);
+ JobDetail jobDetail = new JobDetail(jobName, DEFAULT_AGENT_GROUP,
NotifyAgentsOfScheduleUpdatesJob.class);
final String triggerName = DEFAULT_AGENT_TRIGGER + " - " +
randomSuffix;
- SimpleTrigger simpleTrigger = new SimpleTrigger(
- triggerName,
- DEFAULT_AGENT_GROUP,
- new Date());
+ SimpleTrigger simpleTrigger = new SimpleTrigger(triggerName,
DEFAULT_AGENT_GROUP, new Date());
JobDataMap jobDataMap = simpleTrigger.getJobDataMap();
jobDataMap.put(TRIGGER_NAME, triggerName);
@@ -1235,8 +1227,8 @@ public class MeasurementScheduleManagerBean implements
MeasurementScheduleManage
// first get all the resources, which is needed to get the agent mappings
Subject overlord = subjectManager.getOverlord();
- PageList<Resource> resources = resourceManager.findResourceByIds(overlord,
resourceIds, false, PageControl
- .getUnlimitedInstance());
+ PageList<Resource> resources = resourceManager.findResourceByIds(overlord,
resourceIds, false,
+ PageControl.getUnlimitedInstance());
// then get all the requests
Set<ResourceMeasurementScheduleRequest> requests =
findSchedulesForResourceAndItsDescendants(resourceIds, false);
@@ -1482,8 +1474,8 @@ public class MeasurementScheduleManagerBean implements
MeasurementScheduleManage
CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject,
criteria);
;
if (authorizationManager.isInventoryManager(subject) == false) {
-
generator.setAuthorizationResourceFragment(CriteriaQueryGenerator.AuthorizationTokenType.RESOURCE,
subject
- .getId());
+
generator.setAuthorizationResourceFragment(CriteriaQueryGenerator.AuthorizationTokenType.RESOURCE,
+ subject.getId());
}
CriteriaQueryRunner<MeasurementSchedule> queryRunner = new
CriteriaQueryRunner(criteria, generator,
@@ -1522,4 +1514,3 @@ public class MeasurementScheduleManagerBean implements
MeasurementScheduleManage
// }
}
-
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
index 4cbc3d1..fcc6638 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
@@ -238,8 +238,7 @@ public class ResourceManagerBean implements ResourceManagerLocal,
ResourceManage
persistedResource.setLocation(resource.getLocation());
persistedResource.setDescription(resource.getDescription());
- // NOTE: Updating the mtime will tell the Agent it needs to sync this Resource.
- persistedResource.setMtime(System.currentTimeMillis());
+ persistedResource.setAgentSynchronizationNeeded();
persistedResource.setModifiedBy(user.getName());
return entityManager.merge(persistedResource);
@@ -614,7 +613,7 @@ public class ResourceManagerBean implements ResourceManagerLocal,
ResourceManage
private void updateInventoryStatus(Resource resource, InventoryStatus newStatus, long
now) {
resource.setInventoryStatus(newStatus);
resource.setItime(now);
- resource.setMtime(now);
+ resource.setAgentSynchronizationNeeded();
}
@SuppressWarnings("unchecked")
@@ -757,8 +756,8 @@ public class ResourceManagerBean implements ResourceManagerLocal,
ResourceManage
// Build up a list of composite Resources for the ancestry that includes which
ancestors, if any, should be
// locked from view.
boolean isInventoryManager = authorizationManager.isInventoryManager(subject);
- List<ResourceLineageComposite> resourceLineage = new
ArrayList<ResourceLineageComposite>(rawResourceLineage
- .size());
+ List<ResourceLineageComposite> resourceLineage = new
ArrayList<ResourceLineageComposite>(
+ rawResourceLineage.size());
for (Resource resource : rawResourceLineage) {
boolean isLocked = !(isInventoryManager ||
authorizationManager.canViewResource(subject, resource.getId()));
ResourceLineageComposite composite = new ResourceLineageComposite(resource,
isLocked);
@@ -776,8 +775,8 @@ public class ResourceManagerBean implements ResourceManagerLocal,
ResourceManage
// If the ancestor is not locked, include viewable children.
if (!ancestor.isLocked() || ancestor.getResource() == parent) {
// Get all viewable committed children.
- PageList<Resource> children =
findChildResourcesByCategoryAndInventoryStatus(subject, ancestor
- .getResource(), null, InventoryStatus.COMMITTED,
PageControl.getUnlimitedInstance());
+ PageList<Resource> children =
findChildResourcesByCategoryAndInventoryStatus(subject,
+ ancestor.getResource(), null, InventoryStatus.COMMITTED,
PageControl.getUnlimitedInstance());
// Remove any that are in the lineage to avoid repeated handling.
children.removeAll(rawResourceLineage);
for (Resource child : children) {
@@ -1384,7 +1383,7 @@ public class ResourceManagerBean implements ResourceManagerLocal,
ResourceManage
return result;
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({ "unchecked", "rawtypes" })
public List<AutoGroupComposite> findResourcesAutoGroups(Subject subject, int[]
resourceIds) {
List<AutoGroupComposite> results = new
ArrayList<AutoGroupComposite>();
List<Integer> ids = ArrayUtils.wrapInList(resourceIds);
@@ -1484,6 +1483,7 @@ public class ResourceManagerBean implements ResourceManagerLocal,
ResourceManage
query.setParameter("inventoryStatus", InventoryStatus.COMMITTED);
List<Object[]> objs = query.getResultList();
+ @SuppressWarnings("rawtypes")
List results = new ArrayList<ResourceWithAvailability>(objs.size());
for (Object[] ob : objs) {
Resource r = (Resource) ob[0];
@@ -1814,7 +1814,7 @@ public class ResourceManagerBean implements ResourceManagerLocal,
ResourceManage
List<Resource> resources = query.getResultList();
- return new PageList(resources, (int) count, pageControl);
+ return new PageList<Resource>(resources, (int) count, pageControl);
}
@SuppressWarnings("unchecked")
@@ -1847,7 +1847,7 @@ public class ResourceManagerBean implements ResourceManagerLocal,
ResourceManage
List<Resource> resources = query.getResultList();
- return new PageList(resources, (int) count, pageControl);
+ return new PageList<Resource>(resources, (int) count, pageControl);
}
@SuppressWarnings("unchecked")
@@ -1890,7 +1890,7 @@ public class ResourceManagerBean implements ResourceManagerLocal,
ResourceManage
List<Resource> resources = query.getResultList();
- return new PageList(resources, (int) count, pageControl);
+ return new PageList<Resource>(resources, (int) count, pageControl);
}
@SuppressWarnings("unchecked")
@@ -2396,7 +2396,6 @@ public class ResourceManagerBean implements ResourceManagerLocal,
ResourceManage
return results;
}
- @SuppressWarnings("unchecked")
public PageList<ResourceComposite> findResourceCompositesByCriteria(Subject
subject, ResourceCriteria criteria) {
boolean isInventoryManager = authorizationManager.isInventoryManager(subject);
@@ -2440,8 +2439,8 @@ public class ResourceManagerBean implements ResourceManagerLocal,
ResourceManage
subject.getId());
}
- CriteriaQueryRunner<ResourceComposite> queryRunner = new
CriteriaQueryRunner(criteria, generator,
- entityManager, false); // don't auto-init bags, we're returning
composites not entities
+ CriteriaQueryRunner<ResourceComposite> queryRunner = new
CriteriaQueryRunner<ResourceComposite>(criteria,
+ generator, entityManager, false); // don't auto-init bags, we're
returning composites not entities
PageList<ResourceComposite> results = queryRunner.execute();
for (ResourceComposite nextComposite : results) {
@@ -2456,7 +2455,6 @@ public class ResourceManagerBean implements ResourceManagerLocal,
ResourceManage
return results;
}
- @SuppressWarnings("unchecked")
public PageList<Resource> findResourcesByCriteria(Subject subject,
ResourceCriteria criteria) {
CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject,
criteria);
@@ -2470,7 +2468,8 @@ public class ResourceManagerBean implements ResourceManagerLocal,
ResourceManage
subject.getId());
}
- CriteriaQueryRunner<Resource> queryRunner = new
CriteriaQueryRunner(criteria, generator, entityManager);
+ CriteriaQueryRunner<Resource> queryRunner = new
CriteriaQueryRunner<Resource>(criteria, generator,
+ entityManager);
PageList<Resource> results = queryRunner.execute();
return results;
}
@@ -2521,8 +2520,8 @@ public class ResourceManagerBean implements ResourceManagerLocal,
ResourceManage
public <T> List<DisambiguationReport<T>> disambiguate(List<T>
results, IntExtractor<? super T> extractor,
DisambiguationUpdateStrategy updateStrategy) {
- return Disambiguator.disambiguate(results, updateStrategy, extractor,
entityManager, typeManager
- .getDuplicateTypeNames());
+ return Disambiguator.disambiguate(results, updateStrategy, extractor,
entityManager,
+ typeManager.getDuplicateTypeNames());
}
public void updateAncestry(Subject subject, int resourceId) {
@@ -2545,13 +2544,13 @@ public class ResourceManagerBean implements ResourceManagerLocal,
ResourceManage
@SuppressWarnings("unchecked")
public List<Integer> findIdsByTypeIds(List<Integer> resourceTypeIds) {
- return
entityManager.createNamedQuery(Resource.QUERY_FIND_IDS_BY_TYPE_IDS).setParameter("resourceTypeIds",
- resourceTypeIds).getResultList();
+ return entityManager.createNamedQuery(Resource.QUERY_FIND_IDS_BY_TYPE_IDS)
+ .setParameter("resourceTypeIds", resourceTypeIds).getResultList();
}
@Override
public Integer getResourceCount(List<Integer> resourceTypeIds) {
- return (Integer)
entityManager.createNamedQuery(Resource.QUERY_FIND_COUNT_BY_TYPES).setParameter(
- "resourceTypeIds", resourceTypeIds).getSingleResult();
+ return (Integer)
entityManager.createNamedQuery(Resource.QUERY_FIND_COUNT_BY_TYPES)
+ .setParameter("resourceTypeIds",
resourceTypeIds).getSingleResult();
}
}
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerBean.java
index 3963f9d..841fe03 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerBean.java
@@ -1,6 +1,5 @@
package org.rhq.enterprise.server.resource.metadata;
-import java.util.Date;
import java.util.List;
import javax.ejb.EJB;
@@ -58,8 +57,8 @@ public class PluginConfigurationMetadataManagerBean implements
PluginConfigurati
// all new
if (existingConfigurationDefinition == null) {
if (log.isDebugEnabled()) {
- log.debug(existingType + " currently does not have a plugin
configuration definition. Adding " +
- "new plugin configuration.");
+ log.debug(existingType + " currently does not have a plugin
configuration definition. Adding "
+ + "new plugin configuration.");
}
entityMgr.persist(newType.getPluginConfigurationDefinition());
existingType.setPluginConfigurationDefinition(newType.getPluginConfigurationDefinition());
@@ -72,8 +71,8 @@ public class PluginConfigurationMetadataManagerBean implements
PluginConfigurati
.updateConfigurationDefinition(newType.getPluginConfigurationDefinition(),
existingConfigurationDefinition);
- if (updateReport.getNewPropertyDefinitions().size() > 0 ||
- updateReport.getUpdatedPropertyDefinitions().size() > 0) {
+ if (updateReport.getNewPropertyDefinitions().size() > 0
+ || updateReport.getUpdatedPropertyDefinitions().size() > 0) {
Subject overlord = subjectMgr.getOverlord();
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterResourceTypeId(existingType.getId());
@@ -99,6 +98,7 @@ public class PluginConfigurationMetadataManagerBean implements
PluginConfigurati
private void updateResourcePluginConfiguration(Resource resource,
ConfigurationDefinitionUpdateReport updateReport) {
Configuration pluginConfiguration = resource.getPluginConfiguration();
boolean modified = false;
+ @SuppressWarnings("unused")
int numberOfProperties = pluginConfiguration.getProperties().size();
ConfigurationTemplate template =
updateReport.getConfigurationDefinition().getDefaultTemplate();
Configuration templateConfiguration = template.getConfiguration();
@@ -106,10 +106,10 @@ public class PluginConfigurationMetadataManagerBean implements
PluginConfigurati
for (PropertyDefinition propertyDef : updateReport.getNewPropertyDefinitions())
{
if (propertyDef.isRequired()) {
Property templateProperty =
templateConfiguration.get(propertyDef.getName());
- if (templateProperty==null) {
+ if (templateProperty == null) {
throw new IllegalArgumentException("The property [" +
propertyDef.getName()
- + "] marked as required in the configuration definition
of [" + propertyDef.getConfigurationDefinition().getName()
- + "] has no attribute 'default'");
+ + "] marked as required in the configuration definition of
["
+ + propertyDef.getConfigurationDefinition().getName() + "]
has no attribute 'default'");
} else {
pluginConfiguration.put(templateProperty.deepCopy(false));
modified = true;
@@ -129,7 +129,7 @@ public class PluginConfigurationMetadataManagerBean implements
PluginConfigurati
}
if (modified) {
- resource.setMtime(new Date().getTime());
+ resource.setAgentSynchronizationNeeded();
}
}
}
commit e80294f5775b38e4e99c242aef4cbfcc01fd2c45
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Jan 31 13:15:04 2012 -0500
Add a demarcation comment for JON 3.0.1
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index f005ff0..7dd68d4 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -3828,6 +3828,8 @@
</schema-directSQL>
</schemaSpec>
+<!-- JON 3.0.1 RELEASE uses DB Schema 2.118 -->
+
</dbupgrade>
</target>
</project>
commit b7faba1d8d376f32407fa306db7c0a5df4d63585
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Dec 15 13:16:59 2011 -0500
Supporting check-in for [Bug 768031 - Pin template failure on upgraded dbs]
- Fix a long standing issue in dbupgrade due to Oracle throwing exceptions
when trying to set nullable to the current value. In other words, the
upgrade would fail on oracle if you tried to set nullable false on a
column that was already nullable false. (same for nullable true). This
caused issues when you can't guarantee the current state, you just know
what you need it to be. Now, catch the relevant exceptions and toss
them as needed.
diff --git a/modules/core/dbutils/src/main/java/org/rhq/core/db/OracleDatabaseType.java
b/modules/core/dbutils/src/main/java/org/rhq/core/db/OracleDatabaseType.java
index afd9ed9..ad038b0 100644
--- a/modules/core/dbutils/src/main/java/org/rhq/core/db/OracleDatabaseType.java
+++ b/modules/core/dbutils/src/main/java/org/rhq/core/db/OracleDatabaseType.java
@@ -25,6 +25,8 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
+import mazz.i18n.Logger;
+
/**
* Superclass of all versions of the Oracle database.
*
@@ -32,6 +34,8 @@ import java.util.List;
*
*/
public abstract class OracleDatabaseType extends DatabaseType {
+ private static final Logger LOG =
DbUtilsI18NFactory.getLogger(OracleDatabaseType.class);
+
/**
* The vendor name for all Oracle databases.
*/
@@ -156,7 +160,24 @@ public abstract class OracleDatabaseType extends DatabaseType {
sql += ")";
- executeSql(conn, sql);
+ try {
+ executeSql(conn, sql);
+ } catch (SQLException e) {
+ // Oracle throws an exception if you try to set nullable to its current
setting. Ignore errors
+ // generated when a nullable setting is already the way we want it to be.
+ // ORA-01442: column to be modified to NOT NULL is already NOT NULL
+ // ORA-01451: column to be modified to NULL cannot be modified to NULL
+ if (nullable != null) {
+ String msg = e.getMessage();
+ if (msg.contains("ORA-01442") ||
msg.contains("ORA-01451")) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Ignoring exception, column already set to
nullable=" + nullable, e);
+ }
+ } else {
+ throw e;
+ }
+ }
+ }
if ((reindex != null) && reindex.booleanValue()) {
reindexTable(conn, table);
commit 8667a4c591e4ef6f803d0b485e3e7cfda76f3440
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Dec 15 13:18:32 2011 -0500
[Bug 768031 - Pin template failure on upgraded dbs]
Set RHQ_DRIFT_CHANGE_SET.DRIFT_DEFINITION_ID nullable in the db upgrade.
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index b77d98a..f005ff0 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -3813,7 +3813,10 @@
<schemaSpec version="2.117">
<!-- Remove an obsolete drift table that may be hanging around -->
- <schema-dropTable table="RHQ_DRIFT_TEMPLATE_MAP" />
+ <schema-dropTable table="RHQ_DRIFT_TEMPLATE_MAP" />
+
+ <!-- Remove an unwanted null consraint -->
+ <schema-alterColumn table="RHQ_DRIFT_CHANGE_SET"
column="DRIFT_DEFINITION_ID" nullable="TRUE" />
</schemaSpec>
<schemaSpec version="2.118">
commit 8b8ce32cf7bc2ab04c28d9717911007878ba895a
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Jan 9 15:45:21 2012 -0500
[Bug 772742 - DB upgrade gives "All Resources Role" an unintended
permission]
Fix the upgrade step that grants the bad permission. And add a new
step to revoke it if it exists.
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index f08d22d..f58d07d 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -15,7 +15,7 @@
<description>Database schema setup, upgrade and other
utilities</description>
<properties>
- <db.schema.version>2.117</db.schema.version>
+ <db.schema.version>2.118</db.schema.version>
<rhq.ds.type-mapping>${rhq.test.ds.type-mapping}</rhq.ds.type-mapping>
<rhq.ds.db-name>${rhq.test.ds.db-name}</rhq.ds.db-name>
<rhq.ds.connection-url>${rhq.test.ds.connection-url}</rhq.ds.connection-url>
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index c690317..b77d98a 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -3370,12 +3370,12 @@
</statement>
</schema-directSQL>
- <!-- Now add modify the permissions to give all the roles with
MANAGE_INVENTORY
- the new MANAGE_REPOSITORIES privilege so that people's privs remain
unchanged. -->
+ <!-- Now modify the permissions to give all the roles with
MANAGE_INVENTORY, except for
+ all-resources-role, the new MANAGE_REPOSITORIES privilege so that privs
remain unchanged. -->
<schema-directSQL>
<statement>
INSERT INTO RHQ_PERMISSION (role_id, operation)
- SELECT role_id, 15 FROM RHQ_PERMISSION WHERE operation = 1
+ SELECT role_id, 15 FROM RHQ_PERMISSION WHERE operation = 1
AND NOT role_id = 2
</statement>
</schema-directSQL>
</schemaSpec>
@@ -3815,6 +3815,15 @@
<!-- Remove an obsolete drift table that may be hanging around -->
<schema-dropTable table="RHQ_DRIFT_TEMPLATE_MAP" />
</schemaSpec>
+
+ <schemaSpec version="2.118">
+ <!-- Correct an earlier upgrade issue where 'All Resources
Role' was granted MANAGE_REPOSITORIES. -->
+ <schema-directSQL>
+ <statement>
+ DELETE FROM RHQ_PERMISSION WHERE role_id = 2 AND operation = 15
+ </statement>
+ </schema-directSQL>
+ </schemaSpec>
</dbupgrade>
</target>
commit fb7177edccdd59a8f33cdc1253d6d02428ea51b5
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Jan 31 12:21:44 2012 -0500
Add 2.117 to remove an obsolete drift table that may exist after upgrades.
Conflicts:
modules/core/dbutils/pom.xml
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index b298636..f08d22d 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -14,14 +14,8 @@
<name>RHQ Database Utilities</name>
<description>Database schema setup, upgrade and other
utilities</description>
- <scm>
-
<
connection>scm:git:ssh://git.fedorahosted.org/git/rhq.git/modules/core...
-
<
developerConnection>scm:git:ssh://git.fedorahosted.org/git/rhq.git/mod...
- </scm>
-
<properties>
- <scm.module.path>modules/core/dbutils/</scm.module.path>
- <db.schema.version>2.116</db.schema.version>
+ <db.schema.version>2.117</db.schema.version>
<rhq.ds.type-mapping>${rhq.test.ds.type-mapping}</rhq.ds.type-mapping>
<rhq.ds.db-name>${rhq.test.ds.db-name}</rhq.ds.db-name>
<rhq.ds.connection-url>${rhq.test.ds.connection-url}</rhq.ds.connection-url>
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index fb2ed85..c690317 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -3809,6 +3809,13 @@
<schema-alterColumn table="RHQ_PRD_VER"
column="VERSION" columnType="VARCHAR2" precision="100"
/>
</schemaSpec>
+<!-- JON 3.0 RELEASE uses DB Schema 2.116 -->
+
+ <schemaSpec version="2.117">
+ <!-- Remove an obsolete drift table that may be hanging around -->
+ <schema-dropTable table="RHQ_DRIFT_TEMPLATE_MAP" />
+ </schemaSpec>
+
</dbupgrade>
</target>
</project>
commit 22da9591737868d71ccc70474fe3701434ec8385
Merge: 371ed2f f808b1f
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Mon Jan 30 22:27:20 2012 -0500
Merge branch 'release/jon3.0.x' of
ssh://git.fedorahosted.org/git/rhq/rhq into
release/jon3.0.x
commit 371ed2faefd38ca58d514bb95793978de4a4fa46
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Mon Jan 30 22:25:35 2012 -0500
[BZ 785026] if log file event sources are enabled, but SIGAR is disabled or
unavailable, log a warning, rather than
silently failing (
https://bugzilla.redhat.com/show_bug.cgi?id=785026)
diff --git
a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/EventContext.java
b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/EventContext.java
index f9bb654..8651272 100644
---
a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/EventContext.java
+++
b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/EventContext.java
@@ -22,6 +22,7 @@
*/
package org.rhq.core.pluginapi.event;
+import com.sun.istack.Nullable;
import org.hyperic.sigar.SigarProxy;
import org.jetbrains.annotations.NotNull;
@@ -90,10 +91,10 @@ public interface EventContext {
/**
* Gets an instance of Sigar. Plugins that need to use Sigar, should use this method
to get an instance, rather than
- * instantiating Sigar themselves.
+ * instantiating Sigar themselves. Returns null if the native layer is unavailable or
has been disabled.
*
- * @return an instance of Sigar
+ * @return an instance of Sigar, or null if the native layer is unavailable or has
been disabled
*/
- @NotNull
+ @Nullable
SigarProxy getSigar();
}
diff --git
a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventPoller.java
b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventPoller.java
index d936522..bcc42de 100644
---
a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventPoller.java
+++
b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventPoller.java
@@ -1,6 +1,6 @@
- /*
+/*
* RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
+ * Copyright (C) 2005-2012 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -55,13 +55,17 @@ public class LogFileEventPoller implements EventPoller {
private LogEntryProcessor entryProcessor;
public LogFileEventPoller(EventContext eventContext, String eventType, File logFile,
LogEntryProcessor entryProcessor) {
+ SigarProxy sigar = eventContext.getSigar();
this.eventType = eventType;
this.logFile = logFile;
- SigarProxy sigar = eventContext.getSigar();
- try {
- this.logFileInfo = new LogFileInfo(sigar.getFileInfo(logFile.getPath()));
- } catch (SigarException e) {
- throw new RuntimeException(e);
+ if (sigar != null) {
+ try {
+ this.logFileInfo = new
LogFileInfo(sigar.getFileInfo(logFile.getPath()));
+ } catch (SigarException e) {
+ throw new RuntimeException("Failed to obtain file info for log file
[" + this.logFile + "].", e);
+ }
+ } else {
+ log.warn("SIGAR is unavailable - cannot poll log file [" +
this.logFile + "] for events.");
}
this.entryProcessor = entryProcessor;
}
@@ -78,12 +82,15 @@ public class LogFileEventPoller implements EventPoller {
@Nullable
public Set<Event> poll() {
+ if (this.logFileInfo == null) {
+ return null;
+ }
if (!this.logFile.exists()) {
- log.warn("Log file [" + this.logFile + "' being polled
does not exist.");
+ log.warn("Log file [" + this.logFile + "] being polled does
not exist.");
return null;
}
if (this.logFile.isDirectory()) {
- log.error("Log file [" + this.logFile + "' being polled is
a directory, not a regular file.");
+ log.error("Log file [" + this.logFile + "] being polled is a
directory, not a regular file.");
return null;
}
try {
diff --git
a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventResourceComponentHelper.java
b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventResourceComponentHelper.java
index 962764a..d134638 100644
---
a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventResourceComponentHelper.java
+++
b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventResourceComponentHelper.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
+ * Copyright (C) 2005-2012 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -21,6 +21,9 @@ package org.rhq.core.pluginapi.event.log;
import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
@@ -32,10 +35,12 @@ import org.rhq.core.domain.configuration.Property;
import org.rhq.core.domain.configuration.PropertyList;
import org.rhq.core.domain.configuration.PropertyMap;
import org.rhq.core.domain.event.EventSeverity;
+import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.pluginapi.event.EventContext;
import org.rhq.core.pluginapi.event.EventPoller;
import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.core.system.SystemInfoFactory;
/**
* @author Ian Springer
@@ -47,83 +52,132 @@ public class LogFileEventResourceComponentHelper {
public static final String LOG_EVENT_SOURCE_CONFIG_PROP =
"logEventSource";
public abstract static class LogEventSourcePropertyNames {
- public static final String LOG_FILE_PATH = "logFilePath";
- public static final String ENABLED = "enabled";
- public static final String DATE_FORMAT = "dateFormat";
- public static final String INCLUDES_PATTERN = "includesPattern";
- public static final String MINIMUM_SEVERITY = "minimumSeverity";
+ public static final String LOG_FILE_PATH = "logFilePath"; //
required
+ public static final String ENABLED = "enabled"; //
required
+ public static final String DATE_FORMAT = "dateFormat"; //
optional
+ public static final String INCLUDES_PATTERN = "includesPattern"; //
optional
+ public static final String MINIMUM_SEVERITY = "minimumSeverity"; //
optional
}
+ // TODO: Make this configurable via a plugin config prop.
+ private static final int POLLING_INTERVAL_IN_SECONDS = 60;
+
private final Log log = LogFactory.getLog(this.getClass());
private ResourceContext<?> resourceContext;
+ private List<PropertyMap> startedEventSources = new
ArrayList<PropertyMap>();
public LogFileEventResourceComponentHelper(ResourceContext<?> resourceContext)
{
this.resourceContext = resourceContext;
}
public void startLogFileEventPollers() {
+ // Grab the list-o-maps of event sources from the plugin config.
Configuration pluginConfig = this.resourceContext.getPluginConfiguration();
PropertyList logEventSources =
pluginConfig.getList(LOG_EVENT_SOURCES_CONFIG_PROP);
+
+ // Build a new list containing the event sources that are enabled.
+ List<PropertyMap> enabledEventSources = new
ArrayList<PropertyMap>();
for (Property prop : logEventSources.getList()) {
PropertyMap logEventSource = (PropertyMap) prop;
- Boolean enabled =
Boolean.valueOf(logEventSource.getSimpleValue(LogEventSourcePropertyNames.ENABLED,
null));
- if (enabled) {
- String logFilePathname =
logEventSource.getSimpleValue(LogEventSourcePropertyNames.LOG_FILE_PATH, null);
- if (logFilePathname == null) {
- log.info("LOGFILE: No logfile path given, can not watch this
event log.");
- return;
- }
- File logFile = new File(logFilePathname);
- if (!logFile.exists() || !logFile.canRead()) {
- log.error("LOGFILE: Logfile at location " +
logFilePathname
- + " does not exist or is not readable. Can not start
watching the event log.");
- return;
- }
+ String enabled =
logEventSource.getSimpleValue(LogEventSourcePropertyNames.ENABLED, null);
+ if (enabled == null) {
+ throw new IllegalStateException("Required property [" +
LogEventSourcePropertyNames.ENABLED
+ + "] is not defined in map.");
+ }
+ if (Boolean.valueOf(enabled)) {
+ enabledEventSources.add(logEventSource);
+ }
+ }
- Log4JLogEntryProcessor processor = new
Log4JLogEntryProcessor(LOG_ENTRY_EVENT_TYPE, logFile);
- String dateFormatString =
logEventSource.getSimpleValue(LogEventSourcePropertyNames.DATE_FORMAT, null);
- if (dateFormatString != null) {
- try {
- DateFormat dateFormat = new SimpleDateFormat(dateFormatString);
// TODO locale specific ?
- processor.setDateFormat(dateFormat);
- } catch (IllegalArgumentException e) {
- throw new InvalidPluginConfigurationException("Date format
[" + dateFormatString
- + "] is not a valid simple date format.");
- }
- }
- String includesPatternString = logEventSource.getSimpleValue(
- LogEventSourcePropertyNames.INCLUDES_PATTERN, null);
- if (includesPatternString != null) {
- try {
- Pattern includesPattern =
Pattern.compile(includesPatternString);
- processor.setIncludesPattern(includesPattern);
- } catch (PatternSyntaxException e) {
- throw new InvalidPluginConfigurationException("Includes
pattern [" + includesPatternString
- + "] is not a valid regular expression.");
- }
+ // Log a warning then return if SIGAR isn't available, since
LogFileEventPoller depends on it. We only log this
+ // warning if at least one event source is enabled, since otherwise the user
probably doesn't care.
+ boolean sigarAvailable = this.resourceContext.getSystemInformation().isNative();
+ if (!sigarAvailable && !enabledEventSources.isEmpty()) {
+ boolean nativeSystemInfoDisabled =
SystemInfoFactory.isNativeSystemInfoDisabled();
+ ResourceType resourceType = this.resourceContext.getResourceType();
+ List<String> logFilePaths = getLogFilePaths(enabledEventSources);
+ log.warn("Log files " + logFilePaths + " for [" +
resourceType.getPlugin() + ":"
+ + resourceType.getName() + "] Resource with key [" +
this.resourceContext.getResourceKey()
+ + "] cannot be polled, because log file polling requires RHQ native
support, which "
+ + ((nativeSystemInfoDisabled) ? "has been disabled for this
Agent" : "is not available on this platform") + ".");
+ return;
+ }
+
+ // Start up log file pollers for each of the enabled event sources.
+ for (PropertyMap logEventSource : enabledEventSources) {
+ String logFilePath =
logEventSource.getSimpleValue(LogEventSourcePropertyNames.LOG_FILE_PATH, null);
+ if (logFilePath == null) {
+ throw new IllegalStateException("Required property [" +
LogEventSourcePropertyNames.LOG_FILE_PATH
+ + "] is not defined in map.");
+ }
+ File logFile = new File(logFilePath);
+ if (!logFile.canRead()) {
+ log.error("LOGFILE: Logfile at location " + logFilePath
+ + " does not exist or is not readable. Can not start watching
the event log.");
+ continue;
+ }
+
+ Log4JLogEntryProcessor processor = new
Log4JLogEntryProcessor(LOG_ENTRY_EVENT_TYPE, logFile);
+ String dateFormatString =
logEventSource.getSimpleValue(LogEventSourcePropertyNames.DATE_FORMAT, null);
+ if (dateFormatString != null) {
+ try {
+ DateFormat dateFormat = new SimpleDateFormat(dateFormatString); //
TODO locale specific ?
+ processor.setDateFormat(dateFormat);
+ } catch (IllegalArgumentException e) {
+ throw new InvalidPluginConfigurationException("Date format
[" + dateFormatString
+ + "] is not a valid simple date format.");
}
- String minimumSeverityString = logEventSource.getSimpleValue(
- LogEventSourcePropertyNames.MINIMUM_SEVERITY, null);
- if (minimumSeverityString != null) {
- EventSeverity minimumSeverity =
EventSeverity.valueOf(minimumSeverityString.toUpperCase());
- processor.setMinimumSeverity(minimumSeverity);
+ }
+ String includesPatternString = logEventSource.getSimpleValue(
+ LogEventSourcePropertyNames.INCLUDES_PATTERN, null);
+ if (includesPatternString != null) {
+ try {
+ Pattern includesPattern = Pattern.compile(includesPatternString);
+ processor.setIncludesPattern(includesPattern);
+ } catch (PatternSyntaxException e) {
+ throw new InvalidPluginConfigurationException("Includes pattern
[" + includesPatternString
+ + "] is not a valid regular expression.");
}
- EventContext eventContext = this.resourceContext.getEventContext();
- EventPoller poller = new LogFileEventPoller(eventContext,
LOG_ENTRY_EVENT_TYPE, logFile, processor);
- eventContext.registerEventPoller(poller, 60, logFile.getPath());
}
+ String minimumSeverityString = logEventSource.getSimpleValue(
+ LogEventSourcePropertyNames.MINIMUM_SEVERITY, null);
+ if (minimumSeverityString != null) {
+ EventSeverity minimumSeverity =
EventSeverity.valueOf(minimumSeverityString.toUpperCase());
+ processor.setMinimumSeverity(minimumSeverity);
+ }
+ EventContext eventContext = this.resourceContext.getEventContext();
+ EventPoller poller = new LogFileEventPoller(eventContext,
LOG_ENTRY_EVENT_TYPE, logFile, processor);
+ eventContext.registerEventPoller(poller, POLLING_INTERVAL_IN_SECONDS,
logFile.getPath());
+ this.startedEventSources.add(logEventSource);
}
}
public void stopLogFileEventPollers() {
- Configuration pluginConfig = this.resourceContext.getPluginConfiguration();
- PropertyList logEventSources =
pluginConfig.getList(LOG_EVENT_SOURCES_CONFIG_PROP);
- for (Property prop : logEventSources.getList()) {
- PropertyMap logEventSource = (PropertyMap) prop;
- String logFilePath =
logEventSource.getSimpleValue(LogEventSourcePropertyNames.LOG_FILE_PATH, null);
+ boolean sigarAvailable = this.resourceContext.getSystemInformation().isNative();
+ if (!sigarAvailable) {
+ return;
+ }
+
+ for (Iterator<PropertyMap> iterator = this.startedEventSources.iterator();
iterator.hasNext(); ) {
+ PropertyMap logEventSource = iterator.next();
EventContext eventContext = this.resourceContext.getEventContext();
+ String logFilePath =
logEventSource.getSimpleValue(LogEventSourcePropertyNames.LOG_FILE_PATH, null);
eventContext.unregisterEventPoller(LOG_ENTRY_EVENT_TYPE, logFilePath);
+ iterator.remove();
+ }
+ }
+
+ private List<String> getLogFilePaths(List<PropertyMap>
enabledEventSources) {
+ List<String> logFilePaths = new
ArrayList<String>(enabledEventSources.size());
+ for (PropertyMap logEventSource : enabledEventSources) {
+ String logFilePath =
logEventSource.getSimpleValue(LogEventSourcePropertyNames.LOG_FILE_PATH, null);
+ if (logFilePath == null) {
+ throw new IllegalStateException("Required property [" +
LogEventSourcePropertyNames.LOG_FILE_PATH
+ + "] is not defined in map.");
+ }
+ logFilePaths.add(logFilePath);
}
+ return logFilePaths;
}
}
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventContextImpl.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventContextImpl.java
index b0b37ec..1735aff 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventContextImpl.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventContextImpl.java
@@ -24,6 +24,7 @@ package org.rhq.core.pc.event;
import org.hyperic.sigar.SigarProxy;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import org.rhq.core.domain.event.Event;
import org.rhq.core.domain.event.EventDefinition;
import org.rhq.core.domain.resource.Resource;
@@ -99,7 +100,7 @@ public class EventContextImpl implements EventContext {
unregisterEventPollerInternal(eventType, sourceLocation);
}
- @NotNull
+ @Nullable
public SigarProxy getSigar() {
return getEventManager().getSigar();
}
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventManager.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventManager.java
index 4ad5c50..87b9bd7 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventManager.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventManager.java
@@ -34,6 +34,7 @@ import org.apache.commons.logging.LogFactory;
import org.hyperic.sigar.SigarProxy;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import org.rhq.core.domain.event.Event;
import org.rhq.core.domain.event.EventDefinition;
import org.rhq.core.domain.event.EventSource;
@@ -44,6 +45,7 @@ import org.rhq.core.pc.PluginContainerConfiguration;
import org.rhq.core.pc.util.LoggingThreadFactory;
import org.rhq.core.pluginapi.event.EventPoller;
import org.rhq.core.system.SigarAccess;
+import org.rhq.core.system.SystemInfoException;
/**
* Manager for the Plugin Container's Event subsystem.
@@ -113,9 +115,12 @@ public class EventManager implements ContainerService {
}
}
+ @Nullable
SigarProxy getSigar() {
if (this.sigar == null) {
- this.sigar = SigarAccess.getSigar();
+ if (SigarAccess.isSigarAvailable()) {
+ this.sigar = SigarAccess.getSigar();
+ }
}
return this.sigar;
}
commit f808b1f8c4837661862825538dd497afc1b671be
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Thu Jan 26 17:37:21 2012 -0500
BZ[784873] fixing issue displaying LDAP registration screen with clean browser
cache.
i)Can't count on CoreGUI to be loaded in this case as the user may not
have logged in before.
ii)Some refactoring to embed asynchronous call.
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java
index 74d11e3..50c87a4 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java
@@ -103,6 +103,7 @@ public class LoginView extends LocatableCanvas {
private static final String DEPARTMENT = "department";
private static final String SESSIONID = "ldap.sessionid";
static final String PASSWORD = "ldap.password";
+ private ProductInfo productInfo;
public void showLoginDialog(String message) {
showLoginDialog();
@@ -206,195 +207,232 @@ public class LoginView extends LocatableCanvas {
if (!loginShowing) {
loginShowing = true;
- ProductInfo productInfo = CoreGUI.get().getProductInfo();
-
- int fieldWidth = 120;
-
- LocatableVLayout column = new
LocatableVLayout(extendLocatorId("NewLdapRegistration"));
- column.setMargin(25);
- HeaderItem header = new HeaderItem();
- header.setValue(MSG.view_login_welcomeMsg(productInfo.getName()));
- header.setWidth("100%");
- //build ui elements for registration screen
- first = new TextItem(FIRST, MSG.dataSource_users_field_firstName());
- {
- first.setRequired(true);
- first.setWrapTitle(false);
- first.setWidth(fieldWidth);
- }
- last = new TextItem(LAST, MSG.dataSource_users_field_lastName());
- {
- last.setWrapTitle(false);
- last.setWidth(fieldWidth);
- last.setRequired(true);
- }
- final TextItem username = new TextItem(USERNAME,
MSG.dataSource_users_field_name());
- {
- username.setValue(user);
- username.setDisabled(true);
- username.setWidth(fieldWidth);
- }
- email = new TextItem(EMAIL, MSG.dataSource_users_field_emailAddress());
- email.setRequired(true);
- email.setWidth(fieldWidth);
- email.setWrapTitle(false);
- phone = new TextItem(PHONE, MSG.dataSource_users_field_phoneNumber());
- phone.setWidth(fieldWidth);
- phone.setWrapTitle(false);
- department = new TextItem(DEPARTMENT,
MSG.dataSource_users_field_department());
- department.setWidth(fieldWidth);
- SpacerItem space = new SpacerItem();
- space.setColSpan(1);
-
- inputForm = new
LocatableDynamicForm(extendLocatorId("LdapUserRegistrationInput"));
- inputForm.setAutoFocus(true);
- inputForm.setErrorOrientation(FormErrorOrientation.LEFT);
- inputForm.setNumCols(4);
- //moving header to it's own container for proper display. Didn't
display right in production mode
- inputForm.setFields(username, first, last, email, phone, department);
- loadValidators(inputForm);
- inputForm.setValidateOnExit(true);
- DynamicForm headerWrapper = new DynamicForm();
- headerWrapper.setFields(header);
- column.addMember(headerWrapper);
- column.addMember(inputForm);
-
- HTMLFlow hr = new
HTMLFlow("<br/><hr/><br/><br/>");
- hr.setWidth(620);
- hr.setAlign(Alignment.CENTER);
- column.addMember(hr);
-
- HStack row = new HStack();
- row.setMembersMargin(5);
- row.setAlign(VerticalAlignment.CENTER);
- IButton okButton = new
LocatableIButton(inputForm.extendLocatorId("OK"), MSG.common_button_ok());
- okButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent event) {
-
- //F5 refresh check? If they've reloaded the form for some reason
then bail.
- boolean credentialsEmpty = ((user == null) || (user.trim().isEmpty())
|| (password == null) || (password
- .trim().isEmpty()));
- //check for session timeout
- if (UserSessionManager.isLoggedOut() || (credentialsEmpty)) {
-
resetLogin(LoginView.this.extendLocatorId("Register"));
- return;
+ //BZ:784873. To fix issue with users logging in by LDAP integration with
clean browser cache.
+ if (CoreGUI.get().getProductInfo() == null) {
+ //We need to explicitly retrieve product info here as can't count on
CoreGui to load it
+ //during LDAP registration. After registration CoreGui is loaded as
usual.
+ GWTServiceLookup.getSystemService().getProductInfo(new
AsyncCallback<ProductInfo>() {
+ public void onFailure(Throwable caught) {
+
CoreGUI.getErrorHandler().handleError(MSG.view_aboutBox_failedToLoad(), caught);
+ productInfo = null;
+ Log.trace("ProductInfo could not be retrieved for some
reason. Proceeding anyway.");
+ buildRegistrationWindow(user, sessionId, password, callback);
}
- //validation
- if (inputForm.validate()) {
- Log.trace("Successfully validated all data for user
registration.");
- //populate form
- if (first.getValue() != null)
- inputForm.setValue(FIRST, String.valueOf(first.getValue()));
- if (last.getValue() != null)
- inputForm.setValue(LAST, String.valueOf(last.getValue()));
- inputForm.setValue(USERNAME,
String.valueOf(username.getValue()));
- if (email.getValue() != null)
- inputForm.setValue(EMAIL, String.valueOf(email.getValue()));
- if (phone.getValue() != null)
- inputForm.setValue(PHONE, String.valueOf(phone.getValue()));
- if (department.getValue() != null)
- inputForm.setValue(DEPARTMENT,
String.valueOf(department.getValue()));
- inputForm.setValue(SESSIONID, sessionId);
- inputForm.setValue(PASSWORD, password);
-
registerLdapUser(LoginView.this.extendLocatorId("RegisterLdap"), inputForm,
callback);
+ public void onSuccess(ProductInfo result) {
+ productInfo = result;
+ Log.trace("ProductInfo has been retrieved for LDAP
registration.");
+ buildRegistrationWindow(user, sessionId, password, callback);
}
- }
+ });
+ } else {//if productInfo has already been loaded, save a gwt call.
+ productInfo = CoreGUI.get().getProductInfo();
+ buildRegistrationWindow(user, sessionId, password, callback);
+ }
+ }
+ }
- });
- row.addMember(okButton);
- //send request to LDAP server to grab user details for this user. Already
sure ldap user exists
- GWTServiceLookup.getLdapService().getLdapDetailsFor(user, new
AsyncCallback<Map<String, String>>() {
- public void onSuccess(final Map<String, String> ldapUserDetails) {
- //now prepopulate UI fields if they exist
- for (String key : ldapUserDetails.keySet()) {
- String value;
- if (key.equalsIgnoreCase("givenName")) {//aka first
name
- value = ldapUserDetails.get(key);
- first.setValue(value);
- } else if (key.equalsIgnoreCase("sn")) {//aka Surname
- value = ldapUserDetails.get(key);
- if ((value != null) && (!value.isEmpty())) {
- last.setValue(value);
- }
- } else if (key.equalsIgnoreCase("telephoneNumber")) {
- value = ldapUserDetails.get(key);
- if ((value != null) && (!value.isEmpty())) {
- phone.setValue(value);
- }
- } else if (key.equalsIgnoreCase("mail")) {
- value = ldapUserDetails.get(key);
- if ((value != null) && (!value.isEmpty())) {
- email.setValue(value);
- }
- }
- }
+ /** Duplicate modal Login mechanism to now show last registration screen before
launching
+ * core gui.
+ *
+ * @param user prepopulate username field for LDAP registration
+ * @param sessionId pass in valid session id for LDAP registration steps.
+ * @param callback pass in callback reference to indicate success and launch of
coreGUI
+ */
+ private void buildRegistrationWindow(final String user, final String sessionId, final
String password,
+ final AsyncCallback<Subject> callback) {
+ int fieldWidth = 120;
+
+ //Build registration window.
+ LocatableVLayout column = new
LocatableVLayout(extendLocatorId("NewLdapRegistration"));
+ column.setMargin(25);
+ HeaderItem header = new HeaderItem();
+ //Locate product info for registration screen.
+ if (productInfo != null) {
+ header.setValue(MSG.view_login_welcomeMsg(productInfo.getName()));
+ } else {//if not available, let registration continue. Errors already logged and
no functionality lost.
+ header.setValue(MSG.view_login_welcomeMsg(""));
+ }
+ header.setWidth("100%");
+ //build ui elements for registration screen
+ first = new TextItem(FIRST, MSG.dataSource_users_field_firstName());
+ {
+ first.setRequired(true);
+ first.setWrapTitle(false);
+ first.setWidth(fieldWidth);
+ }
+ last = new TextItem(LAST, MSG.dataSource_users_field_lastName());
+ {
+ last.setWrapTitle(false);
+ last.setWidth(fieldWidth);
+ last.setRequired(true);
+ }
+ final TextItem username = new TextItem(USERNAME,
MSG.dataSource_users_field_name());
+ {
+ username.setValue(user);
+ username.setDisabled(true);
+ username.setWidth(fieldWidth);
+ }
+ email = new TextItem(EMAIL, MSG.dataSource_users_field_emailAddress());
+ email.setRequired(true);
+ email.setWidth(fieldWidth);
+ email.setWrapTitle(false);
+ phone = new TextItem(PHONE, MSG.dataSource_users_field_phoneNumber());
+ phone.setWidth(fieldWidth);
+ phone.setWrapTitle(false);
+ department = new TextItem(DEPARTMENT, MSG.dataSource_users_field_department());
+ department.setWidth(fieldWidth);
+ SpacerItem space = new SpacerItem();
+ space.setColSpan(1);
+
+ inputForm = new
LocatableDynamicForm(extendLocatorId("LdapUserRegistrationInput"));
+ inputForm.setAutoFocus(true);
+ inputForm.setErrorOrientation(FormErrorOrientation.LEFT);
+ inputForm.setNumCols(4);
+ //moving header to it's own container for proper display. Didn't display
right in production mode
+ inputForm.setFields(username, first, last, email, phone, department);
+ loadValidators(inputForm);
+ inputForm.setValidateOnExit(true);
+ DynamicForm headerWrapper = new DynamicForm();
+ headerWrapper.setFields(header);
+ column.addMember(headerWrapper);
+ column.addMember(inputForm);
+
+ HTMLFlow hr = new
HTMLFlow("<br/><hr/><br/><br/>");
+ hr.setWidth(620);
+ hr.setAlign(Alignment.CENTER);
+ column.addMember(hr);
+
+ HStack row = new HStack();
+ row.setMembersMargin(5);
+ row.setAlign(VerticalAlignment.CENTER);
+ IButton okButton = new
LocatableIButton(inputForm.extendLocatorId("OK"), MSG.common_button_ok());
+ okButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent event) {
+
+ //F5 refresh check? If they've reloaded the form for some reason then
bail.
+ boolean credentialsEmpty = ((user == null) || (user.trim().isEmpty()) ||
(password == null) || (password
+ .trim().isEmpty()));
+ //check for session timeout
+ if (UserSessionManager.isLoggedOut() || (credentialsEmpty)) {
+ resetLogin(LoginView.this.extendLocatorId("Register"));
+ return;
}
- public void onFailure(Throwable caught) {
- inputForm.setFieldErrors(FIRST, MSG.view_login_noLdap(), true);
- Log.debug("Optional LDAP detail retrieval did not succeed.
Registration prepopulation will not occur.");
+ //validation
+ if (inputForm.validate()) {
+ Log.trace("Successfully validated all data for user
registration.");
+ //populate form
+ if (first.getValue() != null)
+ inputForm.setValue(FIRST, String.valueOf(first.getValue()));
+ if (last.getValue() != null)
+ inputForm.setValue(LAST, String.valueOf(last.getValue()));
+ inputForm.setValue(USERNAME, String.valueOf(username.getValue()));
+ if (email.getValue() != null)
+ inputForm.setValue(EMAIL, String.valueOf(email.getValue()));
+ if (phone.getValue() != null)
+ inputForm.setValue(PHONE, String.valueOf(phone.getValue()));
+ if (department.getValue() != null)
+ inputForm.setValue(DEPARTMENT,
String.valueOf(department.getValue()));
+ inputForm.setValue(SESSIONID, sessionId);
+ inputForm.setValue(PASSWORD, password);
+
registerLdapUser(LoginView.this.extendLocatorId("RegisterLdap"), inputForm,
callback);
}
- });
-
- IButton resetButton = new
LocatableIButton(inputForm.extendLocatorId("Reset"),
MSG.common_button_reset());
- resetButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent event) {
- //F5 refresh check? If they've reloaded the form for some reason
then bail.
- boolean credentialsEmpty = ((user == null) || (user.trim().isEmpty())
|| (password == null) || (password
- .trim().isEmpty()));
- if (UserSessionManager.isLoggedOut() || credentialsEmpty) {
- resetLogin(LoginView.this.extendLocatorId("Reset"));
- return;
- }
+ }
- //clear out all validation messages.
- {
- String empty = " ";
- first.setValue(empty);
- last.setValue(empty);
- email.setValue("test(a)test.com");
- inputForm.validate();
+ });
+ row.addMember(okButton);
+ //send request to LDAP server to grab user details for this user. Already sure
ldap user exists
+ GWTServiceLookup.getLdapService().getLdapDetailsFor(user, new
AsyncCallback<Map<String, String>>() {
+ public void onSuccess(final Map<String, String> ldapUserDetails) {
+ //now prepopulate UI fields if they exist
+ for (String key : ldapUserDetails.keySet()) {
+ String value;
+ if (key.equalsIgnoreCase("givenName")) {//aka first name
+ value = ldapUserDetails.get(key);
+ first.setValue(value);
+ } else if (key.equalsIgnoreCase("sn")) {//aka Surname
+ value = ldapUserDetails.get(key);
+ if ((value != null) && (!value.isEmpty())) {
+ last.setValue(value);
+ }
+ } else if (key.equalsIgnoreCase("telephoneNumber")) {
+ value = ldapUserDetails.get(key);
+ if ((value != null) && (!value.isEmpty())) {
+ phone.setValue(value);
+ }
+ } else if (key.equalsIgnoreCase("mail")) {
+ value = ldapUserDetails.get(key);
+ if ((value != null) && (!value.isEmpty())) {
+ email.setValue(value);
+ }
}
- first.clearValue();
- last.clearValue();
- email.clearValue();
- phone.clearValue();
- department.clearValue();
}
- });
- row.addMember(resetButton);
+ }
- IButton cancelButton = new
LocatableIButton(inputForm.extendLocatorId("Cancel"),
MSG.common_button_cancel());
- cancelButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent event) {
- UserSessionManager.logout();
+ public void onFailure(Throwable caught) {
+ inputForm.setFieldErrors(FIRST, MSG.view_login_noLdap(), true);
+ Log.debug("Optional LDAP detail retrieval did not succeed.
Registration prepopulation will not occur.");
+ }
+ });
+
+ IButton resetButton = new
LocatableIButton(inputForm.extendLocatorId("Reset"),
MSG.common_button_reset());
+ resetButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent event) {
+ //F5 refresh check? If they've reloaded the form for some reason then
bail.
+ boolean credentialsEmpty = ((user == null) || (user.trim().isEmpty()) ||
(password == null) || (password
+ .trim().isEmpty()));
+ if (UserSessionManager.isLoggedOut() || credentialsEmpty) {
resetLogin(LoginView.this.extendLocatorId("Reset"));
+ return;
}
- });
- row.addMember(cancelButton);
- Label logoutLabel = new Label(MSG.view_login_registerLater());
- logoutLabel.setWrap(false);
- row.addMember(logoutLabel);
- column.addMember(row);
-
- window = new
LocatableWindow(extendLocatorId("RegistrationWindow"));
- window.setWidth(670);
- window.setHeight(330);
- window.setTitle(MSG.view_login_registerUser());
- // forced focused, static size, can't close / dismiss
- window.setIsModal(true);
- window.setShowModalMask(true);
- window.setCanDragResize(false);
- window.setCanDragReposition(false);
- window.setShowCloseButton(false);
- window.setShowMinimizeButton(false);
- window.setAutoCenter(true);
-
- window.addItem(column);
- window.show();
- }
+ //clear out all validation messages.
+ {
+ String empty = " ";
+ first.setValue(empty);
+ last.setValue(empty);
+ email.setValue("test(a)test.com");
+ inputForm.validate();
+ }
+ first.clearValue();
+ last.clearValue();
+ email.clearValue();
+ phone.clearValue();
+ department.clearValue();
+ }
+ });
+ row.addMember(resetButton);
+
+ IButton cancelButton = new
LocatableIButton(inputForm.extendLocatorId("Cancel"),
MSG.common_button_cancel());
+ cancelButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent event) {
+ UserSessionManager.logout();
+ resetLogin(LoginView.this.extendLocatorId("Reset"));
+ }
+ });
+ row.addMember(cancelButton);
+ Label logoutLabel = new Label(MSG.view_login_registerLater());
+ logoutLabel.setWrap(false);
+ row.addMember(logoutLabel);
+ column.addMember(row);
+
+ window = new LocatableWindow(extendLocatorId("RegistrationWindow"));
+ window.setWidth(670);
+ window.setHeight(330);
+ window.setTitle(MSG.view_login_registerUser());
+
+ // forced focused, static size, can't close / dismiss
+ window.setIsModal(true);
+ window.setShowModalMask(true);
+ window.setCanDragResize(false);
+ window.setCanDragReposition(false);
+ window.setShowCloseButton(false);
+ window.setShowMinimizeButton(false);
+ window.setAutoCenter(true);
+
+ window.addItem(column);
+ window.show();
}
/** Go through steps of invalidating this login and piping them back to CoreGUI
Login.
commit a4602636483a6c8a3093dd16e16c97498286bba9
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Dec 20 17:28:21 2011 -0500
[BZ 766574] for some reason, the remote interface was removed from the discovery SLSB.
put it back.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
index fcb2f9e..2ea6234 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
@@ -99,7 +99,7 @@ import org.rhq.enterprise.server.util.LookupUtil;
* @author Greg Hinkle
*/
@Stateless
-public class DiscoveryBossBean implements DiscoveryBossLocal {
+public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemote {
private final Log log = LogFactory.getLog(DiscoveryBossBean.class.getName());
commit 99ff4f9c796c171b74c3e09b404a2c397607a698
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Dec 20 14:40:53 2011 -0500
[BZ 766574] fix NPE if there is no availability yet
diff --git
a/modules/enterprise/binding/src/main/java/org/rhq/bindings/output/TabularWriter.java
b/modules/enterprise/binding/src/main/java/org/rhq/bindings/output/TabularWriter.java
index 382ce8c..1623039 100644
--- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/output/TabularWriter.java
+++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/output/TabularWriter.java
@@ -44,6 +44,7 @@ import org.rhq.core.domain.configuration.Property;
import org.rhq.core.domain.configuration.PropertyList;
import org.rhq.core.domain.configuration.PropertyMap;
import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.measurement.ResourceAvailability;
import org.rhq.core.domain.resource.ResourceType;
@@ -671,7 +672,8 @@ public class TabularWriter {
} else if (object instanceof ResourceType) {
return ((ResourceType) object).getName();
} else if (object instanceof ResourceAvailability) {
- return ((ResourceAvailability) object).getAvailabilityType().getName();
+ AvailabilityType availType = ((ResourceAvailability)
object).getAvailabilityType();
+ return (availType == null) ? "?" : availType.getName();
} else if (object != null && object.getClass().isArray()) {
return Arrays.toString((Object[]) object);
} else {
commit 9b740863e19ec6cde4007f53c4ad76d399d12ecb
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Nov 11 10:41:00 2011 -0500
[BZ 752981] remove duplicate call to FileSystemInfo.refresh(), which was resulting in
invalid metric values (
https://bugzilla.redhat.com/show_bug.cgi?id=752981); use
switch-case rather than if-else in getValues() to make code more readable
(cherry picked from commit 68be8c6fa8086e0c16fa706e3bad3c84b9d8b2fd)
diff --git
a/modules/plugins/platform/src/main/java/org/rhq/plugins/platform/FileSystemComponent.java
b/modules/plugins/platform/src/main/java/org/rhq/plugins/platform/FileSystemComponent.java
index 9d68c23..5eae991 100644
---
a/modules/plugins/platform/src/main/java/org/rhq/plugins/platform/FileSystemComponent.java
+++
b/modules/plugins/platform/src/main/java/org/rhq/plugins/platform/FileSystemComponent.java
@@ -1,6 +1,6 @@
- /*
+/*
* RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
+ * Copyright (C) 2005-2011 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -28,7 +28,6 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.rhq.core.domain.measurement.AvailabilityType;
-import org.rhq.core.domain.measurement.DataType;
import org.rhq.core.domain.measurement.MeasurementDataNumeric;
import org.rhq.core.domain.measurement.MeasurementDataTrait;
import org.rhq.core.domain.measurement.MeasurementReport;
@@ -39,12 +38,15 @@ import org.rhq.core.pluginapi.inventory.ResourceContext;
import org.rhq.core.pluginapi.measurement.MeasurementFacet;
import org.rhq.core.pluginapi.util.ObjectUtil;
import org.rhq.core.system.FileSystemInfo;
+import org.rhq.core.system.SystemInfo;
-/**
+ /**
* @author Greg Hinkle
*/
public class FileSystemComponent implements ResourceComponent<PlatformComponent>,
MeasurementFacet {
+
private static final Log LOG = LogFactory.getLog(FileSystemComponent.class);
+
private ResourceContext<PlatformComponent> resourceContext;
public void start(ResourceContext<PlatformComponent> resourceContext) throws
InvalidPluginConfigurationException,
@@ -65,26 +67,32 @@ public class FileSystemComponent implements
ResourceComponent<PlatformComponent>
}
}
- private FileSystemInfo getFileSystemInfo() {
- return
resourceContext.getSystemInformation().getFileSystem(resourceContext.getResourceKey());
- }
-
- public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest>
metrics) throws Exception {
+ public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest>
requests) throws Exception {
FileSystemInfo fileSystemInfo = getFileSystemInfo();
- fileSystemInfo.refresh();
- for (MeasurementScheduleRequest request : metrics) {
+ for (MeasurementScheduleRequest request : requests) {
try {
- if (request.getDataType() == DataType.TRAIT) {
- Object value = ObjectUtil.lookupDeepAttributeProperty(fileSystemInfo,
request.getName());
- report.addData(new MeasurementDataTrait(request,
String.valueOf(value)));
- } else if (request.getDataType() == DataType.MEASUREMENT) {
- report.addData(new MeasurementDataNumeric(request,
ObjectUtil.lookupDeepNumericAttributeProperty(
- fileSystemInfo, request.getName())));
+ switch (request.getDataType()) {
+ case TRAIT:
+ Object object =
ObjectUtil.lookupDeepAttributeProperty(fileSystemInfo, request.getName());
+ report.addData(new MeasurementDataTrait(request,
String.valueOf(object)));
+ break;
+ case MEASUREMENT:
+ Double value =
ObjectUtil.lookupDeepNumericAttributeProperty(fileSystemInfo, request.getName());
+ report.addData(new MeasurementDataNumeric(request, value));
+ break;
+ default:
+ throw new IllegalStateException("Unsupported metric type:
" + request.getDataType());
}
} catch (Exception e) {
- LOG.info("Unable to collection file system metric [" +
request.getName() + "] on resource "
- + this.resourceContext.getResourceKey(), e);
+ LOG.info("Unable to collect metric [" + request.getName() +
"] on filesystem resource ["
+ + this.resourceContext.getResourceKey() + "].", e);
}
}
}
+
+ private FileSystemInfo getFileSystemInfo() {
+ SystemInfo systemInfo = resourceContext.getSystemInformation();
+ return systemInfo.getFileSystem(resourceContext.getResourceKey());
+ }
+
}
\ No newline at end of file
commit ceb7b6e337116f4b5af430f43c83884ad15988e1
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Dec 13 13:46:12 2011 -0500
[BZ 767263] don't assume there is always a template
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionDataSource.java
index b29e9a6..bece740 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionDataSource.java
@@ -198,6 +198,9 @@ public class DriftDefinitionDataSource extends
RPCDataSource<DriftDefinitionComp
templateField.setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord listGridRecord, int i, int i1)
{
DriftDefinition def = (DriftDefinition)
listGridRecord.getAttributeAsObject(ATTR_ENTITY);
+ if (null == def.getTemplate()) {
+ return MSG.common_val_none();
+ }
if (null != globalPermissions &&
globalPermissions.contains(Permission.MANAGE_SETTINGS)) {
int typeId = def.getResource().getResourceType().getId();
int templateId = def.getTemplate().getId();
@@ -422,7 +425,11 @@ public class DriftDefinitionDataSource extends
RPCDataSource<DriftDefinitionComp
record.setAttribute(ATTR_IS_PINNED, def.isPinned() ? ImageManager.getPinnedIcon()
: ImageManager
.getUnpinnedIcon());
record.setAttribute(ATTR_ATTACHED, def.isAttached() ? MSG.common_val_yes() :
MSG.common_val_no());
- record.setAttribute(ATTR_TEMPLATE, def.getTemplate().getName());
+ if (def.getTemplate() != null) {
+ record.setAttribute(ATTR_TEMPLATE, def.getTemplate().getName());
+ } else {
+ record.setAttribute(ATTR_TEMPLATE, MSG.common_val_none());
+ }
record.setAttribute(ATTR_CHANGE_SET_VERSION, (null != changeSet) ?
String.valueOf(changeSet.getVersion()) : MSG
.common_label_none());
commit a449c64328ab7c4b729e83adc3505fdf6ec34b90
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Thu Dec 22 17:57:02 2011 -0500
[BZ 767734] conditionally disabling remaining tags references from Bundles.
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
index 5ac460c..bbc4175 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
@@ -124,7 +124,11 @@ public class BundleDeploymentView extends LocatableVLayout implements
Bookmarkab
+ deployment.getDestination().getName(),
LinkManager.getBundleDestinationLink(version.getBundle().getId(),
deployment.getDestination().getId())));
addMember(new
HeaderLabel(Canvas.getImgURL("subsystems/bundle/BundleDeployment_24.png"),
deployment.getName()));
- addMember(createTagEditor());
+
+ //conditionally add tags. Defaults to true, not available in JON builds.
+ if (CoreGUI.isTagsEnabledForUI()) {
+ addMember(createTagEditor());
+ }
addMember(createSummaryForm());
addMemberDeploymentsTable();
@@ -219,8 +223,8 @@ public class BundleDeploymentView extends LocatableVLayout implements
Bookmarkab
// deployment represents content on the remote machines, showing purge only for
live
// deployments makes sense).
if (deployment.isLive()) {
- IButton revertButton = new
LocatableIButton(actionLayout.extendLocatorId("Revert"), MSG
- .view_bundle_revert());
+ IButton revertButton = new
LocatableIButton(actionLayout.extendLocatorId("Revert"),
+ MSG.view_bundle_revert());
revertButton.setIcon("subsystems/bundle/BundleAction_Revert_16.png");
revertButton.addClickHandler(new
com.smartgwt.client.widgets.events.ClickHandler() {
public void onClick(com.smartgwt.client.widgets.events.ClickEvent event)
{
@@ -252,8 +256,9 @@ public class BundleDeploymentView extends LocatableVLayout implements
Bookmarkab
new
Message(MSG.view_bundle_dest_purgeSuccessful(destinationName),
Message.Severity.Info));
// Bundle destination is purged, go back to
bundle deployment view - it is not live anymore
-
CoreGUI.goToView(LinkManager.getBundleDeploymentLink(bundle.getId(), deployment
- .getId()), true);
+ CoreGUI.goToView(
+
LinkManager.getBundleDeploymentLink(bundle.getId(), deployment.getId()),
+ true);
}
});
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
index 1e47427..d0966f2 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
@@ -101,7 +101,12 @@ public class BundleDestinationView extends LocatableVLayout
implements Bookmarka
addMember(backButton);
addMember(header);
- addMember(createTagEditor());
+
+ //conditionally add tags. Defaults to true, not available in JON builds.
+ if (CoreGUI.isTagsEnabledForUI()) {
+ addMember(createTagEditor());
+ }
+
addMember(createSummaryForm());
addMember(createDeploymentsTable());
addMember(detail);
@@ -223,8 +228,8 @@ public class BundleDestinationView extends LocatableVLayout implements
Bookmarka
new
Message(MSG.view_bundle_dest_purgeSuccessful(destination.getName()),
Message.Severity.Info));
// Bundle destination is purged, go back to bundle
destination view
-
CoreGUI.goToView(LinkManager.getBundleDestinationLink(bundle.getId(), destination
- .getId()), true);
+ CoreGUI.goToView(
+
LinkManager.getBundleDestinationLink(bundle.getId(), destination.getId()), true);
}
});
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
index e8eabfa..7a39e5a 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
@@ -108,7 +108,11 @@ public class BundleView extends LocatableVLayout implements
BookmarkableView {
addMember(backButton);
addMember(headerLabel);
- addMember(createTagEditor());
+
+ //conditionally add tags. Defaults to true, not available in JON builds.
+ if (CoreGUI.isTagsEnabledForUI()) {
+ addMember(createTagEditor());
+ }
addMember(createSummaryForm());
addMember(tabs);
@@ -184,8 +188,8 @@ public class BundleView extends LocatableVLayout implements
BookmarkableView {
StaticTextItem versionCountItem = new StaticTextItem("versionCount",
MSG.view_bundle_list_versionsCount());
versionCountItem.setValue(bundle.getBundleVersions() != null ?
bundle.getBundleVersions().size() : 0);
- StaticTextItem destinationsCountItem = new
StaticTextItem("destinationsCount", MSG
- .view_bundle_list_destinationsCount());
+ StaticTextItem destinationsCountItem = new
StaticTextItem("destinationsCount",
+ MSG.view_bundle_list_destinationsCount());
destinationsCountItem.setValue(bundle.getDestinations() != null ?
bundle.getDestinations().size() : 0);
StaticTextItem descriptionItem = new StaticTextItem("description",
MSG.common_title_description());
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java
index 19116bb..5737a9c 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java
@@ -93,7 +93,10 @@ public class BundleVersionView extends LocatableVLayout implements
BookmarkableV
addMember(new
HeaderLabel(Canvas.getImgURL("subsystems/bundle/BundleVersion_24.png"),
version.getName() + ": "
+ version.getVersion()));
- addMember(createTagEditor());
+ //conditionally add tags. Defaults to true, not available in JON builds.
+ if (CoreGUI.isTagsEnabledForUI()) {
+ addMember(createTagEditor());
+ }
addMember(createSummaryForm());
@@ -268,16 +271,17 @@ public class BundleVersionView extends LocatableVLayout implements
BookmarkableV
criteria.fetchConfigurationDefinition(true);
criteria.fetchTags(true);
- bundleManager.findBundleVersionsByCriteriaWithDestinationFilter(criteria, new
AsyncCallback<PageList<BundleVersion>>() {
- public void onFailure(Throwable caught) {
-
CoreGUI.getErrorHandler().handleError(MSG.view_bundle_version_loadFailure(), caught);
- }
+ bundleManager.findBundleVersionsByCriteriaWithDestinationFilter(criteria,
+ new AsyncCallback<PageList<BundleVersion>>() {
+ public void onFailure(Throwable caught) {
+
CoreGUI.getErrorHandler().handleError(MSG.view_bundle_version_loadFailure(), caught);
+ }
- public void onSuccess(PageList<BundleVersion> result) {
- BundleVersion version = result.get(0);
- ViewId nextPath = viewPath.next().getCurrent();
- viewBundleVersion(version, nextPath);
- }
- });
+ public void onSuccess(PageList<BundleVersion> result) {
+ BundleVersion version = result.get(0);
+ ViewId nextPath = viewPath.next().getCurrent();
+ viewBundleVersion(version, nextPath);
+ }
+ });
}
}
commit 5407b2871b5c8ed074513992aec8cd07a687b949
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Mon Jan 23 17:49:51 2012 +0100
[BZ 767170] - The permissions are already known, don't try to fetch them
asynchronously again in the role and user views.
This simplifies the rendering of those views tremendously making them work
reliably and without possible race conditions.
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
index 53bd86d..7d4810b 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
@@ -117,13 +117,13 @@ public class AdministrationView extends
AbstractSectionedLeftNavigationView {
private NavigationSection buildSecuritySection() {
NavigationItem usersItem = new NavigationItem(UsersView.VIEW_ID,
"global/User_16.png", new ViewFactory() {
public Canvas createView() {
- return new UsersView(extendLocatorId("Users"));
+ return new UsersView(extendLocatorId("Users"),
getGlobalPermissions().contains(Permission.MANAGE_SECURITY));
}
});
NavigationItem rolesItem = new NavigationItem(RolesView.VIEW_ID,
"global/Role_16.png", new ViewFactory() {
public Canvas createView() {
- return new RolesView(extendLocatorId("Roles"));
+ return new RolesView(extendLocatorId("Roles"),
getGlobalPermissions().contains(Permission.MANAGE_SECURITY));
}
});
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
index 3c3e91d..91f2c2f 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
@@ -20,7 +20,6 @@ package org.rhq.enterprise.gui.coregui.client.admin.roles;
import java.util.ArrayList;
import java.util.List;
-import java.util.Set;
import com.smartgwt.client.types.SelectionStyle;
import com.smartgwt.client.widgets.Canvas;
@@ -29,10 +28,7 @@ import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.grid.events.CellClickEvent;
import com.smartgwt.client.widgets.grid.events.CellClickHandler;
-import org.rhq.core.domain.authz.Permission;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
-import org.rhq.enterprise.gui.coregui.client.PermissionsLoadedListener;
-import org.rhq.enterprise.gui.coregui.client.PermissionsLoader;
import org.rhq.enterprise.gui.coregui.client.admin.AdministrationView;
import org.rhq.enterprise.gui.coregui.client.components.table.EscapedHtmlCellFormatter;
import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
@@ -46,7 +42,7 @@ import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
* @author Greg Hinkle
* @author Ian Springer
*/
-public class RolesView extends TableSection<RolesDataSource> implements
BookmarkableView {
+public class RolesView extends TableSection<RolesDataSource> {
public static final ViewName VIEW_ID = new ViewName("Roles",
MSG.common_title_roles());
public static final String VIEW_PATH = AdministrationView.VIEW_ID + "/"
@@ -55,22 +51,18 @@ public class RolesView extends TableSection<RolesDataSource>
implements Bookmark
private static final String HEADER_ICON = "global/Role_24.png";
private boolean hasManageSecurity;
- private boolean initialized;
- public RolesView(String locatorId) {
+ public RolesView(String locatorId, boolean hasManageSecurity) {
super(locatorId, MSG.common_title_roles());
final RolesDataSource datasource = RolesDataSource.getInstance();
setDataSource(datasource);
setHeaderIcon(HEADER_ICON);
setEscapeHtmlInDetailsLinkColumn(true);
+
+ this.hasManageSecurity = hasManageSecurity;
}
-
- @Override
- protected void onDraw() {
- fetchManageSecurityPermissionAsync();
- }
-
+
@Override
protected void configureTable() {
updateSelectionStyle();
@@ -156,31 +148,12 @@ public class RolesView extends TableSection<RolesDataSource>
implements Bookmark
};
}
- private void fetchManageSecurityPermissionAsync() {
- new PermissionsLoader().loadExplicitGlobalPermissions(new
PermissionsLoadedListener() {
- public void onPermissionsLoaded(Set<Permission> permissions) {
- if (permissions != null) {
- hasManageSecurity =
permissions.contains(Permission.MANAGE_SECURITY);
- refreshTableInfo();
- } else {
- hasManageSecurity = false;
- }
- if (!initialized) {
- RolesView.super.onDraw();
- }
- initialized = true;
- }
- });
- }
-
private void updateSelectionStyle() {
- if (initialized) {
- if (!hasManageSecurity) {
- getListGrid().deselectAllRecords();
- }
- SelectionStyle selectionStyle = hasManageSecurity ?
getDefaultSelectionStyle() : SelectionStyle.NONE;
- getListGrid().setSelectionType(selectionStyle);
+ if (!hasManageSecurity) {
+ getListGrid().deselectAllRecords();
}
+ SelectionStyle selectionStyle = hasManageSecurity ? getDefaultSelectionStyle() :
SelectionStyle.NONE;
+ getListGrid().setSelectionType(selectionStyle);
}
@Override
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
index a8b35fd..18213f1 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
@@ -20,7 +20,6 @@ package org.rhq.enterprise.gui.coregui.client.admin.users;
import java.util.ArrayList;
import java.util.List;
-import java.util.Set;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.SelectionStyle;
@@ -32,8 +31,6 @@ import com.smartgwt.client.widgets.grid.events.CellClickHandler;
import org.rhq.core.domain.authz.Permission;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.PermissionsLoadedListener;
-import org.rhq.enterprise.gui.coregui.client.PermissionsLoader;
import org.rhq.enterprise.gui.coregui.client.admin.AdministrationView;
import org.rhq.enterprise.gui.coregui.client.components.table.EscapedHtmlCellFormatter;
import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
@@ -61,9 +58,8 @@ public class UsersView extends TableSection<UsersDataSource> {
private static final String HEADER_ICON = "global/User_24.png";
private boolean hasManageSecurity;
- private boolean initialized;
- public UsersView(String locatorId) {
+ public UsersView(String locatorId, boolean hasManageSecurity) {
super(locatorId, MSG.common_title_users());
final UsersDataSource dataSource = UsersDataSource.getInstance();
@@ -71,8 +67,8 @@ public class UsersView extends TableSection<UsersDataSource> {
setDataSource(dataSource);
setHeaderIcon(HEADER_ICON);
setEscapeHtmlInDetailsLinkColumn(true);
-
- fetchManageSecurityPermissionAsync();
+
+ this.hasManageSecurity = hasManageSecurity;
}
@Override
@@ -101,28 +97,12 @@ public class UsersView extends TableSection<UsersDataSource> {
updateSelectionStyle();
}
- private void fetchManageSecurityPermissionAsync() {
- new PermissionsLoader().loadExplicitGlobalPermissions(new
PermissionsLoadedListener() {
- public void onPermissionsLoaded(Set<Permission> permissions) {
- if (permissions != null) {
- hasManageSecurity =
permissions.contains(Permission.MANAGE_SECURITY);
- refreshTableInfo();
- } else {
- hasManageSecurity = false;
- }
- initialized = true;
- }
- });
- }
-
private void updateSelectionStyle() {
- if (initialized) {
- if (!hasManageSecurity) {
- getListGrid().deselectAllRecords();
- }
- SelectionStyle selectionStyle = hasManageSecurity ?
getDefaultSelectionStyle() : SelectionStyle.NONE;
- getListGrid().setSelectionType(selectionStyle);
+ if (!hasManageSecurity) {
+ getListGrid().deselectAllRecords();
}
+ SelectionStyle selectionStyle = hasManageSecurity ? getDefaultSelectionStyle() :
SelectionStyle.NONE;
+ getListGrid().setSelectionType(selectionStyle);
}
private List<ListGridField> createFields() {
commit c8dad0b8a0270387ed55ef13e9f38a40fa08c462
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Mon Jan 23 17:45:46 2012 +0100
Added some clarification to the javadocs of InitializableView to lower
the expectations one might have about it.
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/InitializableView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/InitializableView.java
index b5fc3b9..f503d99 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/InitializableView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/InitializableView.java
@@ -33,7 +33,12 @@ public interface InitializableView {
/**
* Return true if this widget's {@link BaseWidget#init() initialization} has
completed, or false otherwise.
- *
+ * <p>
+ * Don't expect this to work automagically if the result of this method is
dependent on some asynchronous call.
+ * The consumers of this method need in that case loop and check this method
periodically. If you cannot guarantee
+ * all the callers of this method on your instance actually do that, you can't
assume that the results of
+ * the asynchronous call will be taken into account correctly.
+ *
* @return true if this widget's {@link BaseWidget#init() initialization} has
completed, or false otherwise
*/
boolean isInitialized();