modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftDetails.java
| 126 +++
modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftConfigurationTest.java
| 20
modules/core/plugin-container/pom.xml
| 3
modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java
| 55 +
modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/ScheduleQueueImpl.java
| 21
modules/enterprise/agent/ant-run.xml
| 15
modules/enterprise/agent/pom.xml
| 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
| 26
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java
| 23
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserSessionManager.java
| 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
| 73 --
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/buttons/BackButton.java
| 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/AbstractTableSection.java
| 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/StringIDTableSection.java
| 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java
| 28
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDetailsView.java
| 342 +++-------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/DriftGWTService.java
| 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
| 15
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/TestGWTService.java
| 34
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/help/HelpView.java
| 20
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/schedules/SchedulesDataSource.java
| 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/AbstractConfigurationHistoryDataSource.java
| 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/AutodiscoveryQueueDataSource.java
| 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
| 14
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
| 15
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestRpcView.java
| 52 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestTopView.java
| 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/DriftGWTServiceImpl.java
| 11
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/TestGWTServiceImpl.java
| 43 +
modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
| 8
modules/enterprise/remoting/cli/src/main/samples/drift.js
| 153 +++-
modules/enterprise/remoting/cli/src/main/samples/util.js
| 17
modules/enterprise/server/container/pom.xml
| 6
modules/enterprise/server/container/src/main/scripts/rhq-container.assembly.xml
| 7
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
| 69 ++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerLocal.java
| 10
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java
| 11
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerLocal.java
| 2
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest.java
| 8
modules/integration-tests/apache-plugin-test/pom.xml
| 4
modules/plugins/aliases/pom.xml
| 2
modules/plugins/apache/pom.xml
| 2
modules/plugins/augeas/pom.xml
| 6
modules/plugins/cobbler/pom.xml
| 2
modules/plugins/cron/pom.xml
| 2
modules/plugins/grub/pom.xml
| 2
modules/plugins/hosts/pom.xml
| 2
modules/plugins/postfix/pom.xml
| 2
modules/plugins/samba/pom.xml
| 2
modules/plugins/sshd/pom.xml
| 2
modules/plugins/sudoers/pom.xml
| 2
pom.xml
| 7
publish_release.sh
| 2
53 files changed, 918 insertions(+), 404 deletions(-)
New commits:
commit 85ccbd1698c68a5a7850a32fe364973a5ef704be
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Thu Sep 1 16:55:06 2011 -0400
[BZ 735232] Message portlet should not be displayed on default dashboard in JON
(
https://bugzilla.redhat.com/show_bug.cgi?id=735232); fix layout issues in About
modal window; load ProductInfo once in CoreGUI init and cache it
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
index 2a52e4d..88801e0 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
@@ -33,6 +33,7 @@ import com.google.gwt.user.client.History;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.Window.Location;
+import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.core.KeyIdentifier;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.util.KeyCallback;
@@ -41,10 +42,12 @@ import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.layout.VLayout;
+import org.rhq.core.domain.common.ProductInfo;
import org.rhq.enterprise.gui.coregui.client.admin.AdministrationView;
import org.rhq.enterprise.gui.coregui.client.alert.AlertHistoryView;
import org.rhq.enterprise.gui.coregui.client.bundle.BundleTopView;
import org.rhq.enterprise.gui.coregui.client.dashboard.DashboardsView;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.help.HelpView;
import org.rhq.enterprise.gui.coregui.client.inventory.InventoryView;
import
org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.ResourceGroupDetailView;
@@ -109,6 +112,7 @@ public class CoreGUI implements EntryPoint,
ValueChangeHandler<String>, Event.Na
private MenuBarView menuBarView;
private Footer footer;
private int rpcTimeout;
+ private ProductInfo productInfo;
public void onModuleLoad() {
String hostPageBaseURL = GWT.getHostPageBaseURL();
@@ -262,6 +266,28 @@ public class CoreGUI implements EntryPoint,
ValueChangeHandler<String>, Event.Na
return coreGUI;
}
+ public void init() {
+ if (productInfo == null) {
+ GWTServiceLookup.getSystemService().getProductInfo(new
AsyncCallback<ProductInfo>() {
+ public void onFailure(Throwable caught) {
+
CoreGUI.getErrorHandler().handleError(MSG.view_aboutBox_failedToLoad(), caught);
+ buildCoreUI();
+ }
+
+ public void onSuccess(ProductInfo result) {
+ productInfo = result;
+ buildCoreUI();
+ }
+ });
+ } else {
+ buildCoreUI();
+ }
+ }
+
+ public ProductInfo getProductInfo() {
+ return productInfo;
+ }
+
public void buildCoreUI() {
// If the core gui is already built (eg. from previous login) skip the build and
just refire event
if (rootCanvas == null) {
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserSessionManager.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserSessionManager.java
index 56c3658..7bdcb6e 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserSessionManager.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserSessionManager.java
@@ -84,7 +84,7 @@ public class UserSessionManager {
// We want the CoreGUI session timeout to rule them all. The rhq subject session is
refreshed on each SLSB
// call. But the HTTP session will die after 30 minutes. Keep it alive until logout
by pinging SessionAccessServlet
- // occasionaly, as specified by this interval (which must be less than the 30
minutes).
+ // occasionally, as specified by this interval (which must be less than the 30
minutes).
// Currently: 20 minutes
private static int SESSION_ACCESS_REFRESH = 20 * 60 * 1000;
@@ -454,7 +454,7 @@ public class UserSessionManager {
scheduleWebUserUpdate(loggedInSubject);
}
- CoreGUI.get().buildCoreUI();
+ CoreGUI.get().init();
}
public void onFailure(Throwable caught) {
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
index 6a614bb..b476f66 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2010 Red Hat, Inc.
+ * Copyright (C) 2010-2011 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -18,25 +18,18 @@
*/
package org.rhq.enterprise.gui.coregui.client.components;
-import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.Version;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.types.VerticalAlignment;
-import com.smartgwt.client.widgets.Button;
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.HTMLFlow;
-import com.smartgwt.client.widgets.IButton;
-import com.smartgwt.client.widgets.Window;
+import com.smartgwt.client.widgets.HTMLPane;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
-import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.common.ProductInfo;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.Messages;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
@@ -52,8 +45,6 @@ public class AboutModalWindow extends LocatableWindow {
private static final Messages MSG = CoreGUI.getMessages();
- private static ProductInfo PRODUCT_INFO;
-
/**
* <pre>
* ID Format: "simpleClassname_locatorId"
@@ -78,37 +69,19 @@ public class AboutModalWindow extends LocatableWindow {
@Override
protected void onInit() {
- super.onInit();
-
- if (PRODUCT_INFO == null) {
- GWTServiceLookup.getSystemService().getProductInfo(new
AsyncCallback<ProductInfo>() {
- public void onFailure(Throwable caught) {
-
CoreGUI.getErrorHandler().handleError(MSG.view_aboutBox_failedToLoad(), caught);
- }
-
- public void onSuccess(ProductInfo result) {
- PRODUCT_INFO = result;
- setTitle(MSG.view_aboutBox_title(PRODUCT_INFO.getFullName()));
+ ProductInfo productInfo = CoreGUI.get().getProductInfo();
- finishOnInit();
- }
- });
- } else {
- finishOnInit();
- }
- }
+ setTitle(MSG.view_aboutBox_title(productInfo.getFullName()));
- private void finishOnInit() {
LocatableVLayout contentPane = new
LocatableVLayout(extendLocatorId("Content"));
- contentPane.setPadding(13);
- contentPane.setMembersMargin(25);
-
- HTMLFlow htmlFlow = new HTMLFlow();
- String html = "<span class=\"DisplaySubhead\">\n" +
" <a href=\"" + PRODUCT_INFO.getUrl() + "\"
title=\""
- + PRODUCT_INFO.getFullName() + " " + PRODUCT_INFO.getUrl() +
"\" target=\"_blank\">"
- + PRODUCT_INFO.getFullName() + "</a>\n" +
"</span><br/>\n" + "<span
class=\"DisplayLabel\">"
- + MSG.view_aboutBox_version() + " " + PRODUCT_INFO.getVersion() +
"</span><br/>\n"
- + "<span class=\"DisplayLabel\">" +
MSG.view_aboutBox_buildNumber() + " " + PRODUCT_INFO.getBuildNumber()
+ contentPane.setPadding(10);
+
+ HTMLPane htmlPane = new HTMLPane();
+ String html = "<span class=\"DisplaySubhead\">\n" +
" <a href=\"" + productInfo.getUrl() + "\"
title=\""
+ + productInfo.getFullName() + " " + productInfo.getUrl() +
"\" target=\"_blank\">"
+ + productInfo.getFullName() + "</a>\n" +
"</span><br/>\n" + "<span
class=\"DisplayLabel\">"
+ + MSG.view_aboutBox_version() + " " + productInfo.getVersion() +
"</span><br/>\n"
+ + "<span class=\"DisplayLabel\">" +
MSG.view_aboutBox_buildNumber() + " " + productInfo.getBuildNumber()
+ "</span><p/>\n" + "<span
class=\"DisplayLabel\">GWT " + MSG.common_title_version() + ":
"
+ MSG.common_buildInfo_gwtVersion() + "</span><br/>\n"
+ "<span class=\"DisplayLabel\">SmartGWT "
+ MSG.common_title_version() + ": " + Version.getVersion() +
"</span><br/>\n"
@@ -116,17 +89,19 @@ public class AboutModalWindow extends LocatableWindow {
+ " <img height=\"55\" alt=\"" +
MSG.view_aboutBox_jbossByRedHat()
+ "\" src=\"/images/jboss_logo.png\">\n" +
"</a></p>\n" + "<div style=\"top-margin:
10px\">"
+ MSG.view_aboutBox_allRightsReserved() + "</div>\n";
- htmlFlow.setContents(html);
- contentPane.addMember(htmlFlow);
+ htmlPane.setContents(html);
+ htmlPane.setHeight(220);
+ contentPane.addMember(htmlPane);
LocatableHLayout buttonBar = new
LocatableHLayout(contentPane.extendLocatorId("ButtonBar"));
+ buttonBar.setHeight(30);
buttonBar.setAlign(Alignment.RIGHT);
LocatableIButton closeButton = new
LocatableIButton(buttonBar.extendLocatorId("Close"),
MSG.common_button_close());
closeButton.setShowRollOver(true);
closeButton.setShowDown(true);
- closeButton.setWidth("60");
+ closeButton.setWidth(60);
closeButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
hide();
@@ -143,4 +118,5 @@ public class AboutModalWindow extends LocatableWindow {
// Layout class.
addItem(contentPane);
}
+
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java
index 7d0ec7a..424b256 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2009 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
@@ -45,6 +45,7 @@ import com.smartgwt.client.widgets.tab.events.TabSelectedEvent;
import com.smartgwt.client.widgets.tab.events.TabSelectedHandler;
import org.rhq.core.domain.authz.Permission;
+import org.rhq.core.domain.common.ProductInfo;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.criteria.DashboardCriteria;
import org.rhq.core.domain.dashboard.Dashboard;
@@ -361,21 +362,32 @@ public class DashboardsView extends LocatableVLayout implements
DashboardContain
dashboard.setColumnWidths("32%");
dashboard.getConfiguration().put(new PropertySimple(Dashboard.CFG_BACKGROUND,
"#F1F2F3"));
+ ProductInfo productInfo = CoreGUI.get().getProductInfo();
+ boolean isRHQ = (productInfo != null) &&
"RHQ".equals(productInfo.getShortName());
+
// Left Column
- DashboardPortlet welcome = new DashboardPortlet(MessagePortlet.NAME,
MessagePortlet.KEY, 250);
- dashboard.addPortlet(welcome, 0, 0);
+ int columnIndex = 0;
+ int rowIndex = 0;
+
+ if (isRHQ) {
+ DashboardPortlet welcome = new DashboardPortlet(MessagePortlet.NAME,
MessagePortlet.KEY, 250);
+ dashboard.addPortlet(welcome, columnIndex, rowIndex++);
+ }
DashboardPortlet summary = new DashboardPortlet(InventorySummaryPortlet.NAME,
InventorySummaryPortlet.KEY, 250);
- dashboard.addPortlet(summary, 0, 1);
+ dashboard.addPortlet(summary, columnIndex, rowIndex++);
DashboardPortlet news = new DashboardPortlet(MashupPortlet.NAME,
MashupPortlet.KEY, 300);
news.getConfiguration().put(
new PropertySimple("address",
"http://rhq-project.org/display/RHQ/RHQ+News?decorator=popup"));
- dashboard.addPortlet(news, 0, 2);
+ dashboard.addPortlet(news, columnIndex, rowIndex++);
// Right Column
+ columnIndex = 1;
+ rowIndex = 0;
+
DashboardPortlet recentAlerts = new DashboardPortlet(RecentAlertsPortlet.NAME,
RecentAlertsPortlet.KEY, 250);
- dashboard.addPortlet(recentAlerts, 1, 0);
+ dashboard.addPortlet(recentAlerts, columnIndex, rowIndex++);
DashboardPortlet problemResources = new
DashboardPortlet(ProblemResourcesPortlet.NAME,
ProblemResourcesPortlet.KEY, 250);
@@ -388,11 +400,11 @@ public class DashboardsView extends LocatableVLayout implements
DashboardContain
.put(
new PropertySimple(ProblemResourcesPortlet.PROBLEM_RESOURCE_SHOW_HRS,
ProblemResourcesPortlet.defaultValue));
- dashboard.addPortlet(problemResources, 1, 1);
+ dashboard.addPortlet(problemResources, columnIndex, rowIndex++);
DashboardPortlet operations = new DashboardPortlet(OperationHistoryPortlet.NAME,
OperationHistoryPortlet.KEY,
200);
- dashboard.addPortlet(operations, 1, 2);
+ dashboard.addPortlet(operations, columnIndex, rowIndex++);
return dashboard;
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/help/HelpView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/help/HelpView.java
index 22a0c13..8f4df4b 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/help/HelpView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/help/HelpView.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2010 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
@@ -26,7 +26,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.MissingResourceException;
-import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.Label;
@@ -41,7 +40,6 @@ import
org.rhq.enterprise.gui.coregui.client.components.view.NavigationItem;
import org.rhq.enterprise.gui.coregui.client.components.view.NavigationSection;
import org.rhq.enterprise.gui.coregui.client.components.view.ViewFactory;
import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
@@ -96,20 +94,8 @@ public class HelpView extends AbstractSectionedLeftNavigationView {
"[SKIN]/../actions/help.png", new ViewFactory() {
public Canvas createView() {
final AboutModalWindow aboutModalWindow = new
AboutModalWindow(extendLocatorId("AboutModalWindow"));
- if (PRODUCT_INFO == null) {
- GWTServiceLookup.getSystemService().getProductInfo(new
AsyncCallback<ProductInfo>() {
- public void onFailure(Throwable caught) {
-
CoreGUI.getErrorHandler().handleError(MSG.view_aboutBox_failedToLoad(), caught);
- }
-
- public void onSuccess(ProductInfo result) {
- PRODUCT_INFO = result;
-
aboutModalWindow.setTitle(MSG.view_aboutBox_title(PRODUCT_INFO.getFullName()));
- }
- });
- } else {
-
aboutModalWindow.setTitle(MSG.view_aboutBox_title(PRODUCT_INFO.getFullName()));
- }
+ ProductInfo productInfo = CoreGUI.get().getProductInfo();
+
aboutModalWindow.setTitle(MSG.view_aboutBox_title(productInfo.getFullName()));
aboutModalWindow.show();
return aboutModalWindow;
}
commit 6f0df962341bc372463d2b2444a8626b0f472985
Author: John Sanda <jsanda(a)redhat.com>
Date: Thu Sep 1 15:55:25 2011 -0400
Fixing syntax error
diff --git a/publish_release.sh b/publish_release.sh
index 3a12b7a..2be9db9 100755
--- a/publish_release.sh
+++ b/publish_release.sh
@@ -219,7 +219,7 @@ export LANG
echo
echo "========================== Environment Variables
=============================="
echo "JAVA_HOME=$JAVA_HOME"
-[ "$RELEASE_TYPE" = "enterprise" ]"
+[ "$RELEASE_TYPE" = "enterprise" ]
#[ "$RELEASE_TYPE" = "enterprise" ] && echo
"JAVA5_HOME=$JAVA5_HOME"
echo "M2_HOME=$M2_HOME"
echo "MAVEN_OPTS=$MAVEN_OPTS"
commit 723ed5e890b66339daa4a20170afcea4343629dd
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Thu Sep 1 13:30:39 2011 -0400
[BZ 608798, 608803] changes to LoginView and MenuBarView to allow RHQ logos to
be replaced with JON logos, even if the JON logo images are not the same width
and height as the RHQ logo images
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 5e915c6..c5b8f43 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
@@ -35,6 +35,7 @@ import com.google.gwt.http.client.URL;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.FormErrorOrientation;
+import com.smartgwt.client.types.ImageStyle;
import com.smartgwt.client.types.VerticalAlignment;
import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.IButton;
@@ -119,9 +120,16 @@ public class LoginView extends LocatableCanvas {
form.setShowErrorText(true);
form.setErrorOrientation(FormErrorOrientation.BOTTOM);
+ // NOTE: This image will either be an RHQ logo or a JON logo.
+ Img logoImg = new Img("header/rhq_logo_28px.png");
+ // NOTE: Don't explicitly specify a width, so the width will be scaled
proportionally to the height.
+ logoImg.setImageType(ImageStyle.NORMAL);
+ logoImg.setImageHeight(40);
+
CanvasItem logo = new CanvasItem();
- logo.setCanvas(new Img("header/rhq_logo_28px.png", 80, 28));
logo.setShowTitle(false);
+ logo.setHeight(logoImg.getImageHeight() + 4);
+ logo.setCanvas(logoImg);
HeaderItem header = new HeaderItem();
header.setValue(MSG.view_login_prompt());
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
index 5687c75..6a614bb 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
@@ -20,6 +20,7 @@ package org.rhq.enterprise.gui.coregui.client.components;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.Version;
+import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.types.VerticalAlignment;
import com.smartgwt.client.widgets.Button;
@@ -99,12 +100,12 @@ public class AboutModalWindow extends LocatableWindow {
private void finishOnInit() {
LocatableVLayout contentPane = new
LocatableVLayout(extendLocatorId("Content"));
- contentPane.setPadding(15);
+ contentPane.setPadding(13);
contentPane.setMembersMargin(25);
HTMLFlow htmlFlow = new HTMLFlow();
String html = "<span class=\"DisplaySubhead\">\n" +
" <a href=\"" + PRODUCT_INFO.getUrl() + "\"
title=\""
- + PRODUCT_INFO.getFullName() + " " + MSG.view_aboutBox_homepage() +
"\" target=\"_blank\">"
+ + PRODUCT_INFO.getFullName() + " " + PRODUCT_INFO.getUrl() +
"\" target=\"_blank\">"
+ PRODUCT_INFO.getFullName() + "</a>\n" +
"</span><br/>\n" + "<span
class=\"DisplayLabel\">"
+ MSG.view_aboutBox_version() + " " + PRODUCT_INFO.getVersion() +
"</span><br/>\n"
+ "<span class=\"DisplayLabel\">" +
MSG.view_aboutBox_buildNumber() + " " + PRODUCT_INFO.getBuildNumber()
@@ -119,12 +120,7 @@ public class AboutModalWindow extends LocatableWindow {
contentPane.addMember(htmlFlow);
LocatableHLayout buttonBar = new
LocatableHLayout(contentPane.extendLocatorId("ButtonBar"));
- buttonBar.setAlign(VerticalAlignment.BOTTOM);
- contentPane.addMember(buttonBar);
-
- Canvas spacer = new Canvas();
- spacer.setWidth("*");
- buttonBar.addMember(spacer);
+ buttonBar.setAlign(Alignment.RIGHT);
LocatableIButton closeButton = new
LocatableIButton(buttonBar.extendLocatorId("Close"),
MSG.common_button_close());
@@ -138,6 +134,11 @@ public class AboutModalWindow extends LocatableWindow {
});
buttonBar.addMember(closeButton);
+ VLayout bottom = new VLayout();
+ bottom.setAlign(VerticalAlignment.BOTTOM);
+ bottom.addMember(buttonBar);
+ contentPane.addMember(bottom);
+
// NOTE: Since this is a subclass of Window, we MUST use addItem(), rather than
addMember() from the
// Layout class.
addItem(contentPane);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
index f138f6a..3bd11d2 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
@@ -22,6 +22,8 @@ import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.user.client.History;
import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.types.ImageStyle;
+import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.types.VerticalAlignment;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.Img;
@@ -99,13 +101,22 @@ public class MenuBarView extends LocatableVLayout {
private Canvas getLogoSection() {
final AboutModalWindow aboutModalWindow = new
AboutModalWindow(extendLocatorId("AboutModalWindow"));
- Img logo = new Img("header/rhq_logo_28px.png", 80, 28);
+ HLayout logoSection = new HLayout();
+ logoSection.setOverflow(Overflow.VISIBLE);
+
+ // NOTE: This image will either be an RHQ logo or a JON logo.
+ Img logo = new Img("header/rhq_logo_28px.png");
+ // NOTE: Don't explicitly specify a width, so the width will be scaled
proportionally to the height.
+ logo.setImageType(ImageStyle.NORMAL);
+ logo.setImageHeight(28);
logo.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
aboutModalWindow.show();
}
});
- return logo;
+
+ logoSection.addMember(logo);
+ return logoSection;
}
private Canvas getLinksSection() {
commit 8b92144361a72e581ed0106c56e848bb7a0a7415
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Thu Sep 1 12:37:01 2011 -0500
BZ684320 - Updated permissions only for the zip archives of server and agent to 744.
diff --git a/modules/enterprise/agent/ant-run.xml b/modules/enterprise/agent/ant-run.xml
index 384e283..418009d 100644
--- a/modules/enterprise/agent/ant-run.xml
+++ b/modules/enterprise/agent/ant-run.xml
@@ -211,7 +211,7 @@ Ant Script that provides ways to package the Agent.
<delete
file="${basedir}/target/rhq-enterprise-agent-${project.version}.zip" />
<zip
destfile="${basedir}/target/rhq-enterprise-agent-${project.version}.zip" >
<!-- The zip task does not mantain file permissions, we have to make sure they
are set here -->
- <zipfileset dir="${basedir}/target">
+ <zipfileset dir="${basedir}/target" filemode="744"
dirmode="744">
<include name="rhq-agent/**"/>
<exclude name="rhq-agent/bin/*.sh"/>
<exclude name="rhq-agent/lib/*.so"/>
@@ -220,7 +220,7 @@ Ant Script that provides ways to package the Agent.
<exclude name="rhq-agent/lib/*.dylib"/>
<exclude name="rhq-agent/lib/augeas/**" />
</zipfileset>
- <zipfileset dir="${basedir}/target" filemode="755">
+ <zipfileset dir="${basedir}/target" filemode="755"
dirmode="744">
<include name="rhq-agent/bin/*.sh"/>
<include name="rhq-agent/lib/*.so"/>
<include name="rhq-agent/lib/*.sl"/>
diff --git a/modules/enterprise/server/container/pom.xml
b/modules/enterprise/server/container/pom.xml
index d27c157..42cc43c 100644
--- a/modules/enterprise/server/container/pom.xml
+++ b/modules/enterprise/server/container/pom.xml
@@ -8,7 +8,7 @@
<version>4.1.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
-
+
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server-container</artifactId>
<packaging>pom</packaging>
@@ -250,6 +250,10 @@
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
+ <archiverConfig>
+ <!-- permissions for archiver configuration are in decimal (not octal)
-->
+ <defaultDirectoryMode>484</defaultDirectoryMode>
+ </archiverConfig>
<descriptors>
<descriptor>src/main/scripts/rhq-container.assembly.xml</descriptor>
</descriptors>
diff --git
a/modules/enterprise/server/container/src/main/scripts/rhq-container.assembly.xml
b/modules/enterprise/server/container/src/main/scripts/rhq-container.assembly.xml
index a6dbf98..816ab0d 100644
--- a/modules/enterprise/server/container/src/main/scripts/rhq-container.assembly.xml
+++ b/modules/enterprise/server/container/src/main/scripts/rhq-container.assembly.xml
@@ -20,8 +20,10 @@
<exclude>**/*.sl</exclude>
<exclude>**/*.dylib</exclude>
</excludes>
+ <fileMode>0744</fileMode>
+ <directoryMode>0744</directoryMode>
</fileSet>
- <fileSet>
+ <fileSet>
<directory>${project.build.outputDirectory}</directory>
<outputDirectory>/</outputDirectory>
<includes>
@@ -30,7 +32,8 @@
<include>**/*.sl</include>
<include>**/*.dylib</include>
</includes>
- <fileMode>0755</fileMode>
+ <fileMode>0744</fileMode>
+ <directoryMode>0744</directoryMode>
</fileSet>
</fileSets>
</assembly>
\ No newline at end of file
commit 153c9845c2ac28079b9629b4cc445d7eccca8901
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Sep 1 10:11:40 2011 -0400
[BZ 734879 - Drift display issue ... Change Sets-->Context Menu--->Details]
Even if the table view is not visible, it may not be hidden. Instead, it
may be the case that its parent (the encompassing Table/HLayout) may not
be visible. This is unusual because typically we switch between the table
and detail view while under the subtab, but if we navigate to the detail
view from another subtab (for example, the drift tree context
menu) the Table may not be visible and the table view may not be hidden.
To make a long story short, ensure the table view is hidden when
displaying the details view.
- Also, convert History,newItem occurrences in BackButton and
StringIdTableSection to CoreGUI.gotToView. We should not be using
History.newItem in most places because it bypasses some view processing
we do in goToView prior to calling History.newItem. I see more
occurrences of this but will hold off changing until after the pending
release.
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/buttons/BackButton.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/buttons/BackButton.java
index 7054d2e..aaa6688 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/buttons/BackButton.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/buttons/BackButton.java
@@ -22,10 +22,10 @@
*/
package org.rhq.enterprise.gui.coregui.client.components.buttons;
-import com.google.gwt.user.client.History;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableStretchImgButton;
/**
@@ -43,7 +43,7 @@ public class BackButton extends LocatableStretchImgButton {
setTitle("<b>" + title + "</b>");
addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
- History.newItem((anchor.startsWith("#")) ? anchor.substring(1)
: anchor);
+ CoreGUI.goToView(anchor);
}
});
setAutoFit(true);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/AbstractTableSection.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/AbstractTableSection.java
index 8c4ee37..2ccfb53 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/AbstractTableSection.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/AbstractTableSection.java
@@ -329,6 +329,7 @@ public abstract class AbstractTableSection<DS extends
RPCDataSource, ID> extends
// If the Table has not yet been initialized then ignore
if (contents != null) {
+ // If the table view is visible then gracefully switch to the details view.
if (contents.isVisible()) {
contents.animateHide(AnimationEffect.WIPE, new AnimationCallback() {
@Override
@@ -337,6 +338,14 @@ public abstract class AbstractTableSection<DS extends
RPCDataSource, ID> extends
}
});
} else {
+ // Even if the table view is not visible, it may not be hidden. Instead,
it may be the
+ // case that its parent (the encompassing Table/HLayout) may not be
visible. This is unusual
+ // because typically we switch between the table and detail view while
under the subtab, but
+ // if we navigate to the detail view from another subtab (for example,
the drift tree context
+ // menu) the Table may not be visible and the table view may not be
hidden. To make a long
+ // story short, ensure the table view is hidden when displaying the
details view.
+ contents.hide();
+
/*
* if the programmer chooses to go directly from the detailView in
create-mode to the
* detailsView in edit-mode, the content canvas will already be hidden,
which means the
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/StringIDTableSection.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/StringIDTableSection.java
index 1c5a333..1235751 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/StringIDTableSection.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/StringIDTableSection.java
@@ -19,7 +19,6 @@
package org.rhq.enterprise.gui.coregui.client.components.table;
-import com.google.gwt.user.client.History;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.data.SortSpecifier;
import com.smartgwt.client.widgets.Canvas;
@@ -38,6 +37,7 @@ import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
*
* @author John Mazzitelli
*/
+@SuppressWarnings("unchecked")
public abstract class StringIDTableSection<DS extends RPCDataSource> extends
AbstractTableSection<DS, String> {
public StringIDTableSection(String locatorId, String tableTitle, boolean
autoFetchData) {
@@ -93,7 +93,7 @@ public abstract class StringIDTableSection<DS extends
RPCDataSource> extends Abs
@Override
public void showDetails(String id) {
if (id != null && id.length() > 0) {
- History.newItem(getBasePath() + "/" +
convertIDToCurrentViewPath(id));
+ CoreGUI.goToView(getBasePath() + "/" +
convertIDToCurrentViewPath(id));
} else {
String msg = MSG.view_tableSection_error_badId(this.getClass().toString(),
(id == null) ? "null" : id
.toString());
commit b6125949237abceab2abd2fcee70f339f12c4fa6
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Aug 31 22:33:19 2011 -0400
[BZ 734881] Need to check for empty content because oracle blobs don't handle it
When a file is empty we still persist a row for it in rhq_drift_file.
The blob is set to null. This works fine on postgresql, but results in
the NPE reported in BZ 734881. To work around this, we now check the
size which is also stored in the rhq_drift_file table, and if the size
is zero, DriftManagerBean.getDriftFileContent just returns an empty
stream instead of opening an input stream on the blob.
This required one additional change. We previously were not storing the
size in rhq_drift_file. I have updated
JPADriftServerBean.persistDriftFileData to save the size now as well.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java
index daa7a68..16e0d73 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java
@@ -211,12 +211,13 @@ public class JPADriftServerBean implements JPADriftServerLocal {
@Override
@TransactionAttribute(REQUIRES_NEW)
- public void persistDriftFileData(JPADriftFile driftFile, InputStream data) throws
Exception {
+ public void persistDriftFileData(JPADriftFile driftFile, InputStream data, long
numBytes) throws Exception {
JPADriftFileBits df = entityManager.find(JPADriftFileBits.class,
driftFile.getHashId());
if (null == df) {
throw new IllegalArgumentException("JPADriftFile not found [" +
driftFile.getHashId() + "]");
}
+ df.setDataSize(numBytes);
df.setData(Hibernate.createBlob(new BufferedInputStream(data)));
df.setStatus(LOADED);
}
@@ -377,7 +378,7 @@ public class JPADriftServerBean implements JPADriftServerLocal {
for (File file : dir.listFiles()) {
JPADriftFile driftFile = new JPADriftFile(file.getName());
try {
- JPADriftServer.persistDriftFileData(driftFile, new
FileInputStream(file));
+ JPADriftServer.persistDriftFileData(driftFile, new FileInputStream(file),
file.length());
} catch (Exception e) {
LogFactory.getLog(getClass()).info("Skipping bad drift file",
e);
}
@@ -400,6 +401,9 @@ public class JPADriftServerBean implements JPADriftServerLocal {
try {
JPADriftFileBits content = (JPADriftFileBits)
entityManager.createNamedQuery(
JPADriftFileBits.QUERY_FIND_BY_ID).setParameter("hashId",
hash).getSingleResult();
+ if (content.getDataSize() == null || content.getDataSize() < 1) {
+ return "";
+ }
byte[] bytes = StreamUtil.slurp(content.getBlob().getBinaryStream());
return new String(bytes);
} catch (SQLException e) {
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerLocal.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerLocal.java
index 7142ead..9da1a5b 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerLocal.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerLocal.java
@@ -85,7 +85,7 @@ public interface JPADriftServerLocal {
* @param data
* @throws Exception
*/
- void persistDriftFileData(JPADriftFile driftFile, InputStream data) throws
Exception;
+ void persistDriftFileData(JPADriftFile driftFile, InputStream data, long numBytes)
throws Exception;
/**
* This method stores the provided change-set file for the resource. The version will
be incremented based
commit 59387081b9bf66be0970958473d8cc52debae774
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Wed Aug 31 17:33:18 2011 -0400
[BZ 734610] remove validator on username field that was disallowing usernames
less than 6 characters long (
https://bugzilla.redhat.com/show_bug.cgi?id=734610)
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 b0d418f..5e915c6 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
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2010 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
@@ -55,7 +55,6 @@ import com.smartgwt.client.widgets.form.fields.SubmitItem;
import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.form.fields.events.KeyPressEvent;
import com.smartgwt.client.widgets.form.fields.events.KeyPressHandler;
-import com.smartgwt.client.widgets.form.validator.LengthRangeValidator;
import com.smartgwt.client.widgets.form.validator.RegExpValidator;
import com.smartgwt.client.widgets.layout.HStack;
@@ -495,16 +494,6 @@ public class LoginView extends LocatableCanvas {
for (FormItem item : form.getFields()) {
String name = item.getName();
if ((name != null) && (!name.isEmpty())) {
- if (name.equals(USERNAME)) {
- LengthRangeValidator validator = new LengthRangeValidator();
- validator.setMin(6);
- item.setValidators(validator);
- }
- if (name.equals(FIRST)) {
- LengthRangeValidator validator = new LengthRangeValidator();
- validator.setMin(1);
- item.setValidators(validator);
- }
if (name.equals(EMAIL)) {
RegExpValidator emailValidator = new RegExpValidator();
emailValidator.setErrorMessage(MSG.view_login_invalidEmail());
commit f4fdec760496263f02cba9e1e713f124e597a83b
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Wed Aug 31 17:18:11 2011 -0400
[BZ 722548] add new #Test/Rpc view that can be used to invoke a new sleep() RPC
method that sleeps for a specified number of seconds; increase default RPC
timeout from 10s to 30s; use custom timeouts for autodiscovery queue,
config history list, group schedules list views, which may exceed even the new
default timeout (
https://bugzilla.redhat.com/show_bug.cgi?id=722548)
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
index 8f5dbc1..c516592 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2010 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
@@ -58,6 +58,10 @@ public class GWTServiceLookup {
return secure(ConfigurationGWTServiceAsync.Util.getInstance());
}
+ public static ConfigurationGWTServiceAsync getConfigurationService(int timeout) {
+ return secure(ConfigurationGWTServiceAsync.Util.getInstance(), timeout);
+ }
+
public static DriftGWTServiceAsync getDriftService() {
return secure(DriftGWTServiceAsync.Util.getInstance());
}
@@ -190,6 +194,10 @@ public class GWTServiceLookup {
return secure(AgentGWTServiceAsync.Util.getInstance());
}
+ public static TestGWTServiceAsync getTestService() {
+ return secure(TestGWTServiceAsync.Util.getInstance());
+ }
+
@SuppressWarnings("unchecked")
private static <T> T secure(Object sdt) {
return (T) secure(sdt, -1);
@@ -208,7 +216,8 @@ public class GWTServiceLookup {
public static class SessionRpcRequestBuilder extends RpcRequestBuilder {
private static int DEBUG_TIMEOUT_FUDGE_FACTOR = 30000;
- private static int DEFAULT_RPC_TIMEOUT = 10000;
+ private static int DEFAULT_RPC_TIMEOUT = 30000;
+
private int timeout;
public SessionRpcRequestBuilder(int timeout) {
@@ -221,7 +230,7 @@ public class GWTServiceLookup {
this.timeout = (timeout <= 0) ? DEFAULT_RPC_TIMEOUT : timeout;
}
- if (CoreGUI.isDebugMode()) {
+ if (CoreGUI.isDebugMode() && (this.timeout != 0)) {
// debug mode is slow, so give requests more time to complete otherwise
you'll get
// weird exceptions whose messages are extremely unhelpful in finding
root cause
this.timeout += DEBUG_TIMEOUT_FUDGE_FACTOR;
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/TestGWTService.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/TestGWTService.java
new file mode 100644
index 0000000..168edfa
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/TestGWTService.java
@@ -0,0 +1,34 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2011 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.gwt;
+
+import com.google.gwt.user.client.rpc.RemoteService;
+
+/**
+ * @author Ian Springer
+ */
+public interface TestGWTService extends RemoteService {
+
+ void sleep(int seconds) throws RuntimeException;
+
+}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/schedules/SchedulesDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/schedules/SchedulesDataSource.java
index 1f4d491..c21484d 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/schedules/SchedulesDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/schedules/SchedulesDataSource.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2010 Red Hat, Inc.
+ * Copyright (C) 2010-2011 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -43,7 +43,10 @@ import org.rhq.enterprise.gui.coregui.client.util.message.Message;
* @author Ian Springer
*/
public class SchedulesDataSource extends AbstractMeasurementScheduleCompositeDataSource
{
- private MeasurementDataGWTServiceAsync measurementService =
GWTServiceLookup.getMeasurementDataService();
+
+ // Specify 60s timeout to compensate for schedule updates taking a long time for
large groups.
+ // TODO (ips, 08/31/11): Remove this once updating of group schedules has been
optimized.
+ private MeasurementDataGWTServiceAsync measurementService =
GWTServiceLookup.getMeasurementDataService(60 * 1000);
private int resourceGroupId;
public SchedulesDataSource(int resourceGroupId) {
@@ -157,4 +160,5 @@ public class SchedulesDataSource extends
AbstractMeasurementScheduleCompositeDat
}
});
}
+
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/AbstractConfigurationHistoryDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/AbstractConfigurationHistoryDataSource.java
index b92fb94..9991f9c 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/AbstractConfigurationHistoryDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/AbstractConfigurationHistoryDataSource.java
@@ -78,7 +78,9 @@ public abstract class AbstractConfigurationHistoryDataSource<T
extends AbstractR
public static final String RESOURCE_ID = "resourceId";
}
- private ConfigurationGWTServiceAsync configurationService =
GWTServiceLookup.getConfigurationService();
+ // Specify 60s timeout to compensate for Configurations being fetched for all of the
config updates.
+ // TODO (ips, 08/31/11): Remove this once fetching of Configurations has been
disabled.
+ private ConfigurationGWTServiceAsync configurationService =
GWTServiceLookup.getConfigurationService(60 * 1000);
protected ConfigurationGWTServiceAsync getConfigurationService() {
return this.configurationService;
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/AutodiscoveryQueueDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/AutodiscoveryQueueDataSource.java
index 6769b9c..cccc08a 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/AutodiscoveryQueueDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/AutodiscoveryQueueDataSource.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2010 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
@@ -65,7 +65,11 @@ public class AutodiscoveryQueueDataSource extends DataSource {
private int unlimited = -1;
private int maximumPlatformsToDisplay = -1;
- private ResourceGWTServiceAsync resourceService =
GWTServiceLookup.getResourceService(1000000);
+
+ // Specify 60s timeout to compensate for slow loading of this view due to lack of
paging of results.
+ // TODO (ips, 08/31/11): Remove this once paging has been implemented.
+ private ResourceGWTServiceAsync resourceService =
GWTServiceLookup.getResourceService(60 * 1000);
+
private PermissionsLoader permissionsLoader = new PermissionsLoader();
private TreeGrid dataContainerReference = null;
private static final Permission MANAGE_INVENTORY = Permission.MANAGE_INVENTORY;
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
index 4daa3c6..9b0cfe3 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
@@ -79,7 +79,14 @@ public class ResourceAutodiscoveryView extends LocatableVLayout
implements Refre
// This allows the selection handler to ignore selection changes initiated by us, as
opposed to by the user.
private boolean selectionChangedHandlerDisabled;
- private ResourceGWTServiceAsync resourceService =
GWTServiceLookup.getResourceService(1000000);
+ private ResourceGWTServiceAsync resourceService =
GWTServiceLookup.getResourceService();
+
+ // Specify 3m timeout to compensate for import taking a long time for a large number
of Resources.
+ // TODO (ips, 08/31/11): Remove this once import has been refactored to be partially
asynchronous, i.e. where the
+ // call to importResources() flips all the Resources to a new
COMMITTING inventory status
+ // and then kicks off a background job to do the actual work of
committing (syncing to
+ // Agents, etc.).
+ private ResourceGWTServiceAsync importResourceService =
GWTServiceLookup.getResourceService(3 * 60 * 1000);
public ResourceAutodiscoveryView(String locatorId) {
super(locatorId);
@@ -317,11 +324,14 @@ public class ResourceAutodiscoveryView extends LocatableVLayout
implements Refre
importButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
disableButtons(selectAllButton, deselectAllButton, importButton,
ignoreButton, unignoreButton);
+ // TODO (ips): Make the below message sticky, but add a new ClearSticky
Message option that the
+ // below callback methods can use to clear it once the
importResources() call has
+ // completed.
CoreGUI.getMessageCenter().notify(
new Message(MSG.view_autoDiscoveryQ_importInProgress(),
Message.Severity.Info, EnumSet
.of(Message.Option.Transient)));
- resourceService.importResources(getSelectedIds(), new
AsyncCallback<Void>() {
+ importResourceService.importResources(getSelectedIds(), new
AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError(MSG.view_autoDiscoveryQ_importFailure(), caught);
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestRpcView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestRpcView.java
new file mode 100644
index 0000000..b3c333f
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestRpcView.java
@@ -0,0 +1,52 @@
+package org.rhq.enterprise.gui.coregui.client.test;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.ButtonItem;
+import com.smartgwt.client.widgets.form.fields.FormItem;
+import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
+import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.gwt.TestGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+
+/**
+ * @author Ian Springer
+ */
+public class TestRpcView extends LocatableVLayout {
+
+ public TestRpcView(String locatorId) {
+ super(locatorId);
+ setMargin(10);
+
+ DynamicForm form = new DynamicForm();
+ form.setWidth(400);
+
+ final FormItem item = new FormItem("seconds");
+ item.setTitle("Seconds to sleep");
+ item.setRequired(true);
+
+ ButtonItem button = new ButtonItem("execute", "Execute");
+ button.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent event) {
+ TestGWTServiceAsync testService = GWTServiceLookup.getTestService();
+ final int seconds = Integer.valueOf((String)item.getValue());
+ testService.sleep(seconds, new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("sleep(" +
seconds + ") RPC call failed.", caught);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(new Message("sleep("
+ seconds + ") RPC completed."));
+ }
+ });
+ }
+ });
+ form.setItems(item, button);
+
+ addMember(form);
+ }
+
+}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestTopView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestTopView.java
index 58a6cd6..a9e131b 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestTopView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestTopView.java
@@ -79,6 +79,7 @@ public class TestTopView extends AbstractSectionedLeftNavigationView {
private static final ViewName MISC_SECTION_VIEW_ID = new ViewName("Misc");
private static final ViewName PAGE_PLURALIZATION_TEST = new
ViewName("PluralizationTest");
private static final ViewName PAGE_ASYNC = new ViewName("Async");
+ private static final ViewName PAGE_RPC = new ViewName("Rpc");
public TestTopView() {
// This is a top level view, so our locator id can simply be our view id.
@@ -235,7 +236,13 @@ public class TestTopView extends AbstractSectionedLeftNavigationView
{
}
});
- return new NavigationSection(MISC_SECTION_VIEW_ID, pluralizationItem,
asyncItem);
+ NavigationItem rpcItem = new NavigationItem(PAGE_RPC, null, new ViewFactory() {
+ public Canvas createView() {
+ return new TestRpcView(extendLocatorId(PAGE_RPC.getName()));
+ }
+ });
+
+ return new NavigationSection(MISC_SECTION_VIEW_ID, pluralizationItem, asyncItem,
rpcItem);
}
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/TestGWTServiceImpl.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/TestGWTServiceImpl.java
new file mode 100644
index 0000000..8f9a518
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/TestGWTServiceImpl.java
@@ -0,0 +1,43 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2011 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.enterprise.gui.coregui.server.gwt;
+
+import org.rhq.enterprise.gui.coregui.client.gwt.TestGWTService;
+
+/**
+ * @author Ian Springer
+ */
+public class TestGWTServiceImpl extends AbstractGWTServiceImpl implements TestGWTService
{
+
+ private static final long serialVersionUID = 1L;
+
+ public void sleep(int seconds) throws RuntimeException {
+ try {
+ Thread.sleep(seconds * 1000);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw getExceptionToThrowToClient(e);
+ }
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
b/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
index c4943ed..ebc12f5 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
+++ b/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
@@ -161,6 +161,10 @@
<servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI
DriftGWTService</servlet-name>
<servlet-class>org.rhq.enterprise.gui.coregui.server.gwt.DriftGWTServiceImpl</servlet-class>
</servlet>
+ <servlet>
+ <servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI
TestGWTService</servlet-name>
+
<servlet-class>org.rhq.enterprise.gui.coregui.server.gwt.TestGWTServiceImpl</servlet-class>
+ </servlet>
<servlet-mapping>
@@ -311,6 +315,10 @@
<servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI
DriftGWTService</servlet-name>
<url-pattern>/org.rhq.enterprise.gui.coregui.CoreGUI/DriftGWTService</url-pattern>
</servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI
TestGWTService</servlet-name>
+
<url-pattern>/org.rhq.enterprise.gui.coregui.CoreGUI/TestGWTService</url-pattern>
+ </servlet-mapping>
<welcome-file-list>
commit 3bcea7dc24cf65119b17b2f19a95e21777980082
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Aug 31 14:25:07 2011 -0400
[BZ 734814] Adding docs
diff --git a/modules/enterprise/remoting/cli/src/main/samples/drift.js
b/modules/enterprise/remoting/cli/src/main/samples/drift.js
index 5a1e6e0a..ff7c31a 100644
--- a/modules/enterprise/remoting/cli/src/main/samples/drift.js
+++ b/modules/enterprise/remoting/cli/src/main/samples/drift.js
@@ -1,10 +1,64 @@
-// This script has a dependency on rhq/etc/cl-scripts/util.js. The following
-// command needs to be run in order to load the functions in util.js:
-//
-// exec -f /path/to/rhq/etc/cli-scripts/util.js
-//
-// Then the same exec command can be run to load functions in this script.
+/**
+ * file: drift.js
+ *
+ * description: This script contains functions that illustrate and highlight
+ * drift monitoring functionality. Some of the functionality demonstrated in
+ * this script is currently available only via RHQ's remote client (and CLI)
+ * at the time of this writing. This script has a dependency on util.js. To
+ * load this script's functions into your CLI session execute the following
+ * from the CLI shell,
+ *
+ * $ login <username> <password>
+ * $ exec -f samples/util.js
+ * $ exec -f samples/drift.js
+ *
+ * Note that you must login before you can load the scripts. Also please note
+ * that if a function is not documented, then it is not intended for public
+ * use. It is used only as an internal helper function.
+ *
+ * author: jsanda(a)redhat.com
+ */
+/**
+ * description: Generates a snapshot of changes sets belonging to a particular
+ * drift configuration of a specific resource. By default all change sets are
+ * included in the snapshot. An optional third argument can be specified to
+ * limit or control the number of change sets included in the snapshot.
+ *
+ * Note that a snapshot is an accumulation or aggregation of change sets that
+ * provides a view of a resource, or more precisely, all files being monitored
+ * for drift, at a particular version or point in time.
+ *
+ * arguments:
+ * rid: A resource id, expected to be an integer
+ *
+ * cname: The drift configuration name as a string
+ *
+ * filters: (optional) A map or JS object that limits the number of
+ * change sets included in the snapshot
+ *
+ * return: A org.rhq.core.domamin.drift.DriftSnapshot object
+ *
+ * usage:
+ * // generates a snapshot that includes all change sets belonging to the
+ * // mydrift drift configuration.
+ * createSnapshot(123, 'mydrift')
+ *
+ * // generates a snapshot starting a change set version 3 and including
+ * // everything more recent than it.
+ * createSnapshot(123, 'mydrift', {"startVersion": 3})
+ *
+ * // generates a snapshot that includes change sets 3 through 5 inclusive.
+ * createSnapshot(123, 'mydrift', {"startVersion": 3,
"endVersion": 5})
+ *
+ * // generates a snaphot that includes everything after the specified
+ * // timestamp. Note that the timestamp should be specified in milliseconds.
+ * createSnapshot(123, 'mydrift', {"createdAfter": 1314811734365})
+ *
+ * // generates a snapshot that includes all change sets that were created
+ * // between the two timestamps.
+ * createSnapshot(123, 'mydrift', {"createdAfter": 1314811734365,
"createdBefore": 9994811734365})
+ */
function createSnapshot(rid, cname) {
var config = findDriftConfig(rid, function(c) { return cname.equals(c.name) });
@@ -35,6 +89,39 @@ function findDriftConfig(rid, filter) {
});
}
+/**
+ * description: Generates a diff report that is printed to the console. By
+ * default this function generates a snapshot diff. The function expects two
+ * arguments which should be DriftSnapshot objects. A diff between those two
+ * snapshots is generated and printed to the console. A path can be specified
+ * as an optional third argument. If a path is a specified as a third argument,
+ * then a file diff will be performed using the file that matches the path in
+ * each change set. The format will be a unified diff.
+ *
+ * Note that the snapshots can be from the same or from different resources;
+ * however, if they are from different resources, it is assumed that the
+ * resources are of the same type.
+ *
+ * arguments:
+ * s1: A DriftSnapshot object
+ *
+ * s2: A DriftSnapshot object
+ *
+ * path: (optional) A string that specifies a path that exists in both s1 and
+ * s2.
+ *
+ * return: This function does not return a useful value. It may be an empty
+ * string or it could be null. Instead of returns its results, the function
+ * prints them to the CLI console. As such, this function is intended for
+ * use from the interactive CLI shell.
+ *
+ * usage:
+ * // Generates a snapshot diff report
+ * diff(s1, s2)
+ *
+ * // Generates a file diff report in the unified format
+ * diff(s1, s2, 'jboss_home/bin/run.conf')
+ */
function diff(s1, s2) {
var theDiff = s1.diff(s2);
@@ -73,12 +160,40 @@ function diff(s1, s2) {
report('elements not in right', theDiff.elementsNotInRight);
}
+/**
+ * description: Generates and returns the drift history for a file being
+ * monitored for drift. This function takes three arguments. The first two, the
+ * resource id drift configuration name, uniquely identify the drift
+ * configuration. The third argument specifies a path that is set up for
+ * monitoring by the drift configuration.
+ *
+ * arguments:
+ * rid: A resource id
+ *
+ * configName: A drift configuration name
+ *
+ * path: A path that is set up for drift monitoring by the drift
+ * configuration that is identified by the first two arguments. The path
+ * should be specified as relative to the base directory from which
+ * monitoring is done.
+ *
+ * return: A History object, which is a native JS object. This object contains
+ * a few methods for working with the file history:
+ *
+ * list: prints a short summary of all versions of the file
+ * view: returns the contents of a particular version of the file
+ * compare: compares two versions of the file and prints a unified diff
+ *
+ * usage:
+ * $ history = fetchHistory(123, 'mydrift', 'bin/run.conf')
+ * $ history.list() // prints a summary of all versions of 'bin/run.conf'
+ * $ history.view(1) // returns the full contents of version 1 of the file
+ * $ history.compare(1, 2) // generates and prints a unified diff of versions 1 and 2
+ */
function fetchHistory(rid, configName, path) {
function History() {
var entries = [];
- this.echo = function(msg) {println(msg);}
-
function findDrift(version) {
return find(entries, function(drift) {
return drift.changeSet.version == version
@@ -139,26 +254,4 @@ function fetchHistory(rid, configName, path) {
}
return new History();
-
-/*
- var criteria = GenericDriftCriteria();
- criteria.addFilterResourceIds([rid]);
- criteria.fetchChangeSet(true);
- criteria.addFilterPath(path);
-
- var drifts = DriftManager.findDriftsByCriteria(criteria);
- var history = [];
- foreach(drifts, function(drift) {
- if (drift.changeSet.driftConfiguration.name == configName &&
- drift.path == path) {
- history.push(drift);
- }
- });
-
- history.sort(function(d1, d2) {
- return d1.changeSet.version <= d2.changeSet.version
- });
-
- return history;
-*/
}
diff --git a/modules/enterprise/remoting/cli/src/main/samples/util.js
b/modules/enterprise/remoting/cli/src/main/samples/util.js
index e0bb219..0369fe8 100644
--- a/modules/enterprise/remoting/cli/src/main/samples/util.js
+++ b/modules/enterprise/remoting/cli/src/main/samples/util.js
@@ -1,4 +1,21 @@
/**
+ * file: util.js
+ *
+ * description: This script contains functions that provide core, low-level
+ * functionality such as iterating over a collection or searching a collection.
+ * This has no other script or library dependencies. To load the functions into
+ * your CLI session execute the following from the CLI shell,
+ *
+ * $ login <username> <password>
+ * $ exec -f samples/util.js
+ *
+ * Note that you must login before you can load the script.
+ *
+ * author: jsanda(a)redhat.com
+ */
+
+
+/**
* If obj is a JS array or a java.util.Collection, each element is passed to
* the callback function. If obj is a java.util.Map, each map entry is passed
* to the callback function as a key/value pair. If obj is none of the
commit 5d4fbbefb4f9ee8767e3fb8e18c87a95bdd80d79
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Aug 31 12:49:03 2011 -0400
[BZ 734842] Adding more detailed logging around drift detection
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java
index 4bffe9e..d2956d3 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java
@@ -243,8 +243,8 @@ public class DriftManager extends AgentService implements
DriftAgentService, Dri
@Override
public void detectDrift(int resourceId, DriftConfiguration driftConfiguration) {
- if (log.isDebugEnabled()) {
- log.debug("Received request to schedule drift detection immediately for
[resourceId: " + resourceId
+ if (log.isInfoEnabled()) {
+ log.info("Received request to schedule drift detection immediately for
[resourceId: " + resourceId
+ ", driftConfigurationId: " + driftConfiguration.getId() +
", driftConfigurationName: "
+ driftConfiguration.getName() + "]");
}
@@ -258,16 +258,41 @@ public class DriftManager extends AgentService implements
DriftAgentService, Dri
}
log.debug("Resetting " + schedule + " for immediate
detection.");
schedule.resetSchedule();
- schedulesQueue.addSchedule(schedule);
+ boolean queueUpdated = schedulesQueue.addSchedule(schedule);
+
+ if (queueUpdated) {
+ if (log.isDebugEnabled()) {
+ log.debug(schedule + " has been added to " + schedulesQueue +
" for immediate detection.");
+ }
+ } else {
+ log.warn("Failed to add " + schedule + " to " +
schedulesQueue + " for immediate detection.");
+ }
}
@Override
public void scheduleDriftDetection(int resourceId, DriftConfiguration
driftConfiguration) {
- schedulesQueue.addSchedule(new DriftDetectionSchedule(resourceId,
driftConfiguration));
+ DriftDetectionSchedule schedule = new DriftDetectionSchedule(resourceId,
driftConfiguration);
+ if (log.isInfoEnabled()) {
+ log.info("Scheduling drift detection for " + schedule);
+ }
+ boolean added = schedulesQueue.addSchedule(schedule);
+
+ if (added) {
+ if (log.isDebugEnabled()) {
+ log.debug(schedule + " has been added to " + schedulesQueue);
+ } else {
+ log.warn("Failed to add " + schedule + " to " +
schedulesQueue);
+ }
+ }
}
@Override
public boolean requestDriftFiles(int resourceId, Headers headers, List<? extends
DriftFile> driftFiles) {
+ if (log.isInfoEnabled()) {
+ log.info("Server is requesting files for [resourceId: " +
resourceId + ", driftConfigurationId: " +
+ headers.getDriftCofigurationId() + ", driftConfigurationName: "
+ headers.getDriftConfigurationName() +
+ "]");
+ }
DriftFilesSender sender = new DriftFilesSender();
sender.setResourceId(resourceId);
sender.setDriftClient(this);
@@ -282,8 +307,8 @@ public class DriftManager extends AgentService implements
DriftAgentService, Dri
@Override
public void unscheduleDriftDetection(final int resourceId, final DriftConfiguration
driftConfiguration) {
- log.debug("Received request to unschedule drift detection for
[resourceId:" + resourceId +
- ", driftConfigurationId:" + driftConfiguration.getId() + ",
driftConfigurationName: " +
+ log.info("Received request to unschedule drift detection for
[resourceId:" + resourceId +
+ ", driftConfigurationId: " + driftConfiguration.getId() + ",
driftConfigurationName: " +
driftConfiguration.getName() + "].");
DriftDetectionSchedule schedule = schedulesQueue.removeAndExecute(resourceId,
driftConfiguration,
@@ -298,15 +323,29 @@ public class DriftManager extends AgentService implements
DriftAgentService, Dri
}
});
- log.debug("Removed " + schedule + " from the schedule
queue.");
+ if (log.isDebugEnabled()) {
+ log.debug("Removed " + schedule + " from the queue " +
schedulesQueue);
+ }
}
@Override
public void updateDriftDetection(int resourceId, DriftConfiguration
driftConfiguration) {
+ log.info("Received request to update schedule for [resourceId: " +
resourceId + ", driftConfigurationId: " +
+ driftConfiguration.getId() + ", driftConfigurationName: " +
driftConfiguration.getName() + "]");
DriftDetectionSchedule updatedSchedule = schedulesQueue.update(resourceId,
driftConfiguration);
if (updatedSchedule == null) {
updatedSchedule = new DriftDetectionSchedule(resourceId,
driftConfiguration);
- schedulesQueue.addSchedule(updatedSchedule);
+ if (log.isInfoEnabled()) {
+ log.info("Adding " + updatedSchedule + " to " +
schedulesQueue);
+ }
+ boolean added = schedulesQueue.addSchedule(updatedSchedule);
+ if (added) {
+ if (log.isDebugEnabled()) {
+ log.debug(updatedSchedule + " has been added to " +
schedulesQueue);
+ }
+ } else {
+ log.warn("Failed to add " + updatedSchedule + " to "
+ schedulesQueue);
+ }
}
InventoryManager inventoryMgr =
PluginContainer.getInstance().getInventoryManager();
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/ScheduleQueueImpl.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/ScheduleQueueImpl.java
index f944299..003868d 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/ScheduleQueueImpl.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/ScheduleQueueImpl.java
@@ -166,4 +166,25 @@ public class ScheduleQueueImpl implements ScheduleQueue {
lock.writeLock().unlock();
}
}
+
+ @Override
+ public String toString() {
+ try {
+ lock.readLock().lock();
+ if (queue.isEmpty()) {
+ return "ScheduleQueue[]";
+ }
+ StringBuilder buffer = new StringBuilder("ScheduleQueue[");
+ for (DriftDetectionSchedule schedule : queue) {
+ buffer.append(schedule).append(", ");
+ }
+ int end = buffer.length();
+ buffer.delete(end - 2, end);
+ buffer.append("]");
+
+ return buffer.toString();
+ } finally {
+ lock.readLock().unlock();
+ }
+ }
}
commit e7acb51347c550e38c5a35d6a5fbba61e5908110
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Wed Aug 31 18:03:07 2011 +0200
BZ 707669 - Forgot to check in the plugin-container pom that actually fetches the
augeas-native as its dependency.
diff --git a/modules/core/plugin-container/pom.xml
b/modules/core/plugin-container/pom.xml
index 1d12869..5e8397b 100644
--- a/modules/core/plugin-container/pom.xml
+++ b/modules/core/plugin-container/pom.xml
@@ -104,7 +104,8 @@
<dependency>
<groupId>net.augeas</groupId>
<artifactId>augeas-native</artifactId>
- <version>0.7.1.1</version>
+ <version>${augeas.version}</version>
+ <classifier>${augeas.classifier}</classifier>
<type>zip</type>
</dependency>
commit 405c128a92bd65d24dad5ae40b26e2b6bfc12a84
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Wed Aug 31 17:27:43 2011 +0200
BZ 707669 - The bundled native augeas libraries have been bumped to version 0.9.0.
diff --git a/modules/enterprise/agent/ant-run.xml b/modules/enterprise/agent/ant-run.xml
index 20617c5..384e283 100644
--- a/modules/enterprise/agent/ant-run.xml
+++ b/modules/enterprise/agent/ant-run.xml
@@ -12,8 +12,11 @@ Ant Script that provides ways to package the Agent.
<property name="settings.localRepository"
location="${user.home}/.m2/repository"/>
<property name="project.version" value="2.0.0-SNAPSHOT"/>
<property name="sigar.version" value="1.6.5.132"/>
- <property name="augeas.version" value="0.7.1.1"/>
- <property name="augeas.zip.version" value="0.7.1"/>
+ <property name="augeas.version" value="0.9.0"/>
+ <property name="augeas.classifier" value="el5"/>
+ <property name="augeas.zip.location"
value="${settings.localRepository}/net/augeas/augeas-native/${augeas.version}/"/>
+ <property name="augeas.zip.mask"
value="*-${augeas.classifier}.zip"/>
+ <property name="augeas.zip.version" value="0.9.0"/>
<property name="getopt.version" value="1.0.13"/>
<property name="jaxb-api.version" value="2.1"/>
<property name="jaxb-impl.version" value="2.1"/>
@@ -79,8 +82,8 @@ Ant Script that provides ways to package the Agent.
<include
name="org/hyperic/sigar-dist/${sigar.version}/sigar-dist-${sigar.version}.zip"
/>
</fileset>
- <fileset dir="${settings.localRepository}"
id="augeas.native.fileset">
- <include
name="net/augeas/augeas-native/${augeas.version}/augeas-native-${augeas.version}.zip"
/>
+ <fileset dir="${augeas.zip.location}"
id="augeas.native.fileset">
+ <include name="${augeas.zip.mask}" />
</fileset>
<fileset dir="${settings.localRepository}"
id="plugins.fileset">
diff --git a/modules/enterprise/agent/pom.xml b/modules/enterprise/agent/pom.xml
index 17690d3..199a996 100644
--- a/modules/enterprise/agent/pom.xml
+++ b/modules/enterprise/agent/pom.xml
@@ -188,6 +188,9 @@ Build-Number=${buildNumber}
<property name="jaxb-impl.version"
value="${jaxb-impl.version}" />
<property name="jline.version"
value="${jline.version}" />
<property name="augeas.version"
value="${augeas.version}" />
+ <property name="augeas.classifier"
value="${augeas.classifier}"/>
+ <property name="augeas.zip.location"
value="${augeas.zip.location}"/>
+ <property name="augeas.zip.mask"
value="${augeas.zip.mask}"/>
<property name="augeas.zip.version"
value="${augeas.zip.version}" />
</ant>
</tasks>
diff --git a/modules/integration-tests/apache-plugin-test/pom.xml
b/modules/integration-tests/apache-plugin-test/pom.xml
index bba3c06..206a7a7 100644
--- a/modules/integration-tests/apache-plugin-test/pom.xml
+++ b/modules/integration-tests/apache-plugin-test/pom.xml
@@ -198,8 +198,8 @@
<unzip dest="target/itest/lib">
<fileset
-
dir="${settings.localRepository}/net/augeas/augeas-native/${augeas.version}"
- includes="*.zip" />
+ dir="${augeas.zip.location}"
+ includes="${augeas.zip.mask}" />
<patternset>
<include name="**/lib*/*.so" />
<include name="**/lib*/*.so.*"
/>
diff --git a/modules/plugins/aliases/pom.xml b/modules/plugins/aliases/pom.xml
index 959fa3c..d983b6a 100644
--- a/modules/plugins/aliases/pom.xml
+++ b/modules/plugins/aliases/pom.xml
@@ -114,7 +114,7 @@
<delete
dir="target/itest/lib/hyperic-sigar-${sigar.zip.version}" />
<unzip dest="target/itest/lib">
- <fileset
dir="${settings.localRepository}/net/augeas/augeas-native/${augeas.version}"
includes="*.zip" />
+ <fileset dir="${augeas.zip.location}"
includes="${augeas.zip.mask}" />
<patternset>
<include name="**/lib*/*.so" />
<include name="**/lib*/*.so.*" />
diff --git a/modules/plugins/apache/pom.xml b/modules/plugins/apache/pom.xml
index 0694d78..e68547f 100644
--- a/modules/plugins/apache/pom.xml
+++ b/modules/plugins/apache/pom.xml
@@ -178,7 +178,7 @@
<delete
dir="target/itest/lib/hyperic-sigar-${sigar.zip.version}" />
<unzip dest="target/itest/lib">
- <fileset
dir="${settings.localRepository}/net/augeas/augeas-native/${augeas.version}"
includes="*.zip" />
+ <fileset dir="${augeas.zip.location}"
includes="${augeas.zip.mask}" />
<patternset>
<include name="**/lib*/*.so" />
<include name="**/lib*/*.so.*" />
diff --git a/modules/plugins/augeas/pom.xml b/modules/plugins/augeas/pom.xml
index 66d35d1..ff7d21f 100644
--- a/modules/plugins/augeas/pom.xml
+++ b/modules/plugins/augeas/pom.xml
@@ -18,7 +18,7 @@
<description>An abstract plugin for configuring resources via
Augeas</description>
<properties>
- <augeas.version>0.0.2</augeas.version>
+ <augeas-bindings.version>0.0.2</augeas-bindings.version>
</properties>
<dependencies>
@@ -50,7 +50,7 @@
<dependency>
<groupId>net.augeas</groupId>
<artifactId>augeas</artifactId>
- <version>${augeas.version}</version>
+ <version>${augeas-bindings.version}</version>
</dependency>
<dependency>
@@ -84,7 +84,7 @@
<artifactItem>
<groupId>net.augeas</groupId>
<artifactId>augeas</artifactId>
- <version>${augeas.version}</version>
+ <version>${augeas-bindings.version}</version>
</artifactItem>
</artifactItems>
diff --git a/modules/plugins/cobbler/pom.xml b/modules/plugins/cobbler/pom.xml
index 9a45599..78156f3 100644
--- a/modules/plugins/cobbler/pom.xml
+++ b/modules/plugins/cobbler/pom.xml
@@ -120,7 +120,7 @@
<delete
dir="target/itest/lib/hyperic-sigar-${sigar.zip.version}" />
<unzip dest="target/itest/lib">
- <fileset
dir="${settings.localRepository}/net/augeas/augeas-native/${augeas.version}"
includes="*.zip" />
+ <fileset dir="${augeas.zip.location}"
includes="${augeas.zip.mask}" />
<patternset>
<include name="**/lib*/*.so" />
<include name="**/lib*/*.so.*" />
diff --git a/modules/plugins/cron/pom.xml b/modules/plugins/cron/pom.xml
index e42d480..5f2c454 100644
--- a/modules/plugins/cron/pom.xml
+++ b/modules/plugins/cron/pom.xml
@@ -108,7 +108,7 @@
<delete
dir="target/itest/lib/hyperic-sigar-${sigar.zip.version}" />
<unzip dest="target/itest/lib">
- <fileset
dir="${settings.localRepository}/net/augeas/augeas-native/${augeas.version}"
includes="*.zip" />
+ <fileset dir="${augeas.zip.location}"
includes="${augeas.zip.mask}" />
<patternset>
<include name="**/lib*/*.so" />
<include name="**/lib*/*.so.*" />
diff --git a/modules/plugins/grub/pom.xml b/modules/plugins/grub/pom.xml
index 93b5dd3..d197727 100644
--- a/modules/plugins/grub/pom.xml
+++ b/modules/plugins/grub/pom.xml
@@ -105,7 +105,7 @@
<delete
dir="target/itest/lib/hyperic-sigar-${sigar.zip.version}" />
<unzip dest="target/itest/lib">
- <fileset
dir="${settings.localRepository}/net/augeas/augeas-native/${augeas.version}"
includes="*.zip" />
+ <fileset dir="${augeas.zip.location}"
includes="${augeas.zip.mask}" />
<patternset>
<include name="**/lib*/*.so" />
<include name="**/lib*/*.so.*" />
diff --git a/modules/plugins/hosts/pom.xml b/modules/plugins/hosts/pom.xml
index 31af33b..0c7ec29 100644
--- a/modules/plugins/hosts/pom.xml
+++ b/modules/plugins/hosts/pom.xml
@@ -115,7 +115,7 @@
<delete
dir="target/itest/lib/hyperic-sigar-${sigar.zip.version}" />
<unzip dest="target/itest/lib">
- <fileset
dir="${settings.localRepository}/net/augeas/augeas-native/${augeas.version}"
includes="*.zip" />
+ <fileset dir="${augeas.zip.location}"
includes="${augeas.zip.mask}" />
<patternset>
<include name="**/lib*/*.so" />
<include name="**/lib*/*.so.*" />
diff --git a/modules/plugins/postfix/pom.xml b/modules/plugins/postfix/pom.xml
index 5ef7252..2a0eb28 100644
--- a/modules/plugins/postfix/pom.xml
+++ b/modules/plugins/postfix/pom.xml
@@ -113,7 +113,7 @@
<delete
dir="target/itest/lib/hyperic-sigar-${sigar.zip.version}" />
<unzip dest="target/itest/lib">
- <fileset
dir="${settings.localRepository}/net/augeas/augeas-native/${augeas.version}"
includes="*.zip" />
+ <fileset dir="${augeas.zip.location}"
includes="${augeas.zip.mask}" />
<patternset>
<include name="**/lib*/*.so" />
<include name="**/lib*/*.so.*" />
diff --git a/modules/plugins/samba/pom.xml b/modules/plugins/samba/pom.xml
index 84fc9b7..90337ed 100644
--- a/modules/plugins/samba/pom.xml
+++ b/modules/plugins/samba/pom.xml
@@ -113,7 +113,7 @@
<delete
dir="target/itest/lib/hyperic-sigar-${sigar.zip.version}" />
<unzip dest="target/itest/lib">
- <fileset
dir="${settings.localRepository}/net/augeas/augeas-native/${augeas.version}"
includes="*.zip" />
+ <fileset dir="${augeas.zip.location}"
includes="${augeas.zip.mask}" />
<patternset>
<include name="**/lib*/*.so" />
<include name="**/lib*/*.so.*" />
diff --git a/modules/plugins/sshd/pom.xml b/modules/plugins/sshd/pom.xml
index 83da74a..3a1df45 100644
--- a/modules/plugins/sshd/pom.xml
+++ b/modules/plugins/sshd/pom.xml
@@ -105,7 +105,7 @@
<delete
dir="target/itest/lib/hyperic-sigar-${sigar.zip.version}" />
<unzip dest="target/itest/lib">
- <fileset
dir="${settings.localRepository}/net/augeas/augeas-native/${augeas.version}"
includes="*.zip" />
+ <fileset dir="${augeas.zip.location}"
includes="${augeas.zip.mask}" />
<patternset>
<include name="**/lib*/*.so" />
<include name="**/lib*/*.so.*" />
diff --git a/modules/plugins/sudoers/pom.xml b/modules/plugins/sudoers/pom.xml
index 1b69180..9429831 100644
--- a/modules/plugins/sudoers/pom.xml
+++ b/modules/plugins/sudoers/pom.xml
@@ -103,7 +103,7 @@
<delete
dir="target/itest/lib/hyperic-sigar-${sigar.zip.version}" />
<unzip dest="target/itest/lib">
- <fileset
dir="${settings.localRepository}/net/augeas/augeas-native/${augeas.version}"
includes="*.zip" />
+ <fileset dir="${augeas.zip.location}"
includes="${augeas.zip.mask}" />
<patternset>
<include name="**/lib*/*.so" />
<include name="**/lib*/*.so.*" />
diff --git a/pom.xml b/pom.xml
index c57a43b..ab342f5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -99,8 +99,11 @@
<commons-codec.version>1.4</commons-codec.version>
<testng.version>5.13.1</testng.version>
<cobertura.version>1.9.4.1</cobertura.version>
- <augeas.version>0.7.1.1</augeas.version>
- <augeas.zip.version>0.7.1</augeas.zip.version>
+ <augeas.version>0.9.0</augeas.version>
+ <augeas.classifier>el5</augeas.classifier>
+ <augeas.zip.version>0.9.0</augeas.zip.version>
+
<augeas.zip.location>${settings.localRepository}/net/augeas/augeas-native/${augeas.version}</augeas.zip.location>
+ <augeas.zip.mask>*-${augeas.classifier}.zip</augeas.zip.mask>
<ant.contrib.version>1.0b3</ant.contrib.version>
<rhq.db.admin.username>rhqadmin</rhq.db.admin.username>
commit 044113ead28a4449d07651e9f402eddac928c646
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Aug 30 21:42:31 2011 -0400
fixing test failures
diff --git
a/modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftConfigurationTest.java
b/modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftConfigurationTest.java
index 1cf29d6..b59dd01 100644
---
a/modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftConfigurationTest.java
+++
b/modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftConfigurationTest.java
@@ -1,12 +1,5 @@
package org.rhq.core.domain.drift;
-import static java.util.Arrays.asList;
-import static org.rhq.core.domain.drift.DriftConfigurationDefinition.PROP_BASEDIR;
-import static
org.rhq.core.domain.drift.DriftConfigurationDefinition.PROP_BASEDIR_VALUECONTEXT;
-import static
org.rhq.core.domain.drift.DriftConfigurationDefinition.PROP_BASEDIR_VALUENAME;
-import static
org.rhq.core.domain.drift.DriftConfigurationDefinition.BaseDirValueContext.fileSystem;
-import static org.testng.Assert.assertEquals;
-
import java.util.List;
import org.testng.annotations.Test;
@@ -18,6 +11,13 @@ import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.drift.DriftConfigurationComparator.CompareMode;
import org.rhq.core.domain.drift.DriftConfigurationDefinition.BaseDirValueContext;
+import static java.util.Arrays.asList;
+import static
org.rhq.core.domain.drift.DriftConfigurationDefinition.BaseDirValueContext.fileSystem;
+import static org.rhq.core.domain.drift.DriftConfigurationDefinition.PROP_BASEDIR;
+import static
org.rhq.core.domain.drift.DriftConfigurationDefinition.PROP_BASEDIR_VALUECONTEXT;
+import static
org.rhq.core.domain.drift.DriftConfigurationDefinition.PROP_BASEDIR_VALUENAME;
+import static org.testng.Assert.assertEquals;
+
public class DriftConfigurationTest {
@Test
public void getCompareIgnoreIncludesExcludes() {
@@ -28,7 +28,7 @@ public class DriftConfigurationTest {
// make sure our comparator can deal with all the nulls that are in empty
configs
assert comparator.compare(dc1, dc2) == 0 : dc1 + " should equal " +
dc2;
- dc1.setEnabled(true);
+ dc1.setEnabled(false);
assert comparator.compare(dc1, dc2) != 0 : dc1 + " should not equal " +
dc2;
assert comparator.compare(dc2, dc1) != 0 : dc2 + " should not equal " +
dc1;
dc1.setInterval(1000L);
@@ -38,14 +38,14 @@ public class DriftConfigurationTest {
assert comparator.compare(dc1, dc2) != 0 : dc1 + " should not equal " +
dc2;
assert comparator.compare(dc2, dc1) != 0 : dc2 + " should not equal " +
dc1;
- dc2.setEnabled(true);
+ dc2.setEnabled(false);
dc2.setInterval(1000L);
dc2.setName("the-name");
assert comparator.compare(dc1, dc2) == 0 : dc1 + " should equal " +
dc2;
dc1.setEnabled(!dc2.isEnabled());
- assert comparator.compare(dc1, dc2) < 0 : dc1 + " should have different
enabled than " + dc2;
+ assert comparator.compare(dc1, dc2) > 0 : dc1 + " should have different
enabled than " + dc2;
dc1.setEnabled(dc2.isEnabled()); // put them back to the same value
dc1.setInterval(dc2.getInterval() + 2222L);
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest.java
index 511df03..ca9ee2a 100644
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest.java
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest.java
@@ -168,7 +168,7 @@ public class ResourceMetadataManagerBeanTest extends MetadataBeanTest
{
for (ConfigurationTemplate drift : drifts) {
if (drift.getName().equals("drift-pc")) {
driftConfig = new DriftConfiguration(drift.getConfiguration());
- assertFalse(driftConfig.isEnabled());
+ assertTrue(driftConfig.isEnabled());
assertEquals(BaseDirValueContext.pluginConfiguration,
driftConfig.getBasedir().getValueContext());
assertEquals("connectionPropertyX",
driftConfig.getBasedir().getValueName());
assertEquals(123456L, driftConfig.getInterval());
@@ -185,7 +185,7 @@ public class ResourceMetadataManagerBeanTest extends MetadataBeanTest
{
assertEquals("", filter.getPattern());
} else if (drift.getName().equals("drift-fs")) {
driftConfig = new DriftConfiguration(drift.getConfiguration());
- assertFalse(driftConfig.isEnabled());
+ assertTrue(driftConfig.isEnabled());
assertEquals(BaseDirValueContext.fileSystem,
driftConfig.getBasedir().getValueContext());
assertEquals("/", driftConfig.getBasedir().getValueName());
assertEquals(DriftConfigurationDefinition.DEFAULT_INTERVAL,
driftConfig.getInterval());
@@ -290,7 +290,7 @@ public class ResourceMetadataManagerBeanTest extends MetadataBeanTest
{
for (ConfigurationTemplate drift : drifts) {
if (drift.getName().equals("drift-rc")) {
driftConfig = new DriftConfiguration(drift.getConfiguration());
- assertFalse(driftConfig.isEnabled());
+ assertTrue(driftConfig.isEnabled());
assertEquals(BaseDirValueContext.resourceConfiguration,
driftConfig.getBasedir().getValueContext());
assertEquals("resourceConfig1",
driftConfig.getBasedir().getValueName());
assertEquals(DriftConfigurationDefinition.DEFAULT_INTERVAL,
driftConfig.getInterval());
@@ -298,7 +298,7 @@ public class ResourceMetadataManagerBeanTest extends MetadataBeanTest
{
assertEquals(0, driftConfig.getExcludes().size());
} else if (drift.getName().equals("drift-mt")) {
driftConfig = new DriftConfiguration(drift.getConfiguration());
- assertFalse(driftConfig.isEnabled());
+ assertTrue(driftConfig.isEnabled());
assertEquals(BaseDirValueContext.measurementTrait,
driftConfig.getBasedir().getValueContext());
assertEquals("trait1",
driftConfig.getBasedir().getValueName());
assertEquals(DriftConfigurationDefinition.DEFAULT_INTERVAL,
driftConfig.getInterval());
commit 4b12e68d2d7648ed08921f482bb02e3525a3cf81
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Aug 30 21:03:24 2011 -0400
[BZ 734194] Check that content is loaded in db on drift details view
The drift details view page displays links for viewing the current and
previous version of a file as well as a diff between those versions.
The initial implementation failed to take into account that the file
content referenced by the drift may not be in the database. The page
previously attempted to generate a diff report on load instead of on
demand. This of course resulted in an exception getting thrown.
With this commit, links for viewing file content and for viewing a diff
are shown when the file content is available. If the file content is not
available, a message is instead displayed that says the content is not
available.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftDetails.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftDetails.java
new file mode 100644
index 0000000..283f53f
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/drift/DriftDetails.java
@@ -0,0 +1,126 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2011 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.core.domain.drift;
+
+import java.io.Serializable;
+
+/**
+ * Encapsulates information and details about drift that can be used in the UI. This
class
+ * the Drift object, the change set to which the drift belongs, and the change set in
which
+ * the file with drift was last referenced. This class also store statuses of the
current
+ * and previous versions of the file to indicate whether or not the content is in the
+ * database. Lastly, it has a flag to indicate whether or not the file is a binary file.
+ */
+public class DriftDetails implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private Drift drift;
+
+ private DriftChangeSet previousChangeSet;
+
+ private DriftFileStatus newFileStatus;
+
+ private DriftFileStatus oldFileStatus;
+
+ private boolean isBinary;
+
+ /** @return The drift object */
+ public Drift getDrift() {
+ return drift;
+ }
+
+ /** @param drift The Drift object to which the details belong */
+ public void setDrift(Drift drift) {
+ this.drift = drift;
+ }
+
+ /** @return The change set to which the drift is part of */
+ public DriftChangeSet getChangeSet() {
+ return drift.getChangeSet();
+ }
+
+ /**
+ * Returns the previous change set for which there was an occurrence of drift on the
+ * file referenced by the Drift object. This can be null if there was no previous
+ * drift.
+ *
+ * @return The previous change set for which there was drift on the file referenced
by
+ * the Drift object or null if there is not previous drift on the file.
+ */
+ public DriftChangeSet getPreviousChangeSet() {
+ return previousChangeSet;
+ }
+
+ /**
+ * @param changeSet The previous change set in which drift occurred on the file
+ * referenced by the Drift object.
+ */
+ public void setPreviousChangeSet(DriftChangeSet changeSet) {
+ previousChangeSet = changeSet;
+ }
+
+ /**
+ * @return The status of the file as reported in the current change set. Indicates
+ * whether or not the file has been loaded into the database. Can be null if the
type
+ * of drift is a {@link DriftCategory#FILE_REMOVED deletion}.
+ */
+ public DriftFileStatus getNewFileStatus() {
+ return newFileStatus;
+ }
+
+ /**
+ * @param status The status of the file reported in the change set.
+ */
+ public void setNewFileStatus(DriftFileStatus status) {
+ newFileStatus = status;
+ }
+
+ /**
+ * @return The status of the file as reported in the previous change set. Indicates
+ * whether or not the file has been loaded into the database. Can be null if the
type
+ * of drift is a {@link DriftCategory#FILE_ADDED addition}.
+ */
+ public DriftFileStatus getOldFileStatus() {
+ return oldFileStatus;
+ }
+
+ /**
+ * @param status The status of the file as reported in the last change set in which
the
+ * file was referenced.
+ */
+ public void setOldFileStatus(DriftFileStatus status) {
+ oldFileStatus = status;
+ }
+
+ /**
+ * @return true if the file is a binary file.
+ */
+ public boolean isBinaryFile() {
+ return isBinary;
+ }
+
+ /**
+ * @param binaryFile True if the file is a binary type, false otherwise.
+ */
+ public void setBinaryFile(boolean binaryFile) {
+ isBinary = binaryFile;
+ }
+}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDetailsView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDetailsView.java
index 31c888d..1c0b54e 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDetailsView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDetailsView.java
@@ -36,24 +36,20 @@ import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
import com.smartgwt.client.widgets.layout.VLayout;
-import org.rhq.core.domain.criteria.GenericDriftChangeSetCriteria;
-import org.rhq.core.domain.criteria.GenericDriftCriteria;
import org.rhq.core.domain.drift.Drift;
-import org.rhq.core.domain.drift.DriftChangeSet;
+import org.rhq.core.domain.drift.DriftDetails;
+import org.rhq.core.domain.drift.DriftFileStatus;
import org.rhq.core.domain.drift.FileDiffReport;
-import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.PopupWindow;
import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
import org.rhq.enterprise.gui.coregui.client.gwt.DriftGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow;
-import static org.rhq.core.domain.drift.DriftCategory.FILE_CHANGED;
+import static org.rhq.core.domain.drift.DriftFileStatus.LOADED;
import static
org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter.DATE_TIME_FORMAT_FULL;
/**
@@ -75,165 +71,30 @@ public class DriftDetailsView extends LocatableVLayout {
show(this.driftId);
}
- private void show(String driftId) {
+ private void show(final String driftId) {
final DriftGWTServiceAsync driftService = GWTServiceLookup.getDriftService();
-
- GenericDriftCriteria criteria = new GenericDriftCriteria();
- criteria.addFilterId(driftId);
- criteria.fetchChangeSet(true);
- driftService.findDriftsByCriteria(criteria,
- new AsyncCallback<PageList<? extends Drift>>() {
- @Override
- public void onSuccess(PageList<? extends Drift> result) {
- if (result.getTotalSize() != 1) {
- CoreGUI.getMessageCenter().notify(
- new Message("Got [" + result.getTotalSize()
- + "] results. Should have been 1. The details shown
here might not be correct.",
- Severity.Warning));
- }
- final Drift drift = result.get(0);
- if (drift.getCategory() == FILE_CHANGED) {
- GenericDriftChangeSetCriteria criteria = new
GenericDriftChangeSetCriteria();
-
criteria.addFilterResourceId(drift.getChangeSet().getResourceId());
-
criteria.addFilterDriftConfigurationId(drift.getChangeSet().getDriftConfigurationId());
-
criteria.addFilterVersion(Integer.toString(drift.getChangeSet().getVersion() - 1));
-
- driftService.findDriftChangeSetsByCriteria(criteria,
- new AsyncCallback<PageList<? extends
DriftChangeSet>>() {
- @Override
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to
load change set", caught);
- }
-
- @Override
- public void onSuccess(PageList<? extends
DriftChangeSet> changeSets) {
- show(drift, changeSets.get(0));
- }
- });
- } else {
- show(drift, null);
- }
- }
-
- @Override
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_drift_failure_load(),
caught);
- }
- });
- }
-
- private void show(final Drift drift, final DriftChangeSet previousVersion) {
- for (Canvas child : getMembers()) {
- removeMember(child);
- child.destroy();
- }
-
- // the change set to which the drift belongs
-
- DynamicForm changeSetForm = new
LocatableDynamicForm(extendLocatorId("changeSetForm"));
- changeSetForm.setIsGroup(true);
- changeSetForm.setGroupTitle(MSG.view_drift_table_changeSet());
- changeSetForm.setWrapItemTitles(false);
-
- StaticTextItem changeSetId = new StaticTextItem("changeSetId",
MSG.common_title_id());
- changeSetId.setValue(drift.getChangeSet().getId());
- StaticTextItem changeSetCategory = new
StaticTextItem("changeSetCategory", MSG.common_title_category());
- changeSetCategory.setValue(drift.getChangeSet().getCategory().name());
- StaticTextItem changeSetVersion = new
StaticTextItem("changeSetVersion", MSG.common_title_version());
- changeSetVersion.setValue(drift.getChangeSet().getVersion());
- changeSetForm.setItems(changeSetId, changeSetCategory, changeSetVersion);
-
- addMember(changeSetForm);
-
- GWTServiceLookup.getDriftService().isBinaryFile(drift, new
AsyncCallback<Boolean>() {
+ driftService.getDriftDetails(driftId, new AsyncCallback<DriftDetails>() {
@Override
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to look up file
type", caught);
+ CoreGUI.getErrorHandler().handleError("Failed to load drift details
for drift id: " + driftId, caught);
}
@Override
- public void onSuccess(Boolean isBinary) {
- if (isBinary) {
- addMember(createDriftFormForBinaryFile(drift, previousVersion));
- } else {
- addMember(createDriftFormForTextFile(drift, previousVersion));
- }
+ public void onSuccess(final DriftDetails details) {
+ show(details);
}
});
- }
-
- private DynamicForm createDriftFormForBinaryFile(Drift drift, DriftChangeSet
previousVersion) {
- DynamicForm driftForm = new
LocatableDynamicForm(extendLocatorId("form"));
- driftForm.setIsGroup(true);
- driftForm.setGroupTitle(MSG.view_drift());
- driftForm.setWrapItemTitles(false);
- driftForm.setNumCols(4);
-
- SpacerItem spacer = new SpacerItem();
-
- StaticTextItem id = new StaticTextItem("id", MSG.common_title_id());
- id.setValue(drift.getId());
-
- StaticTextItem path = new StaticTextItem("path",
MSG.common_title_path());
- path.setValue(drift.getPath());
- StaticTextItem timestamp = new StaticTextItem("timestamp",
MSG.common_title_timestamp());
- timestamp.setValue(TimestampCellFormatter.format(drift.getCtime(),
DATE_TIME_FORMAT_FULL));
-
- StaticTextItem category = new StaticTextItem("category",
MSG.common_title_category());
-
- LinkedHashMap<String, String> catIconsMap = new LinkedHashMap<String,
String>(3);
- catIconsMap.put(DriftDataSource.CATEGORY_ICON_ADD,
DriftDataSource.CATEGORY_ICON_ADD);
- catIconsMap.put(DriftDataSource.CATEGORY_ICON_CHANGE,
DriftDataSource.CATEGORY_ICON_CHANGE);
- catIconsMap.put(DriftDataSource.CATEGORY_ICON_REMOVE,
DriftDataSource.CATEGORY_ICON_REMOVE);
- LinkedHashMap<String, String> catValueMap = new LinkedHashMap<String,
String>(3);
- catValueMap.put(DriftDataSource.CATEGORY_ICON_ADD,
MSG.view_drift_category_fileAdded());
- catValueMap.put(DriftDataSource.CATEGORY_ICON_CHANGE,
MSG.view_drift_category_fileChanged());
- catValueMap.put(DriftDataSource.CATEGORY_ICON_REMOVE,
MSG.view_drift_category_fileRemoved());
- category.setValueMap(catValueMap);
- category.setValueIcons(catIconsMap);
- category.setShowIcons(true);
-
- StaticTextItem oldFile = new StaticTextItem("oldFile",
MSG.view_drift_table_oldFile());
- FormItem oldFileLink = null;
-
- StaticTextItem newFile = new StaticTextItem("newFile",
MSG.view_drift_table_newFile());
- FormItem newFileLink = null;
+ }
- switch (drift.getCategory()) {
- case FILE_ADDED:
- category.setValue(DriftDataSource.CATEGORY_ICON_ADD);
- oldFile.setValue(MSG.common_label_none());
- oldFileLink = spacer;
- newFile.setValue(drift.getNewDriftFile().getHashId());
- newFileLink = spacer;
- break;
-
- case FILE_CHANGED:
- category.setValue(DriftDataSource.CATEGORY_ICON_CHANGE);
- oldFile.setValue(drift.getOldDriftFile().getHashId());
- oldFileLink = createViewFileLink(drift.getOldDriftFile().getHashId(),
drift.getPath(),
- previousVersion.getVersion());
- newFile.setValue(drift.getNewDriftFile().getHashId());
- newFileLink = spacer;
- break;
-
- case FILE_REMOVED:
- category.setValue(DriftDataSource.CATEGORY_ICON_REMOVE);
- oldFile.setValue(drift.getOldDriftFile().getHashId());
- oldFileLink = spacer;
- newFile.setValue(MSG.common_label_none());
- newFileLink = spacer;
- break;
+ private void show(DriftDetails driftDetails) {
+ for (Canvas child : getMembers()) {
+ removeMember(child);
+ child.destroy();
}
- driftForm.setItems(id, spacer, path, spacer, category, spacer, timestamp, spacer,
oldFile, oldFileLink,
- newFile, newFileLink);
-
- return driftForm;
- }
+ addMember(createChangeSetForm(driftDetails.getDrift()));
- private DynamicForm createDriftFormForTextFile(Drift drift, DriftChangeSet
previousVersion) {
DynamicForm driftForm = new
LocatableDynamicForm(extendLocatorId("form"));
driftForm.setIsGroup(true);
driftForm.setGroupTitle(MSG.view_drift());
@@ -243,13 +104,13 @@ public class DriftDetailsView extends LocatableVLayout {
SpacerItem spacer = new SpacerItem();
StaticTextItem id = new StaticTextItem("id", MSG.common_title_id());
- id.setValue(drift.getId());
+ id.setValue(driftDetails.getDrift().getId());
StaticTextItem path = new StaticTextItem("path",
MSG.common_title_path());
- path.setValue(drift.getPath());
+ path.setValue(driftDetails.getDrift().getPath());
StaticTextItem timestamp = new StaticTextItem("timestamp",
MSG.common_title_timestamp());
- timestamp.setValue(TimestampCellFormatter.format(drift.getCtime(),
DATE_TIME_FORMAT_FULL));
+
timestamp.setValue(TimestampCellFormatter.format(driftDetails.getDrift().getCtime(),
DATE_TIME_FORMAT_FULL));
StaticTextItem category = new StaticTextItem("category",
MSG.common_title_category());
@@ -271,55 +132,102 @@ public class DriftDetailsView extends LocatableVLayout {
StaticTextItem newFile = new StaticTextItem("newFile",
MSG.view_drift_table_newFile());
FormItem newFileLink = null;
- switch (drift.getCategory()) {
- case FILE_ADDED:
- category.setValue(DriftDataSource.CATEGORY_ICON_ADD);
- oldFile.setValue(MSG.common_label_none());
- oldFileLink = spacer;
- newFile.setValue(drift.getNewDriftFile().getHashId());
- newFileLink = createViewFileLink(drift.getNewDriftFile().getHashId(),
drift.getPath(),
- drift.getChangeSet().getVersion());
- break;
-
- case FILE_CHANGED:
- category.setValue(DriftDataSource.CATEGORY_ICON_CHANGE);
- oldFile.setValue(drift.getOldDriftFile().getHashId());
- oldFileLink = createViewFileLink(drift.getOldDriftFile().getHashId(),
drift.getPath(),
- previousVersion.getVersion());
- newFile.setValue(drift.getNewDriftFile().getHashId());
- newFileLink = createViewFileLink(drift.getNewDriftFile().getHashId(),
drift.getPath(),
- drift.getChangeSet().getVersion());
- break;
-
- case FILE_REMOVED:
- category.setValue(DriftDataSource.CATEGORY_ICON_REMOVE);
- oldFile.setValue(drift.getOldDriftFile().getHashId());
- oldFileLink = createViewFileLink(drift.getOldDriftFile().getHashId(),
drift.getPath(),
- drift.getChangeSet().getVersion());
- newFile.setValue(MSG.common_label_none());
- newFileLink = spacer;
- break;
+ if (driftDetails.isBinaryFile()) {
+ switch (driftDetails.getDrift().getCategory()) {
+ case FILE_ADDED:
+ category.setValue(DriftDataSource.CATEGORY_ICON_ADD);
+ oldFile.setValue(MSG.common_label_none());
+ oldFileLink = spacer;
+
newFile.setValue(driftDetails.getDrift().getNewDriftFile().getHashId());
+ newFileLink = spacer;
+ break;
+ case FILE_CHANGED:
+ category.setValue(DriftDataSource.CATEGORY_ICON_CHANGE);
+
oldFile.setValue(driftDetails.getDrift().getOldDriftFile().getHashId());
+ oldFileLink =
createViewFileLink(driftDetails.getDrift().getOldDriftFile().getHashId(),
+ driftDetails.getDrift().getPath(),
driftDetails.getPreviousChangeSet().getVersion());
+
newFile.setValue(driftDetails.getDrift().getNewDriftFile().getHashId());
+ newFileLink = spacer;
+ break;
+ case FILE_REMOVED:
+ category.setValue(DriftDataSource.CATEGORY_ICON_REMOVE);
+
oldFile.setValue(driftDetails.getDrift().getOldDriftFile().getHashId());
+ oldFileLink = spacer;
+ newFile.setValue(MSG.common_label_none());
+ newFileLink = spacer;
+ break;
+ }
+ driftForm.setItems(id, spacer, path, spacer, category, spacer, timestamp,
spacer, oldFile, oldFileLink,
+ newFile, newFileLink);
+ } else {
+ FormItem viewDiffLink = spacer;
+ switch (driftDetails.getDrift().getCategory()) {
+ case FILE_ADDED:
+ category.setValue(DriftDataSource.CATEGORY_ICON_ADD);
+ oldFile.setValue(MSG.common_label_none());
+ oldFileLink = spacer;
+
newFile.setValue(driftDetails.getDrift().getNewDriftFile().getHashId());
+ newFileLink =
createViewFileLink(driftDetails.getDrift().getNewDriftFile().getHashId(),
+ driftDetails.getDrift().getPath(),
driftDetails.getChangeSet().getVersion(),
+ driftDetails.getNewFileStatus());
+ break;
+ case FILE_CHANGED:
+ category.setValue(DriftDataSource.CATEGORY_ICON_CHANGE);
+
oldFile.setValue(driftDetails.getDrift().getOldDriftFile().getHashId());
+ oldFileLink =
createViewFileLink(driftDetails.getDrift().getOldDriftFile().getHashId(),
+ driftDetails.getDrift().getPath(),
driftDetails.getPreviousChangeSet().getVersion(),
+ driftDetails.getOldFileStatus());
+
newFile.setValue(driftDetails.getDrift().getNewDriftFile().getHashId());
+ newFileLink =
createViewFileLink(driftDetails.getDrift().getNewDriftFile().getHashId(),
+ driftDetails.getDrift().getPath(),
driftDetails.getChangeSet().getVersion(),
+ driftDetails.getNewFileStatus());
+ if (driftDetails.getNewFileStatus() == LOADED &&
driftDetails.getOldFileStatus() == LOADED) {
+ viewDiffLink = createViewDiffLink(driftDetails.getDrift(),
+ driftDetails.getPreviousChangeSet().getVersion());
+ }
+ break;
+ case FILE_REMOVED:
+ category.setValue(DriftDataSource.CATEGORY_ICON_REMOVE);
+
oldFile.setValue(driftDetails.getDrift().getOldDriftFile().getHashId());
+ oldFileLink =
createViewFileLink(driftDetails.getDrift().getOldDriftFile().getHashId(),
+ driftDetails.getDrift().getPath(),
driftDetails.getChangeSet().getVersion(),
+ driftDetails.getOldFileStatus());
+ newFile.setValue(MSG.common_label_none());
+ newFileLink = spacer;
+ break;
+ }
+ driftForm.setItems(id, spacer, path, spacer, category, spacer, timestamp,
spacer, oldFile, oldFileLink,
+ newFile, newFileLink, spacer, spacer, spacer, viewDiffLink);
}
+ addMember(driftForm);
+ }
- if (drift.getCategory() == FILE_CHANGED) {
- StaticTextItem numberOfChanges = new
StaticTextItem("numberOfChanges", "Number of Changes");
- numberOfChanges.setValue("Loading...");
+ private DynamicForm createChangeSetForm(Drift drift) {
+ DynamicForm changeSetForm = new
LocatableDynamicForm(extendLocatorId("changeSetForm"));
+ changeSetForm.setIsGroup(true);
+ changeSetForm.setGroupTitle(MSG.view_drift_table_changeSet());
+ changeSetForm.setWrapItemTitles(false);
- LinkItem viewDiffLink = new LinkItem("viewDiff");
- viewDiffLink.setLinkTitle("(view diff)");
- viewDiffLink.setShowTitle(false);
- viewDiffLink.setDisabled(true);
+ StaticTextItem changeSetId = new StaticTextItem("changeSetId",
MSG.common_title_id());
+ changeSetId.setValue(drift.getChangeSet().getId());
+ StaticTextItem changeSetCategory = new
StaticTextItem("changeSetCategory", MSG.common_title_category());
+ changeSetCategory.setValue(drift.getChangeSet().getCategory().name());
+ StaticTextItem changeSetVersion = new
StaticTextItem("changeSetVersion", MSG.common_title_version());
+ changeSetVersion.setValue(drift.getChangeSet().getVersion());
+ changeSetForm.setItems(changeSetId, changeSetCategory, changeSetVersion);
- driftForm.setItems(id, spacer, path, spacer, category, spacer, timestamp,
spacer, oldFile, oldFileLink,
- newFile, newFileLink, numberOfChanges, viewDiffLink);
+ return changeSetForm;
+ }
- generateDiff(drift, previousVersion.getVersion(), numberOfChanges,
viewDiffLink);
- } else {
- driftForm.setItems(id, spacer, path, spacer, category, spacer, timestamp,
spacer, oldFile, oldFileLink,
- newFile, newFileLink);
+ private FormItem createViewFileLink(String hash, String path, int version,
DriftFileStatus status) {
+ if (status == LOADED) {
+ return createViewFileLink(hash, path, version);
}
+ StaticTextItem item = new StaticTextItem(hash + "_fileLink");
+ item.setShowTitle(false);
+ item.setValue("(file not ready for viewing)");
- return driftForm;
+ return item;
}
private LinkItem createViewFileLink(final String hash, final String path, final int
version) {
@@ -333,7 +241,11 @@ public class DriftDetailsView extends LocatableVLayout {
GWTServiceLookup.getDriftService().getDriftFileBits(hash, new
AsyncCallback<String>() {
@Override
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load
file", caught);
+ try {
+ throw caught;
+ } catch (Throwable r) {
+ CoreGUI.getErrorHandler().handleError("Failed to load
file", r);
+ }
}
@Override
@@ -397,31 +309,32 @@ public class DriftDetailsView extends LocatableVLayout {
return window;
}
- private void generateDiff(final Drift drift, final int oldVersion, final
StaticTextItem changes,
- final LinkItem viewDiff) {
- GWTServiceLookup.getDriftService().generateUnifiedDiff(drift, new
AsyncCallback<FileDiffReport>() {
- @Override
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load change
report", caught);
- }
+ private LinkItem createViewDiffLink(final Drift drift, final int oldVersion) {
+ LinkItem viewDiffLink = new LinkItem("viewDiff");
+ viewDiffLink.setLinkTitle("(view diff)");
+ viewDiffLink.setShowTitle(false);
+ viewDiffLink.addClickHandler(new ClickHandler() {
@Override
- public void onSuccess(final FileDiffReport diffReport) {
- changes.setValue(diffReport.getNumberOfChanges());
- viewDiff.setDisabled(false);
- viewDiff.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ GWTServiceLookup.getDriftService().generateUnifiedDiff(drift, new
AsyncCallback<FileDiffReport>() {
@Override
- public void onClick(ClickEvent clickEvent) {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to generate
diff", caught);
+ }
+
+ @Override
+ public void onSuccess(FileDiffReport diffReport) {
int newVersion = drift.getChangeSet().getVersion();
String diffContents = toHtml(diffReport.getDiff(), oldVersion,
newVersion);
-
- //LocatableWindow window =
createFileViewer(diffReport.getDiff());
- LocatableWindow window = createDiffViewer(diffContents,
drift.getPath(), oldVersion, newVersion);
+ LocatableWindow window = createDiffViewer(diffContents,
drift.getPath(), oldVersion,
+ newVersion);
window.show();
}
});
}
});
+ return viewDiffLink;
}
private String toHtml(List<String> deltas, int oldVersion, int newVersion) {
@@ -441,7 +354,6 @@ public class DriftDetailsView extends LocatableVLayout {
diff.append(line).append("<br/>");
}
}
-
return diff.toString();
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/DriftGWTService.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/DriftGWTService.java
index 9b96231..d4faced 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/DriftGWTService.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/DriftGWTService.java
@@ -29,6 +29,7 @@ import org.rhq.core.domain.drift.Drift;
import org.rhq.core.domain.drift.DriftChangeSet;
import org.rhq.core.domain.drift.DriftComposite;
import org.rhq.core.domain.drift.DriftConfiguration;
+import org.rhq.core.domain.drift.DriftDetails;
import org.rhq.core.domain.drift.DriftSnapshot;
import org.rhq.core.domain.drift.FileDiffReport;
import org.rhq.core.domain.util.PageList;
@@ -115,4 +116,6 @@ public interface DriftGWTService extends RemoteService {
boolean isBinaryFile(Drift drift) throws RuntimeException;
+ DriftDetails getDriftDetails(String driftId) throws RuntimeException;
+
}
\ No newline at end of file
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/DriftGWTServiceImpl.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/DriftGWTServiceImpl.java
index e8531be..55f9f7e 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/DriftGWTServiceImpl.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/DriftGWTServiceImpl.java
@@ -27,6 +27,7 @@ import org.rhq.core.domain.drift.Drift;
import org.rhq.core.domain.drift.DriftChangeSet;
import org.rhq.core.domain.drift.DriftComposite;
import org.rhq.core.domain.drift.DriftConfiguration;
+import org.rhq.core.domain.drift.DriftDetails;
import org.rhq.core.domain.drift.DriftSnapshot;
import org.rhq.core.domain.drift.FileDiffReport;
import org.rhq.core.domain.util.PageList;
@@ -160,6 +161,16 @@ public class DriftGWTServiceImpl extends AbstractGWTServiceImpl
implements Drift
}
@Override
+ public DriftDetails getDriftDetails(String driftId) throws RuntimeException {
+ try {
+ DriftDetails details = driftManager.getDriftDetails(getSessionSubject(),
driftId);
+ return SerialUtility.prepare(details,
"DriftService.getDriftDetails");
+ } catch (Throwable t) {
+ throw getExceptionToThrowToClient(t);
+ }
+ }
+
+ @Override
public boolean isBinaryFile(Drift drift) throws RuntimeException {
try {
return driftManager.isBinaryFile(drift);
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
index b1a7415..898a4c2 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
@@ -47,6 +47,8 @@ import org.rhq.core.domain.common.EntityContext;
import org.rhq.core.domain.criteria.DriftChangeSetCriteria;
import org.rhq.core.domain.criteria.DriftConfigurationCriteria;
import org.rhq.core.domain.criteria.DriftCriteria;
+import org.rhq.core.domain.criteria.GenericDriftChangeSetCriteria;
+import org.rhq.core.domain.criteria.GenericDriftCriteria;
import org.rhq.core.domain.drift.Drift;
import org.rhq.core.domain.drift.DriftChangeSet;
import org.rhq.core.domain.drift.DriftComposite;
@@ -54,6 +56,7 @@ import org.rhq.core.domain.drift.DriftConfiguration;
import org.rhq.core.domain.drift.DriftConfigurationComparator;
import org.rhq.core.domain.drift.DriftConfigurationComparator.CompareMode;
import org.rhq.core.domain.drift.DriftConfigurationDefinition;
+import org.rhq.core.domain.drift.DriftDetails;
import org.rhq.core.domain.drift.DriftFile;
import org.rhq.core.domain.drift.DriftSnapshot;
import org.rhq.core.domain.drift.FileDiffReport;
@@ -115,6 +118,7 @@ public class DriftManagerBean implements DriftManagerLocal,
DriftManagerRemote {
binaryFileTypes.add("jpg");
binaryFileTypes.add("png");
binaryFileTypes.add("jpeg");
+ binaryFileTypes.add("gif");
binaryFileTypes.add("pdf");
binaryFileTypes.add("swf");
binaryFileTypes.add("bpm");
@@ -389,12 +393,14 @@ public class DriftManagerBean implements DriftManagerLocal,
DriftManagerRemote {
@Override
@TransactionAttribute(NOT_SUPPORTED)
public String getDriftFileBits(String hash) {
+ log.debug("Retrieving drift file content for " + hash);
DriftServerPluginFacet driftServerPlugin = getServerPlugin();
return driftServerPlugin.getDriftFileBits(hash);
}
@Override
public FileDiffReport generateUnifiedDiff(Drift drift) {
+ log.debug("Generating diff for " + drift);
String oldContent = getDriftFileBits(drift.getOldDriftFile().getHashId());
List<String> oldList = asList(oldContent.split("\\n"));
String newContent = getDriftFileBits(drift.getNewDriftFile().getHashId());
@@ -495,6 +501,69 @@ public class DriftManagerBean implements DriftManagerLocal,
DriftManagerRemote {
return binaryFileTypes.contains(path.substring(index + 1, path.length()));
}
+ @Override
+ @TransactionAttribute(NOT_SUPPORTED)
+ public DriftDetails getDriftDetails(Subject subject, String driftId) {
+ log.debug("Loading drift details for drift id: " + driftId);
+
+ GenericDriftCriteria criteria = new GenericDriftCriteria();
+ criteria.addFilterId(driftId);
+ criteria.fetchChangeSet(true);
+
+ DriftDetails driftDetails = new DriftDetails();
+ DriftServerPluginFacet driftServerPlugin = getServerPlugin();
+
+ DriftFile newFile = null;
+ DriftFile oldFile = null;
+
+ PageList<? extends Drift<?, ?>> results =
driftServerPlugin.findDriftsByCriteria(subject, criteria);
+ if (results.size() == 0) {
+ log.warn("Unable to get the drift details for drift id " + driftId
+ ". No drift object found with that id.");
+ return null;
+ }
+
+ Drift drift = results.get(0);
+ driftDetails.setDrift(drift);
+ try {
+ switch (drift.getCategory()) {
+ case FILE_ADDED:
+ newFile = driftServerPlugin.getDriftFile(subject,
drift.getNewDriftFile().getHashId());
+ driftDetails.setNewFileStatus(newFile.getStatus());
+ break;
+ case FILE_CHANGED:
+ newFile = driftServerPlugin.getDriftFile(subject,
drift.getNewDriftFile().getHashId());
+ oldFile = driftServerPlugin.getDriftFile(subject,
drift.getOldDriftFile().getHashId());
+
+ driftDetails.setNewFileStatus(newFile.getStatus());
+ driftDetails.setOldFileStatus(oldFile.getStatus());
+
+ driftDetails.setPreviousChangeSet(loadPreviousChangeSet(subject,
drift));
+ break;
+ case FILE_REMOVED:
+ oldFile = driftServerPlugin.getDriftFile(subject,
drift.getOldDriftFile().getHashId());
+ driftDetails.setOldFileStatus(oldFile.getStatus());
+ break;
+ }
+ } catch (Exception e) {
+ log.error("An error occurred while loading the drift details for drift
id " + driftId + ": " +
+ e.getMessage());
+ throw new RuntimeException("An error occurred while loading th drift
details for drift id " + driftId, e);
+ }
+ driftDetails.setBinaryFile(isBinaryFile(drift));
+ return driftDetails;
+ }
+
+ private DriftChangeSet loadPreviousChangeSet(Subject subject, Drift drift) {
+ GenericDriftChangeSetCriteria criteria = new GenericDriftChangeSetCriteria();
+ criteria.addFilterResourceId(drift.getChangeSet().getResourceId());
+
criteria.addFilterDriftConfigurationId(drift.getChangeSet().getDriftConfigurationId());
+ criteria.addFilterVersion(Integer.toString(drift.getChangeSet().getVersion() -
1));
+
+ PageList<? extends DriftChangeSet<?>> results =
findDriftChangeSetsByCriteria(subject, criteria);
+ // TODO handle empty results
+ return results.get(0);
+ }
+
private DriftServerPluginFacet getServerPlugin() {
MasterServerPluginContainer masterPC =
LookupUtil.getServerPluginService().getMasterPluginContainer();
if (masterPC == null) {
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerLocal.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerLocal.java
index 663b626..5d9838f 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerLocal.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerLocal.java
@@ -28,6 +28,7 @@ import org.rhq.core.domain.common.EntityContext;
import org.rhq.core.domain.criteria.DriftConfigurationCriteria;
import org.rhq.core.domain.drift.Drift;
import org.rhq.core.domain.drift.DriftConfiguration;
+import org.rhq.core.domain.drift.DriftDetails;
import org.rhq.core.domain.drift.FileDiffReport;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.plugin.pc.drift.DriftServerPluginFacet;
@@ -130,5 +131,14 @@ public interface DriftManagerLocal extends DriftServerPluginFacet,
DriftManagerR
*/
FileDiffReport generateUnifiedDiff(Drift drift);
+ /**
+ * Returns an object that encapsulates the information needed for viewing drift
details
+ *
+ * @param subject
+ * @param driftId
+ * @return
+ */
+ DriftDetails getDriftDetails(Subject subject, String driftId);
+
boolean isBinaryFile(Drift drift);
}
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java
index c3a34bf..daa7a68 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java
@@ -77,6 +77,7 @@ import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
import static javax.ejb.TransactionAttributeType.REQUIRES_NEW;
+import static org.rhq.core.domain.drift.DriftFileStatus.LOADED;
/**
* The SLSB method implementation needed to support the JPA (RHQ Default) Drift Server
Plugin.
@@ -217,7 +218,7 @@ public class JPADriftServerBean implements JPADriftServerLocal {
throw new IllegalArgumentException("JPADriftFile not found [" +
driftFile.getHashId() + "]");
}
df.setData(Hibernate.createBlob(new BufferedInputStream(data)));
- df.setStatus(DriftFileStatus.LOADED);
+ df.setStatus(LOADED);
}
@Override