modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java | 10 + modules/core/domain/src/main/java/org/rhq/core/domain/util/PersistenceUtility.java | 90 ++++++++++ modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java | 80 ++++++-- modules/enterprise/gui/portal-war/src/main/webapp-filtered/WEB-INF/classes/ApplicationResources.properties | 4 modules/enterprise/gui/portal-war/src/main/webapp/admin/test/hibernate.jsp | 24 +- modules/enterprise/gui/portal-war/src/main/webapp/common/RSSFormat.jsp | 7 modules/enterprise/gui/portal-war/src/main/webapp/rhq/inventory/browseGroups.xhtml | 4 modules/enterprise/gui/portal-war/src/main/webapp/rhq/inventory/browseResources.xhtml | 4 modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listAlertHistory.xhtml | 3 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java | 59 +++++- modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerLocal.java | 3 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/i18n/AlertI18NResourceKeys.java | 21 ++ modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/MasterServerPluginContainer.java | 23 +- modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginClassLoader.java | 2 modules/enterprise/server/plugins/alert-irc/src/main/java/org/rhq/enterprise/server/plugins/alertIrc/IrcSender.java | 2 modules/enterprise/server/plugins/alert-microblog/src/main/java/org/rhq/enterprise/server/plugins/alertMicroblog/MicroblogSender.java | 9 - modules/enterprise/server/plugins/alert-mobicents/src/main/java/org/rhq/enterprise/server/plugins/alertMobicents/MobicentsSender.java | 2 modules/enterprise/server/plugins/alert-scriptlang/src/main/java/org.rhq.enterprise.server.plugins.alertScriptlang/ScriptLangSender.java | 2 modules/enterprise/server/plugins/alert-snmp/src/main/java/org/rhq/enterprise/server/plugins/alertSnmp/SnmpSender.java | 2 modules/enterprise/server/plugins/alert-snmp/src/main/resources/META-INF/rhq-serverplugin.xml | 2 20 files changed, 279 insertions(+), 74 deletions(-)
New commits: commit 2e83a0cc092f8feef995642502447389152d598e Merge: 3f91c1c... 4c82f06... Author: Partha Aji paji@redhat.com Date: Tue Feb 23 10:20:31 2010 -0500
Merge branch 'linux-config' into ldap
commit 4c82f0686d4905161b7ea2e27e154c414dfd6368 Merge: 2ae22a1... 59776e2... Author: Partha Aji paji@redhat.com Date: Tue Feb 23 10:13:20 2010 -0500
Merge branch 'master' into linux-config
commit 59776e2009c2e2b17ca45d5c88e6373def9da879 Author: Ian P. Springer <ips@jetengine.(none)> Date: Tue Feb 23 09:23:23 2010 -0500
fix a couple invalid docs URLs
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp-filtered/WEB-INF/classes/ApplicationResources.properties b/modules/enterprise/gui/portal-war/src/main/webapp-filtered/WEB-INF/classes/ApplicationResources.properties index 571cf22..8132311 100644 --- a/modules/enterprise/gui/portal-war/src/main/webapp-filtered/WEB-INF/classes/ApplicationResources.properties +++ b/modules/enterprise/gui/portal-war/src/main/webapp-filtered/WEB-INF/classes/ApplicationResources.properties @@ -88,7 +88,7 @@ common.field.value=Value
common.marketing.FeatureDisabled=This feature is unavailable, please contact sales to upgrade
-common.url.help=https://network.jboss.com/confluence/display/DOC/Users+Guide +common.url.help=http://www.rhq-project.org/display/JOPR2
common.error.invalid.oid=OID specified is invalid, please enter OID in form of 1.2.3.4
@@ -2916,7 +2916,7 @@ software.common.InstallPreview.PatchTitle=Title software.common.InstallPreview.StepDescription=Step Description software.common.InstallPreview.ShortDescription=Short Description software.common.InstallPreview.LongDescription=Detailed Description -software.common.InstallPreview.TopMessage=Clicking the [Install] button will begin the execution of the steps listed below. Review each step carefully before proceeding with the update installation.<br/><ul><li>Prior to installing this update, if you have applied any one-off fixes to this instance, please check the update description to see that they are included in the fixes that make up this update. If they are not included then this update may overwrite the one-off fix and leave your instance in an unstable state.</li><li>When updating a JBoss instance that shares a common server configuration, follow the instructions documented in the wiki: <a href="https://network.jboss.com/confluence/display/DOC/Installing+a+Patch" target="_new">Installing a Patch</a>. Please contact support for more information.</li></ul> +software.common.InstallPreview.TopMessage=Clicking the [Install] button will begin the execution of the steps listed below. Review each step carefully before proceeding with the update installation.<br/><ul><li>Prior to installing this update, if you have applied any one-off fixes to this instance, please check the update description to see that they are included in the fixes that make up this update. If they are not included then this update may overwrite the one-off fix and leave your instance in an unstable state.</li><li>When updating a JBoss instance that shares a common server configuration, follow the instructions documented in the wiki: <a href="http://www.rhq-project.org/display/JOPR2/Demos#Demos-ContentSubsystem" target="_new">Installing a Patch</a>. Please contact support for more information.</li></ul> software.common.InstallPreview.NotAllowedToInstall=This user doesn't have the appropriate rights to install an update. Only users that can control a resource may install an update.
software.common.ManualUninstall.TableTitle=Manual Update Uninstallation
commit b3c691dfd0f407658ba9004bbcbdda0c235404ef Author: Ian P. Springer <ips@jetengine.(none)> Date: Tue Feb 23 09:22:03 2010 -0500
fix regression in RSS feed template (https://bugzilla.redhat.com/show_bug.cgi?id=567636)
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/common/RSSFormat.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/common/RSSFormat.jsp index 59bb5d1..3831ebb 100644 --- a/modules/enterprise/gui/portal-war/src/main/webapp/common/RSSFormat.jsp +++ b/modules/enterprise/gui/portal-war/src/main/webapp/common/RSSFormat.jsp @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="utf-8" ?> +<?xml version="1.0" encoding="UTF-8"?> <%@ page language="java" contentType="text/xml" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> <%@ taglib uri="http://jakarta.apache.org/struts/tags-html-el" prefix="html" %> <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"> - <repo> + <channel> <title><c:out value="${rssFeed.title}"/></title> <link><c:out value="${rssFeed.baseUrl}"/></link> <description><fmt:message key="dashboard.template.title"/> <c:out value="${rssFeed.title}"/></description> @@ -25,5 +25,6 @@ <guid><![CDATA[<c:out value="${item.guid}"/>]]></guid> </item> </c:forEach> - </repo> + </channel> </rss> +
commit 3602414a6baff7fb52d637d2006574610212b46f Author: Heiko W. Rupp pilhuhn@fedorapeople.org Date: Sat Feb 20 10:49:01 2010 +0100
Fix potential NPE
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java index 5ed6d4f..b90def3 100644 --- a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java +++ b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java @@ -113,8 +113,8 @@ public class AlertNotificationLog implements Serializable { @PrePersist @PreUpdate public void trimMessage() { - if (message.length()>255) - message = message.substring(0,254); + if (message!=null && message.length()>255) + message = message.substring(0,255); }
protected AlertNotificationLog() {
commit 1c26e0f7c827ae7a250b4de583d6ce623ca3ff50 Merge: 32b3daf... e1c7603... Author: Heiko W. Rupp pilhuhn@fedorapeople.org Date: Sat Feb 20 09:52:53 2010 +0100
Merge branch 'master' into alertPlugin
commit 32b3daf0e818830cabf9797197666b8059472ba5 Author: Heiko W. Rupp pilhuhn@fedorapeople.org Date: Sat Feb 20 09:47:10 2010 +0100
Truncate the message at 140 chars, as identi.ca bails out on longer messages; seems to improve stability with Twitter too. Introduce abbreviated versions of the messages as space on Microblog etc is scarce. BZ 555091
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java index ba75940..5ed6d4f 100644 --- a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java +++ b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java @@ -38,6 +38,8 @@ import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; +import javax.persistence.PrePersist; +import javax.persistence.PreUpdate; import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Transient; @@ -108,6 +110,13 @@ public class AlertNotificationLog implements Serializable { @Transient transient List<String> transientEmails = new ArrayList<String>();
+ @PrePersist + @PreUpdate + public void trimMessage() { + if (message.length()>255) + message = message.substring(0,254); + } + protected AlertNotificationLog() { } // JPA
@@ -130,7 +139,6 @@ public class AlertNotificationLog implements Serializable {
public AlertNotificationLog(Alert alert, String senderName, ResultState state, String message) { this.alert = alert; - this.sender = sender; this.resultState = state; this.message = message;
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java index 454b9a9..ff4025f 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java @@ -780,7 +780,7 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote { Map<String, String> alertMessage = emailManager.getAlertEmailMessage( prettyPrintResourceHierarchy(alertDefinition.getResource()), alertDefinition.getResource().getName(), alertDefinition.getName(), alertDefinition.getPriority().toString(), new Date(alert.getCtime()).toString(), - prettyPrintAlertConditions(alert.getConditionLogs()), prettyPrintAlertURL(alert)); + prettyPrintAlertConditions(alert.getConditionLogs(), false), prettyPrintAlertURL(alert)); String messageSubject = alertMessage.keySet().iterator().next(); String messageBody = alertMessage.values().iterator().next();
@@ -834,13 +834,14 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote { /** * Create a human readable description of the conditions that led to this alert. * @param alert Alert to create human readable condition description + * @param shortVersion if true the messages printed are abbreviated to save space * @return human readable condition log */ - public String prettyPrintAlertConditions(Alert alert) { - return prettyPrintAlertConditions(alert.getConditionLogs()); + public String prettyPrintAlertConditions(Alert alert, boolean shortVersion) { + return prettyPrintAlertConditions(alert.getConditionLogs(), shortVersion); }
- private String prettyPrintAlertConditions(Set<AlertConditionLog> conditionLogs) { + private String prettyPrintAlertConditions(Set<AlertConditionLog> conditionLogs, boolean shortVersion) { StringBuilder builder = new StringBuilder();
int conditionCounter = 1; @@ -858,16 +859,27 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
builder.append(NEW_LINE);
- builder.append(AlertI18NFactory.getMessage(AlertI18NResourceKeys.ALERT_EMAIL_CONDITION_LOG_FORMAT, - conditionCounter, prettyPrintAlertCondition(aLog.getCondition()), new SimpleDateFormat( - "yyyy/MM/dd HH:mm:ss z").format(new Date(aLog.getCtime())), formattedValue)); + String format; + if (shortVersion) + format = AlertI18NResourceKeys.ALERT_EMAIL_CONDITION_LOG_FORMAT_SHORT; + else + format = AlertI18NResourceKeys.ALERT_EMAIL_CONDITION_LOG_FORMAT; + SimpleDateFormat dateFormat; + if (shortVersion) + dateFormat= new SimpleDateFormat( + "yy/MM/dd HH:mm:ss z"); + else + dateFormat= new SimpleDateFormat( + "yyyy/MM/dd HH:mm:ss z"); + builder.append(AlertI18NFactory.getMessage(format, + conditionCounter, prettyPrintAlertCondition(aLog.getCondition(), shortVersion), dateFormat.format(new Date(aLog.getCtime())), formattedValue)); conditionCounter++; }
return builder.toString(); }
- private String prettyPrintAlertCondition(AlertCondition condition) { + private String prettyPrintAlertCondition(AlertCondition condition, boolean shortVersion) { StringBuilder builder = new StringBuilder();
AlertConditionCategory category = condition.getCategory(); @@ -915,19 +927,38 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote { } } else if ((category == AlertConditionCategory.RESOURCE_CONFIG) || (category == AlertConditionCategory.CHANGE) || (category == AlertConditionCategory.TRAIT)) { - builder.append(AlertI18NFactory.getMessage(AlertI18NResourceKeys.ALERT_CURRENT_LIST_VALUE_CHANGED)); + + if (shortVersion) + builder.append(AlertI18NFactory.getMessage(AlertI18NResourceKeys.ALERT_CURRENT_LIST_VALUE_CHANGED_SHORT)); + else + builder.append(AlertI18NFactory.getMessage(AlertI18NResourceKeys.ALERT_CURRENT_LIST_VALUE_CHANGED)); + } else if (category == AlertConditionCategory.EVENT) { if ((condition.getOption() != null) && (condition.getOption().length() > 0)) { + String propsCbEventSeverityRegexMatch; + if (shortVersion) + propsCbEventSeverityRegexMatch = AlertI18NResourceKeys.ALERT_CONFIG_PROPS_CB_EVENT_SEVERITY_REGEX_MATCH_SHORT; + else + propsCbEventSeverityRegexMatch = AlertI18NResourceKeys.ALERT_CONFIG_PROPS_CB_EVENT_SEVERITY_REGEX_MATCH; + builder.append(AlertI18NFactory.getMessage( - AlertI18NResourceKeys.ALERT_CONFIG_PROPS_CB_EVENT_SEVERITY_REGEX_MATCH, condition.getName(), + propsCbEventSeverityRegexMatch, condition.getName(), condition.getOption())); } else { - builder.append(AlertI18NFactory.getMessage(AlertI18NResourceKeys.ALERT_CONFIG_PROPS_CB_EVENT_SEVERITY, - condition.getName())); + if (shortVersion) + builder.append(AlertI18NFactory.getMessage(AlertI18NResourceKeys.ALERT_CONFIG_PROPS_CB_EVENT_SEVERITY_SHORT, + condition.getName())); + else + builder.append(AlertI18NFactory.getMessage(AlertI18NResourceKeys.ALERT_CONFIG_PROPS_CB_EVENT_SEVERITY, + condition.getName())); } } else if (category == AlertConditionCategory.AVAILABILITY) { - builder.append(AlertI18NFactory.getMessage(AlertI18NResourceKeys.ALERT_CONFIG_PROPS_CB_AVAILABILITY, - condition.getOption())); + if (shortVersion) + builder.append(AlertI18NFactory.getMessage(AlertI18NResourceKeys.ALERT_CONFIG_PROPS_CB_AVAILABILITY_SHORT, + condition.getOption())); + else + builder.append(AlertI18NFactory.getMessage(AlertI18NResourceKeys.ALERT_CONFIG_PROPS_CB_AVAILABILITY, + condition.getOption())); } else { // do nothing } diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerLocal.java index 996f245..e482ffa 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerLocal.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerLocal.java @@ -96,9 +96,10 @@ public interface AlertManagerLocal { /** * Create a human readable description of the conditions that led to this alert. * @param alert Alert to create human readable condition description + * @param shortVersion if true the messages printed are abbreviated to save space * @return human readable condition log */ - String prettyPrintAlertConditions(Alert alert); + String prettyPrintAlertConditions(Alert alert, boolean shortVersion);
/** * Tells us if the definition of the passed alert will be disabled after this alert was fired diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/i18n/AlertI18NResourceKeys.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/i18n/AlertI18NResourceKeys.java index 8734771..1de3d85 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/i18n/AlertI18NResourceKeys.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/i18n/AlertI18NResourceKeys.java @@ -32,20 +32,41 @@ public interface AlertI18NResourceKeys { @I18NMessage(locale = "de", value = "Verfgbarkeit wird {0}") }) String ALERT_CONFIG_PROPS_CB_AVAILABILITY = "alert.config.props.CB.Availability";
+ @I18NMessages( { @I18NMessage("Avail goes {0}"), + @I18NMessage(locale = "de", value = "Verf. wird {0}") }) + String ALERT_CONFIG_PROPS_CB_AVAILABILITY_SHORT = "alert.config.props.CB.Availability.short"; + @I18NMessages( { @I18NMessage("Event Severity: {0}"), @I18NMessage(locale = "de", value = "Schwere des Ereignesses: {0}") }) String ALERT_CONFIG_PROPS_CB_EVENT_SEVERITY = "alert.config.props.CB.EventSeverity";
+ @I18NMessages( { @I18NMessage("Sev: {0}"), + @I18NMessage(locale = "de", value = "Schwere: {0}") }) + String ALERT_CONFIG_PROPS_CB_EVENT_SEVERITY_SHORT = "alert.config.props.CB.EventSeverity.short"; + @I18NMessages( { @I18NMessage("Event Severity: {0} and matching expression "{1}""), @I18NMessage(locale = "de", value = "Schwere des Ereignesses: {0} und zugehriger Ausdruck "{1}"") }) String ALERT_CONFIG_PROPS_CB_EVENT_SEVERITY_REGEX_MATCH = "alert.config.props.CB.EventSeverity.RegexMatch";
+ @I18NMessages( { @I18NMessage("Sev: {0} & exp "{1}""), + @I18NMessage(locale = "de", value = "Schwere: {0} & Ausdruck "{1}"") }) + String ALERT_CONFIG_PROPS_CB_EVENT_SEVERITY_REGEX_MATCH_SHORT = "alert.config.props.CB.EventSeverity.RegexMatch.short"; + @I18NMessages( { @I18NMessage("value changed"), @I18NMessage(locale = "de", value = "Der Wert hat sich gendert") }) String ALERT_CURRENT_LIST_VALUE_CHANGED = "alert.current.list.ValueChanged";
+ @I18NMessages( { @I18NMessage("val chg"), @I18NMessage(locale = "de", value = "Wertnd.") }) + String ALERT_CURRENT_LIST_VALUE_CHANGED_SHORT = "alert.current.list.ValueChanged.short"; + @I18NMessages( { @I18NMessage("\ - Condition {0}: {1}\n\\n" + "\ - Date/Time: {2}\n\\n" + "\ - Details: {3}\n\\n"), @I18NMessage(locale = "de", value = " - Bedingung {0}: {1}\n\\n - Datum/Uhrzeit: {2}\n\\n" + "\ - Details: {3}\n\\n") }) String ALERT_EMAIL_CONDITION_LOG_FORMAT = "alert.email.condition.log.format"; + + @I18NMessages( { + @I18NMessage("\ - Cond {0}: {1}\n\\n" + "\ - Time: {2}\n\\n" + "\ - Det: {3}\n\\n"), + @I18NMessage(locale = "de", value = " - Bed {0}: {1}\n\\n - Zeit: {2}\n\\n" + + "\ - Det: {3}\n\\n") }) + String ALERT_EMAIL_CONDITION_LOG_FORMAT_SHORT = "alert.email.condition.log.format.short"; } \ No newline at end of file diff --git a/modules/enterprise/server/plugins/alert-irc/src/main/java/org/rhq/enterprise/server/plugins/alertIrc/IrcSender.java b/modules/enterprise/server/plugins/alert-irc/src/main/java/org/rhq/enterprise/server/plugins/alertIrc/IrcSender.java index 93eecc6..95abdb9 100644 --- a/modules/enterprise/server/plugins/alert-irc/src/main/java/org/rhq/enterprise/server/plugins/alertIrc/IrcSender.java +++ b/modules/enterprise/server/plugins/alert-irc/src/main/java/org/rhq/enterprise/server/plugins/alertIrc/IrcSender.java @@ -65,7 +65,7 @@ public class IrcSender extends AlertSender<IrcAlertComponent> { b.append("): "); b.append(alertManager.prettyPrintAlertURL(alert)); b.append("\n"); - b.append(alertManager.prettyPrintAlertConditions(alert)); + b.append(alertManager.prettyPrintAlertConditions(alert, false));
return b.toString(); } diff --git a/modules/enterprise/server/plugins/alert-microblog/src/main/java/org/rhq/enterprise/server/plugins/alertMicroblog/MicroblogSender.java b/modules/enterprise/server/plugins/alert-microblog/src/main/java/org/rhq/enterprise/server/plugins/alertMicroblog/MicroblogSender.java index 257b315..b13763e 100644 --- a/modules/enterprise/server/plugins/alert-microblog/src/main/java/org/rhq/enterprise/server/plugins/alertMicroblog/MicroblogSender.java +++ b/modules/enterprise/server/plugins/alert-microblog/src/main/java/org/rhq/enterprise/server/plugins/alertMicroblog/MicroblogSender.java @@ -57,14 +57,19 @@ public class MicroblogSender extends AlertSender { b.append("' ("); b.append(alert.getAlertDefinition().getResource().getId()); b.append("): "); - b.append(alertManager.prettyPrintAlertConditions(alert)); + b.append(alertManager.prettyPrintAlertConditions(alert, true)); b.append("-by @JBossJopr"); // TODO not for production :-) // TODO use some alert url shortening service
SenderResult result ; String txt = "user@baseUrl [" + user + "@" + baseUrl + "]:"; try { - Status status = twitter.updateStatus(b.toString()); + String msg = b.toString(); + if (msg.length()>140) + msg = msg.substring(0,140); + + Status status = twitter.updateStatus(msg); + result = new SenderResult(ResultState.SUCCESS,"Send notification to " + txt + ", msg-id: " + status.getId()); } catch (TwitterException e) {
diff --git a/modules/enterprise/server/plugins/alert-mobicents/src/main/java/org/rhq/enterprise/server/plugins/alertMobicents/MobicentsSender.java b/modules/enterprise/server/plugins/alert-mobicents/src/main/java/org/rhq/enterprise/server/plugins/alertMobicents/MobicentsSender.java index 649d6ed..b14c85d 100644 --- a/modules/enterprise/server/plugins/alert-mobicents/src/main/java/org/rhq/enterprise/server/plugins/alertMobicents/MobicentsSender.java +++ b/modules/enterprise/server/plugins/alert-mobicents/src/main/java/org/rhq/enterprise/server/plugins/alertMobicents/MobicentsSender.java @@ -74,7 +74,7 @@ public class MobicentsSender extends AlertSender { // Switch locale to english, as the voice synthesizer expects this for now Locale currentLocale = Locale.getDefault(); Locale.setDefault(Locale.ENGLISH); - b.append(alertManager.prettyPrintAlertConditions(alert)); + b.append(alertManager.prettyPrintAlertConditions(alert, false)); Locale.setDefault(currentLocale);
boolean willBeDisabled = alertManager.willDefinitionBeDisabled(alert); diff --git a/modules/enterprise/server/plugins/alert-scriptlang/src/main/java/org.rhq.enterprise.server.plugins.alertScriptlang/ScriptLangSender.java b/modules/enterprise/server/plugins/alert-scriptlang/src/main/java/org.rhq.enterprise.server.plugins.alertScriptlang/ScriptLangSender.java index 985d890..bac51fb 100644 --- a/modules/enterprise/server/plugins/alert-scriptlang/src/main/java/org.rhq.enterprise.server.plugins.alertScriptlang/ScriptLangSender.java +++ b/modules/enterprise/server/plugins/alert-scriptlang/src/main/java/org.rhq.enterprise.server.plugins.alertScriptlang/ScriptLangSender.java @@ -93,7 +93,7 @@ public class ScriptLangSender extends AlertSender<ScriptLangComponent> { Object[] args = new Object[3]; args[0] = alert; args[1] = alertManager.prettyPrintAlertURL(alert); - args[2] = alertManager.prettyPrintAlertConditions(alert); + args[2] = alertManager.prettyPrintAlertConditions(alert, false); result = ((Invocable) engine).invokeFunction("sendAlert", args);
if (result == null) { diff --git a/modules/enterprise/server/plugins/alert-snmp/src/main/java/org/rhq/enterprise/server/plugins/alertSnmp/SnmpSender.java b/modules/enterprise/server/plugins/alert-snmp/src/main/java/org/rhq/enterprise/server/plugins/alertSnmp/SnmpSender.java index 3fd5d79..045c3bb 100644 --- a/modules/enterprise/server/plugins/alert-snmp/src/main/java/org/rhq/enterprise/server/plugins/alertSnmp/SnmpSender.java +++ b/modules/enterprise/server/plugins/alert-snmp/src/main/java/org/rhq/enterprise/server/plugins/alertSnmp/SnmpSender.java @@ -68,7 +68,7 @@ public class SnmpSender extends AlertSender { String result; List<Resource> lineage = resourceManager.getResourceLineage(alert.getAlertDefinition().getResource().getId()); String platformName = lineage.get(0).getName(); - String conditions = alertManager.prettyPrintAlertConditions(alert); + String conditions = alertManager.prettyPrintAlertConditions(alert, false); String alertUrl = alertManager.prettyPrintAlertURL(alert);
SenderResult res ;
commit e1c760378fe3f3fdcbee42beef05f9930eb3fd65 Author: John Mazzitelli mazz@redhat.com Date: Fri Feb 19 17:51:53 2010 -0500
i think this should report an error always on lock acq failure. we'll leave the flag alone - don't set it to true - let the next call take care of whether or not the init callback should be invoked or not
diff --git a/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java b/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java index 8c37b50..cd3b479 100644 --- a/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java +++ b/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java @@ -588,11 +588,9 @@ public class JBossRemotingRemoteCommunicator implements RemoteCommunicator { writeLock.unlock(); } } else { - if (m_needToCallInitializeCallback) { - Throwable t = new Throwable("Initialize callback lock could not be acquired"); - LOG.error(CommI18NResourceKeys.INITIALIZE_CALLBACK_FAILED, t.getMessage()); - return new GenericCommandResponse(command, false, null, t); - } + Throwable t = new Throwable("Initialize callback lock could not be acquired"); + LOG.error(CommI18NResourceKeys.INITIALIZE_CALLBACK_FAILED, t.getMessage()); + return new GenericCommandResponse(command, false, null, t); } } return null;
commit 1740b73d4ec9dddf1222fcf99b69a8164c090bbb Author: John Mazzitelli mazz@redhat.com Date: Fri Feb 19 17:44:11 2010 -0500
should not worry about the lock failure if the init callback doesn't need to be invoked anyway
diff --git a/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java b/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java index 762b9b4..8c37b50 100644 --- a/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java +++ b/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java @@ -588,10 +588,11 @@ public class JBossRemotingRemoteCommunicator implements RemoteCommunicator { writeLock.unlock(); } } else { - m_needToCallInitializeCallback = true; // can't invoke callback, we'll want to still call it later - Throwable t = new Throwable("Initialize callback lock could not be acquired"); - LOG.error(CommI18NResourceKeys.INITIALIZE_CALLBACK_FAILED, t.getMessage()); - return new GenericCommandResponse(command, false, null, t); + if (m_needToCallInitializeCallback) { + Throwable t = new Throwable("Initialize callback lock could not be acquired"); + LOG.error(CommI18NResourceKeys.INITIALIZE_CALLBACK_FAILED, t.getMessage()); + return new GenericCommandResponse(command, false, null, t); + } } } return null;
commit 60fa4314138911d607d6e95110987feb5a7b8fb7 Author: John Mazzitelli mazz@redhat.com Date: Fri Feb 19 17:38:16 2010 -0500
BZ 537396 - to not block indefinitely if a lock cannot be acquired before attempting to invoke the initialize callback
diff --git a/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java b/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java index 3775212..762b9b4 100644 --- a/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java +++ b/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java @@ -21,6 +21,9 @@ package org.rhq.enterprise.communications.command.client; import java.net.MalformedURLException; import java.util.HashMap; import java.util.Map; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.locks.ReentrantReadWriteLock; +import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
import mazz.i18n.Logger;
@@ -95,10 +98,22 @@ public class JBossRemotingRemoteCommunicator implements RemoteCommunicator { private InitializeCallback m_initializeCallback;
/** - * When the first element is <code>true</code>, the initialize callback will need to be called prior - * to sending any commands. This is an array because the array itself is used for its lock. + * When <code>true</code>, the initialize callback will need to be called prior + * to sending any commands. Used in conjunection with its associated RW lock. */ - private final boolean[] m_needToCallInitializeCallback; + private boolean m_needToCallInitializeCallback; + + /** + * RW lock when needing to access its associated atomic boolean flag. + */ + private final ReentrantReadWriteLock m_needToCallInitializeCallbackLock; + + /** + * Number of minutes to wait while attempting to aquire a lock before attempting + * to invoke the initialize callback. If this amount of minutes expires before the lock + * is acquired, an error will occur and the initialize callback will have to be attempted later. + */ + private final long m_initializeCallbackLockAcquisitionTimeoutMins;
/** * Constructor for {@link JBossRemotingRemoteCommunicator} that initializes the client with no invoker locator @@ -200,7 +215,17 @@ public class JBossRemotingRemoteCommunicator implements RemoteCommunicator { m_clientConfiguration.putAll(client_config); }
- m_needToCallInitializeCallback = new boolean[] { false }; + m_needToCallInitializeCallback = false; + m_needToCallInitializeCallbackLock = new ReentrantReadWriteLock(); + + long mins; + try { + String minsStr = System.getProperty("rhq.communications.initial-callback-lock-wait-mins", "60"); + mins = Long.parseLong(minsStr); + } catch (Throwable t) { + mins = 60L; + } + m_initializeCallbackLockAcquisitionTimeoutMins = mins;
return; } @@ -319,7 +344,7 @@ public class JBossRemotingRemoteCommunicator implements RemoteCommunicator { if (m_remotingClient != null) { m_remotingClient.disconnect(); m_remotingClient = null; - m_needToCallInitializeCallback[0] = (getInitializeCallback() != null); // specifically do not synchronize, just set it + m_needToCallInitializeCallback = (getInitializeCallback() != null); // specifically do not synchrononize by using lock, just set it }
LOG.info(CommI18NResourceKeys.COMMUNICATOR_CHANGING_ENDPOINT, m_invokerLocator, locator); @@ -377,7 +402,7 @@ public class JBossRemotingRemoteCommunicator implements RemoteCommunicator {
public void setInitializeCallback(InitializeCallback callback) { m_initializeCallback = callback; - m_needToCallInitializeCallback[0] = (callback != null); // specifically do not synchronize, just set it + m_needToCallInitializeCallback = (callback != null); // specifically do not synchrononize by using lock, just set it }
public String getRemoteEndpoint() { @@ -403,7 +428,7 @@ public class JBossRemotingRemoteCommunicator implements RemoteCommunicator { public void connect() throws Exception { if ((m_remotingClient != null) && !m_remotingClient.isConnected()) { m_remotingClient.connect(); - m_needToCallInitializeCallback[0] = (getInitializeCallback() != null); // specifically do not synchronize, just set it + m_needToCallInitializeCallback = (getInitializeCallback() != null); // specifically do not synchrononize by using lock, just set it }
return; @@ -412,7 +437,7 @@ public class JBossRemotingRemoteCommunicator implements RemoteCommunicator { public void disconnect() { if (m_remotingClient != null) { m_remotingClient.disconnect(); - m_needToCallInitializeCallback[0] = (getInitializeCallback() != null); // specifically do not synchronize, just set it + m_needToCallInitializeCallback = (getInitializeCallback() != null); // specifically do not synchrononize by using lock, just set it }
return; @@ -535,18 +560,38 @@ public class JBossRemotingRemoteCommunicator implements RemoteCommunicator { private CommandResponse invokeInitializeCallbackIfNeeded(Command command) { InitializeCallback callback = getInitializeCallback(); if (callback != null) { - // block here - in effect, this will stop all commands from going out until the callback is done - synchronized (m_needToCallInitializeCallback) { - if (m_needToCallInitializeCallback[0]) { - try { - m_needToCallInitializeCallback[0] = !callback.sendingInitialCommand(this, command); - LOG.debug(CommI18NResourceKeys.INITIALIZE_CALLBACK_DONE, m_needToCallInitializeCallback[0]); - } catch (Throwable t) { - m_needToCallInitializeCallback[0] = true; // callback failed, we'll want to call it again - LOG.error(t, CommI18NResourceKeys.INITIALIZE_CALLBACK_FAILED, ThrowableUtil.getAllMessages(t)); - return new GenericCommandResponse(command, false, null, t); + // block here - in effect, this will stop all commands from going out until the callback is done + // to avoid infinite blocking, we'll only wait for a set time (though long). + + WriteLock writeLock = m_needToCallInitializeCallbackLock.writeLock(); + boolean locked; + try { + locked = writeLock.tryLock(m_initializeCallbackLockAcquisitionTimeoutMins, TimeUnit.MINUTES); + } catch (InterruptedException ie) { + locked = false; + } + + if (locked) { + try { + if (m_needToCallInitializeCallback) { + try { + m_needToCallInitializeCallback = (!callback.sendingInitialCommand(this, command)); + LOG.debug(CommI18NResourceKeys.INITIALIZE_CALLBACK_DONE, m_needToCallInitializeCallback); + } catch (Throwable t) { + m_needToCallInitializeCallback = true; // callback failed, we'll want to call it again + LOG.error(t, CommI18NResourceKeys.INITIALIZE_CALLBACK_FAILED, ThrowableUtil + .getAllMessages(t)); + return new GenericCommandResponse(command, false, null, t); + } } + } finally { + writeLock.unlock(); } + } else { + m_needToCallInitializeCallback = true; // can't invoke callback, we'll want to still call it later + Throwable t = new Throwable("Initialize callback lock could not be acquired"); + LOG.error(CommI18NResourceKeys.INITIALIZE_CALLBACK_FAILED, t.getMessage()); + return new GenericCommandResponse(command, false, null, t); } } return null;
commit 474b186034125b179eb03e1ff069036a3299f730 Author: John Mazzitelli mazz@redhat.com Date: Fri Feb 19 11:10:53 2010 -0500
BZ 566724 - if classloader fails to be created, master PC will skip the plugin
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/MasterServerPluginContainer.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/MasterServerPluginContainer.java index f46eaf5..bd4feac 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/MasterServerPluginContainer.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/MasterServerPluginContainer.java @@ -136,16 +136,23 @@ public class MasterServerPluginContainer { String pluginName = descriptor.getName(); ServerPluginType pluginType = new ServerPluginType(descriptor); PluginKey pluginKey = PluginKey.createServerPluginKey(pluginType.stringify(), pluginName); - ClassLoader classLoader = this.classLoaderManager.obtainServerPluginClassLoader(pluginKey); - log.debug("Pre-loading server plugin [" + pluginKey + "] from [" + pluginUrl - + "] into its plugin container"); try { - ServerPluginEnvironment env = new ServerPluginEnvironment(pluginUrl, classLoader, descriptor); - boolean enabled = !allDisabledPlugins.contains(pluginKey); - pc.loadPlugin(env, enabled); - log.info("Preloaded server plugin [" + pluginKey.getPluginName() + "]"); + ClassLoader classLoader = this.classLoaderManager.obtainServerPluginClassLoader(pluginKey); + log.debug("Pre-loading server plugin [" + pluginKey + "] from [" + pluginUrl + + "] into its plugin container"); + try { + ServerPluginEnvironment env = new ServerPluginEnvironment(pluginUrl, classLoader, + descriptor); + boolean enabled = !allDisabledPlugins.contains(pluginKey); + pc.loadPlugin(env, enabled); + log.info("Preloaded server plugin [" + pluginName + "]"); + } catch (Exception e) { + log.warn("Failed to preload server plugin [" + pluginName + "] from URL [" + pluginUrl + + "]", e); + } } catch (Exception e) { - log.warn("Failed to preload server plugin [" + pluginUrl + "]", e); + log.warn("Failed to preload server plugin [" + pluginName + + "]; cannot get its classloader from URL [ " + pluginUrl + "]", e); } } else { log.warn("There is no server plugin container to support plugin: " + pluginUrl); diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginClassLoader.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginClassLoader.java index 9f27ce9..fa26970 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginClassLoader.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginClassLoader.java @@ -64,7 +64,7 @@ public class ServerPluginClassLoader extends URLClassLoader { try { unpackedDirectory = unpackEmbeddedJars(pluginJarName, pluginUrl, classpathUrlList, tmpDirectory); } catch (Exception e) { - throw new Exception("Failed to unpack embedded JARs within: " + pluginUrl); + throw new Exception("Failed to unpack embedded JARs within: " + pluginUrl, e); } } }
commit b5e46e4c6e802cdf883307c46e5a275a94514457 Author: Heiko W. Rupp pilhuhn@fedorapeople.org Date: Fri Feb 19 13:37:36 2010 +0100
Fix link to definitions BZ 566004
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listAlertHistory.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listAlertHistory.xhtml index b6e386c..fd09f82 100644 --- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listAlertHistory.xhtml +++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listAlertHistory.xhtml @@ -148,8 +148,7 @@ </onc:sortableColumnHeader> </f:facet>
- <h:outputLink value="/alerts/Config.do"> - <f:param name="mode" value="viewRoles"/> + <h:outputLink value="/rhq/resource/alert/viewAlert.xhtml"> <f:param name="id" value="#{Resource.id}"/> <f:param name="ad" value="#{item.alert.alertDefinition.id}"/> <h:outputText value="#{item.alert.alertDefinition.name}" />
commit 195e7a1dd15ed80a86e8f6bcc1e2787d511de3a9 Author: Joseph Marques joseph@redhat.com Date: Fri Feb 19 02:37:35 2010 -0500
BZ-534284 (RHQ-1095) - make hibernate.jsp work for non-string bind parameters: * support binding to boolean as well as all numeric basic types; * support binding to enums (user can enter ordinal or name [case-insensitively] of enum); * support binding to entities (user can enter id / primary key); * modify label for input field next to each query parameter to give a brief explanation of how it's supported;
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/util/PersistenceUtility.java b/modules/core/domain/src/main/java/org/rhq/core/domain/util/PersistenceUtility.java index 282faec..5122c2f 100644 --- a/modules/core/domain/src/main/java/org/rhq/core/domain/util/PersistenceUtility.java +++ b/modules/core/domain/src/main/java/org/rhq/core/domain/util/PersistenceUtility.java @@ -22,6 +22,7 @@ */ package org.rhq.core.domain.util;
+import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -44,11 +45,16 @@ import org.hibernate.engine.NamedQueryDefinition; import org.hibernate.engine.SessionFactoryImplementor; import org.hibernate.jmx.StatisticsService; import org.hibernate.stat.Statistics; +import org.hibernate.type.CustomType; +import org.hibernate.type.EntityType; +import org.hibernate.type.PrimitiveType; +import org.hibernate.type.Type;
/** * Various persistence utility methods - mostly Hibernate-specific. * * @author Heiko Rupp + * @author Joseph Marques * @author Greg Hinkle */ public class PersistenceUtility { @@ -61,6 +67,90 @@ public class PersistenceUtility {
public static final String HIBERNATE_STATISTICS_MBEAN_OBJECTNAME = "Hibernate:type=statistics,application=RHQ";
+ public static String getDisplayString(Type hibernateType) { + if (hibernateType instanceof EntityType) { + return hibernateType.getName() + " (enter integer of ID / primary key field)"; + } else if (hibernateType instanceof CustomType) { + if (Enum.class.isAssignableFrom(hibernateType.getReturnedClass())) { + Class<? extends Enum<?>> enumClass = hibernateType.getReturnedClass(); + StringBuilder result = new StringBuilder(); + result.append(enumClass.getName()); + result.append(" ("); + boolean first = true; + for (Enum<?> nextEnum : enumClass.getEnumConstants()) { + if (!first) { + result.append(" | "); + } else { + first = false; + } + result.append(nextEnum.name()); + } + result.append(")"); + return result.toString(); + } + } + return hibernateType.getName(); + } + + @SuppressWarnings("unchecked") + public static Object cast(String value, Type hibernateType) { + if (hibernateType instanceof PrimitiveType) { + Class<?> type = ((PrimitiveType) hibernateType).getPrimitiveClass(); + if (type.equals(Byte.TYPE)) { + return Byte.valueOf(value); + } else if (type.equals(Short.TYPE)) { + return Short.valueOf(value); + } else if (type.equals(Integer.TYPE)) { + return Integer.valueOf(value); + } else if (type.equals(Long.TYPE)) { + return Long.valueOf(value); + } else if (type.equals(Float.TYPE)) { + return Float.valueOf(value); + } else if (type.equals(Double.TYPE)) { + return Double.valueOf(value); + } else if (type.equals(Boolean.TYPE)) { + return Boolean.valueOf(value); + } + } else if (hibernateType instanceof EntityType) { + String entityName = ((EntityType) hibernateType).getAssociatedEntityName(); + try { + Class<?> entityClass = Class.forName(entityName); + Object entity = entityClass.newInstance(); + + Field primaryKeyField = entityClass.getDeclaredField("id"); + primaryKeyField.setAccessible(true); + primaryKeyField.setInt(entity, Integer.valueOf(value)); + return entity; + } catch (Throwable t) { + throw new IllegalArgumentException("Type[" + entityName + "] must have PK field named 'id'"); + } + } else if (hibernateType instanceof CustomType) { + if (Enum.class.isAssignableFrom(hibernateType.getReturnedClass())) { + Class<? extends Enum<?>> enumClass = hibernateType.getReturnedClass(); + Enum<?>[] enumValues = enumClass.getEnumConstants(); + try { + int enumOrdinal = Integer.valueOf(value); + try { + return enumValues[enumOrdinal]; + } catch (ArrayIndexOutOfBoundsException aioobe) { + throw new IllegalArgumentException("There is no " + enumClass.getSimpleName() + + " enum with ordinal '" + enumOrdinal + "'"); + } + } catch (NumberFormatException nfe) { + String ucaseValue = value.toUpperCase(); + for (Enum<?> nextEnum : enumValues) { + if (nextEnum.name().toUpperCase().equals(ucaseValue)) { + return nextEnum; + } + } + throw new IllegalArgumentException("There is no " + enumClass.getSimpleName() + " enum with name '" + + value + "'"); + } + } + } + return value; + } + /** * Used to create queries to use with the {@link PageControl} objects. The query will already have its sort column * and order appended as well as having its first result and max results set according to the page control data. diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/admin/test/hibernate.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/admin/test/hibernate.jsp index 95424b1..7dc7c2e 100644 --- a/modules/enterprise/gui/portal-war/src/main/webapp/admin/test/hibernate.jsp +++ b/modules/enterprise/gui/portal-war/src/main/webapp/admin/test/hibernate.jsp @@ -7,6 +7,7 @@ <%@ page import="org.hibernate.type.IntegerType" %> <%@ page import="org.hibernate.type.LongType" %> <%@ page import="org.hibernate.type.Type" %> +<%@ page import="org.rhq.core.domain.util.PersistenceUtility" %> <%@ page import="org.rhq.enterprise.gui.legacy.util.SessionUtils" %> <%@ page import="org.rhq.enterprise.server.util.LookupUtil" %> <%@ page import="javax.naming.InitialContext" %> @@ -143,7 +144,7 @@ <td><input type="text" name="${pn}" value="${param[pn]}"></td> <td> <c:set value="${pn}" var="pn" scope="request"/> - <%=qt.getParameterTranslations().getNamedParameterExpectedType((String) request.getAttribute("pn")).getName()%> + <%=PersistenceUtility.getDisplayString(qt.getParameterTranslations().getNamedParameterExpectedType((String) request.getAttribute("pn")))%> </td> </tr> </c:forEach> @@ -163,15 +164,10 @@ Iterator iter = parameterNames.iterator(); while (iter.hasNext()) { String pn = (String) iter.next(); - Object paramterValue = request.getParameter(pn); + Object paramValue = request.getParameter(pn); Type type = qt.getParameterTranslations().getNamedParameterExpectedType(pn); - if (type instanceof LongType) - paramterValue = Long.parseLong((String) paramterValue); - else if (type instanceof IntegerType) - paramterValue = Integer.parseInt((String) paramterValue); - - //out.println("parameter " + pn + " = " + paramterValue); - q.setParameter(pn, paramterValue); + paramValue = PersistenceUtility.cast((String)paramValue, type); + q.setParameter(pn, paramValue); }
if (isDMLStyle) {
commit e2dce2b51a6948629af959d88011b86c122ed209 Author: Joseph Marques joseph@redhat.com Date: Thu Feb 18 19:35:40 2010 -0500
update hibernate.jsp to provide translations for DML-style operations;
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/admin/test/hibernate.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/admin/test/hibernate.jsp index 0147f1e..95424b1 100644 --- a/modules/enterprise/gui/portal-war/src/main/webapp/admin/test/hibernate.jsp +++ b/modules/enterprise/gui/portal-war/src/main/webapp/admin/test/hibernate.jsp @@ -106,7 +106,7 @@ <% if (hql != null || namedQuery != null) { System.out.println("hql: " + hql); - String sql = null; + List<String> sqlStrings = null; Set<String> parameterNames = null; try { qt = new ASTQueryTranslatorFactory().createQueryTranslator( @@ -116,12 +116,10 @@ (SessionFactoryImplementor) s.getSessionFactory());
qt.compile(null, false); - sql = qt.getSQLString(); + sqlStrings = qt.collectSqlStrings();
- if (sql == null) { - out.write("Could not get SQL translation for DML-style operation"); - } else { - out.write("<b>SQL: </b><textarea rows="10" cols="120">" + sql + "</textarea>"); + for (String nextSQL : sqlStrings) { + out.write("<b>SQL: </b><textarea rows="10" cols="120">" + nextSQL + "</textarea>"); }
ParameterTranslations pt = qt.getParameterTranslations();
commit 8f6ee4ef76b4b4158b28b48c117a7ce1b448dba1 Merge: 3c21fc0... 2622dd5... Author: Joseph Marques joseph@redhat.com Date: Thu Feb 18 19:28:47 2010 -0500
Merge branch 'master' into search
commit 2622dd5e50066c74d29e532d156ceabbe10a30f6 Author: Bryan Kearney bkearney@redhat.com Date: Thu Feb 18 13:27:31 2010 -0500
553398: Fixed a typo
diff --git a/modules/enterprise/server/plugins/alert-snmp/src/main/resources/META-INF/rhq-serverplugin.xml b/modules/enterprise/server/plugins/alert-snmp/src/main/resources/META-INF/rhq-serverplugin.xml index ae84d32..31e3a5a 100644 --- a/modules/enterprise/server/plugins/alert-snmp/src/main/resources/META-INF/rhq-serverplugin.xml +++ b/modules/enterprise/server/plugins/alert-snmp/src/main/resources/META-INF/rhq-serverplugin.xml @@ -36,7 +36,7 @@ <c:simple-property name="agentAddress" description="Address of our SNMP agent" required="false"/> </c:group> <!-- - <c:group name="2c" displayName="Snmp version 2c properties" hiddenByDefault="true"> + <c:group name="2c" displayName="SNMP version 2c properties" hiddenByDefault="true"> Nothing special </c:group> -->
commit 3c21fc0d894bd0992a44d8bbe64887b35358a4a7 Author: Joseph Marques joseph@redhat.com Date: Mon Feb 15 13:24:41 2010 -0500
add sorting to the resource/group description field
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/inventory/browseGroups.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/inventory/browseGroups.xhtml index c40aa71..9d92183 100644 --- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/inventory/browseGroups.xhtml +++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/inventory/browseGroups.xhtml @@ -175,7 +175,9 @@
rich:column <f:facet name="header"> - <h:outputText styleClass="headerText" value="Description" /> + <onc:sortableColumnHeader sort="rg.description"> + <h:outputText styleClass="headerText" value="Description" /> + </onc:sortableColumnHeader> </f:facet>
<h:outputText value="#{item.resourceGroup.description}" /> diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/inventory/browseResources.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/inventory/browseResources.xhtml index 2551307..7890d64 100644 --- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/inventory/browseResources.xhtml +++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/inventory/browseResources.xhtml @@ -187,7 +187,9 @@
rich:column <f:facet name="header"> - <h:outputText styleClass="headerText" value="Description" /> + <onc:sortableColumnHeader sort="r.description"> + <h:outputText styleClass="headerText" value="Description" /> + </onc:sortableColumnHeader> </f:facet>
<h:outputText value="#{item.original.resource.description}" />
rhq-commits@lists.fedorahosted.org