[rhq] modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/AbstractOperationHistoryDetailsView.java | 28 +++++-----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/AbstractOperationHistoryListView.java | 12 ++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleListView.java | 4 +
3 files changed, 25 insertions(+), 19 deletions(-)
New commits:
commit eac8b15a961194621d8c2ce8e09f338feb895760
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 30 20:56:02 2011 -0400
format cols
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/AbstractOperationHistoryDetailsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/AbstractOperationHistoryDetailsView.java
index 40a826d..27b1040 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/AbstractOperationHistoryDetailsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/AbstractOperationHistoryDetailsView.java
@@ -18,6 +18,10 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.history;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.Label;
@@ -30,7 +34,7 @@ import com.smartgwt.client.widgets.form.fields.LinkItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
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.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.operation.OperationDefinition;
import org.rhq.core.domain.operation.OperationHistory;
@@ -39,20 +43,17 @@ import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
+import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHTMLPane;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVStack;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
/**
* @author Greg Hinkle
*/
-public abstract class AbstractOperationHistoryDetailsView<T extends OperationHistory> extends LocatableVStack
- implements BookmarkableView {
+public abstract class AbstractOperationHistoryDetailsView<T extends OperationHistory> extends LocatableVStack implements
+ BookmarkableView {
private T operationHistory;
@@ -110,11 +111,11 @@ public abstract class AbstractOperationHistoryDetailsView<T extends OperationHis
OperationDefinition operationDefinition = operationHistory.getOperationDefinition();
ConfigurationDefinition parametersConfigurationDefinition = operationDefinition
- .getParametersConfigurationDefinition();
- if (parametersConfigurationDefinition != null &&
- !parametersConfigurationDefinition.getPropertyDefinitions().isEmpty()) {
+ .getParametersConfigurationDefinition();
+ if (parametersConfigurationDefinition != null
+ && !parametersConfigurationDefinition.getPropertyDefinitions().isEmpty()) {
ConfigurationEditor editor = new ConfigurationEditor(extendLocatorId("params"),
- parametersConfigurationDefinition, operationHistory.getParameters());
+ parametersConfigurationDefinition, operationHistory.getParameters());
editor.setReadOnly(true);
parametersSection.addMember(editor);
} else {
@@ -150,7 +151,7 @@ public abstract class AbstractOperationHistoryDetailsView<T extends OperationHis
StaticTextItem submittedItem = new StaticTextItem(AbstractOperationHistoryDataSource.Field.STARTED_TIME, MSG
.view_operationHistoryDetails_dateSubmitted());
- submittedItem.setValue(new Date(operationHistory.getStartedTime()));
+ submittedItem.setValue(TimestampCellFormatter.format(operationHistory.getStartedTime()));
items.add(submittedItem);
StaticTextItem completedItem = new StaticTextItem("completed", MSG.view_operationHistoryDetails_dateCompleted());
@@ -159,7 +160,8 @@ public abstract class AbstractOperationHistoryDetailsView<T extends OperationHis
} else if (status == OperationRequestStatus.CANCELED) {
completedItem.setValue(MSG.common_val_never());
} else {
- completedItem.setValue(new Date(operationHistory.getStartedTime() + operationHistory.getDuration()));
+ completedItem.setValue(TimestampCellFormatter.format(new Date(operationHistory.getStartedTime()
+ + operationHistory.getDuration())));
}
items.add(completedItem);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/AbstractOperationHistoryListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/AbstractOperationHistoryListView.java
index e058004..5433940 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/AbstractOperationHistoryListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/AbstractOperationHistoryListView.java
@@ -19,10 +19,8 @@
package org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.history;
import java.util.ArrayList;
-import java.util.Date;
import java.util.List;
-import com.google.gwt.i18n.client.DateTimeFormat;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.Record;
@@ -46,6 +44,7 @@ import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
import org.rhq.enterprise.gui.coregui.client.components.table.TableSection;
+import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.AncestryUtil;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHTMLPane;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow;
@@ -143,16 +142,19 @@ public abstract class AbstractOperationHistoryListView<T extends AbstractOperati
ListGridField startedTimeField = new ListGridField(AbstractOperationHistoryDataSource.Field.STARTED_TIME);
startedTimeField.setAlign(Alignment.LEFT);
startedTimeField.setCellAlign(Alignment.LEFT);
- startedTimeField.setCellFormatter(new CellFormatter() {
+ startedTimeField.setCellFormatter(new TimestampCellFormatter() {
public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
if (value != null) {
- Date date = (Date) value;
- return DateTimeFormat.getMediumDateTimeFormat().format(date);
+ return super.format(value, record, rowNum, colNum);
} else {
return "<i>" + MSG.view_operationHistoryList_notYetStarted() + "</i>";
}
}
});
+ startedTimeField.setShowHover(true);
+ startedTimeField.setHoverCustomizer(TimestampCellFormatter
+ .getHoverCustomizer(AbstractOperationHistoryDataSource.Field.STARTED_TIME));
+
return startedTimeField;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleListView.java
index b2c80ba..60f9efc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleListView.java
@@ -25,6 +25,7 @@ import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.enterprise.gui.coregui.client.components.table.SubjectRecordCellFormatter;
import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
import org.rhq.enterprise.gui.coregui.client.components.table.TableSection;
+import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
/**
* @author Ian Springer
@@ -51,7 +52,8 @@ public abstract class AbstractOperationScheduleListView extends TableSection<Abs
subjectField.setCellFormatter(new SubjectRecordCellFormatter());
ListGridField nextFireTimeField = new ListGridField(AbstractOperationScheduleDataSource.Field.NEXT_FIRE_TIME,
- 190);
+ 190);
+ TimestampCellFormatter.prepareDateField(nextFireTimeField);
ListGridField descriptionField = new ListGridField(AbstractOperationScheduleDataSource.Field.DESCRIPTION);
13 years, 1 month
[rhq] modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/AbstractConfigurationHistoryDataSource.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
New commits:
commit f48ccec96ccbafafb3d002dc9e7fa462b2ee75cb
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 30 20:14:31 2011 -0400
fix col format
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 3d41d42..75c4bc4 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
@@ -26,7 +26,6 @@ import com.smartgwt.client.data.DataSourceField;
import com.smartgwt.client.data.Record;
import com.smartgwt.client.data.fields.DataSourceIntegerField;
import com.smartgwt.client.types.Alignment;
-import com.smartgwt.client.types.DateDisplayFormat;
import com.smartgwt.client.types.ListGridFieldType;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.grid.CellFormatter;
@@ -43,6 +42,7 @@ import org.rhq.core.domain.criteria.AbstractResourceConfigurationUpdateCriteria;
import org.rhq.core.domain.resource.Resource;
import org.rhq.enterprise.gui.coregui.client.ErrorMessageWindow;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
+import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.AncestryUtil;
@@ -155,13 +155,13 @@ public abstract class AbstractConfigurationHistoryDataSource<T extends AbstractR
ListGridField submittedTimeField = new ListGridField(Field.CREATED_TIME, MSG
.dataSource_configurationHistory_dateSubmitted());
submittedTimeField.setType(ListGridFieldType.DATE);
- submittedTimeField.setDateFormatter(DateDisplayFormat.TOLOCALESTRING);
+ TimestampCellFormatter.prepareDateField(submittedTimeField);
fields.add(submittedTimeField);
ListGridField completedTimeField = new ListGridField(Field.MODIFIED_TIME, MSG
.dataSource_configurationHistory_dateCompleted());
completedTimeField.setType(ListGridFieldType.DATE);
- completedTimeField.setDateFormatter(DateDisplayFormat.TOLOCALESTRING);
+ TimestampCellFormatter.prepareDateField(completedTimeField);
fields.add(completedTimeField);
ListGridField statusField = new ListGridField(Field.STATUS, MSG.common_title_status());
13 years, 1 month
[rhq] modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationMembers.java | 3 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationTable.java | 4 ++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationMembers.java | 3 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationTable.java | 4 ++++
4 files changed, 14 insertions(+)
New commits:
commit 9da6973e664b288b3ad21a2521685594e1691e36
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 30 20:02:51 2011 -0400
fix col format and hover
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationMembers.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationMembers.java
index ae28218..31520bd 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationMembers.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationMembers.java
@@ -52,6 +52,7 @@ import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.components.buttons.BackButton;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.AncestryUtil;
@@ -121,8 +122,10 @@ public class HistoryGroupResourceConfigurationMembers extends LocatableVLayout {
ListGridField fieldAncestry = AncestryUtil.setupAncestryListGridField();
ListGridField fieldDateCreated = new ListGridField(DataSource.Field.DATECREATED, MSG
.common_title_dateCreated());
+ TimestampCellFormatter.prepareDateField(fieldDateCreated);
ListGridField fieldLastUpdated = new ListGridField(DataSource.Field.LASTUPDATED, MSG
.common_title_lastUpdated());
+ TimestampCellFormatter.prepareDateField(fieldLastUpdated);
ListGridField fieldStatus = new ListGridField(DataSource.Field.STATUS, MSG.common_title_status());
ListGridField fieldUser = new ListGridField(DataSource.Field.USER, MSG.common_title_user());
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationTable.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationTable.java
index d6da7d0..35be43c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationTable.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/HistoryGroupResourceConfigurationTable.java
@@ -50,6 +50,7 @@ import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
+import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
@@ -80,6 +81,9 @@ public class HistoryGroupResourceConfigurationTable extends Table<HistoryGroupRe
ListGridField fieldStatus = new ListGridField(DataSource.Field.STATUS, MSG.common_title_status());
ListGridField fieldUser = new ListGridField(DataSource.Field.USER, MSG.common_title_user());
+ TimestampCellFormatter.prepareDateField(fieldDateCreated);
+ TimestampCellFormatter.prepareDateField(fieldLastUpdated);
+
fieldId.setWidth("10%");
fieldDateCreated.setWidth("35%");
fieldLastUpdated.setWidth("35%");
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationMembers.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationMembers.java
index b2f923c..2699dff 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationMembers.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationMembers.java
@@ -52,6 +52,7 @@ import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.components.buttons.BackButton;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.AncestryUtil;
@@ -120,8 +121,10 @@ public class HistoryGroupPluginConfigurationMembers extends LocatableVLayout {
ListGridField fieldAncestry = AncestryUtil.setupAncestryListGridField();
ListGridField fieldDateCreated = new ListGridField(DataSource.Field.DATECREATED, MSG
.common_title_dateCreated());
+ TimestampCellFormatter.prepareDateField(fieldDateCreated);
ListGridField fieldLastUpdated = new ListGridField(DataSource.Field.LASTUPDATED, MSG
.common_title_lastUpdated());
+ TimestampCellFormatter.prepareDateField(fieldLastUpdated);
ListGridField fieldStatus = new ListGridField(DataSource.Field.STATUS, MSG.common_title_status());
ListGridField fieldUser = new ListGridField(DataSource.Field.USER, MSG.common_title_user());
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationTable.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationTable.java
index 1c36f7c..9dcd1c5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationTable.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/HistoryGroupPluginConfigurationTable.java
@@ -50,6 +50,7 @@ import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
+import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
@@ -80,6 +81,9 @@ public class HistoryGroupPluginConfigurationTable extends Table<HistoryGroupPlug
ListGridField fieldStatus = new ListGridField(DataSource.Field.STATUS, MSG.common_title_status());
ListGridField fieldUser = new ListGridField(DataSource.Field.USER, MSG.common_title_user());
+ TimestampCellFormatter.prepareDateField(fieldDateCreated);
+ TimestampCellFormatter.prepareDateField(fieldLastUpdated);
+
fieldId.setWidth("10%");
fieldDateCreated.setWidth("35%");
fieldLastUpdated.setWidth("35%");
13 years, 1 month
[rhq] modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDetailsView.java | 2 ++
1 file changed, 2 insertions(+)
New commits:
commit 6bb2125a164e9dfbdddce5a32cfbf4dc93c6a7d4
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 30 19:49:13 2011 -0400
unsure if this does anything- but I still can't get the hover to work - no idea why
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDetailsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDetailsView.java
index 17dbb52..1d64d92 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDetailsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDetailsView.java
@@ -29,6 +29,7 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.core.DataClass;
import com.smartgwt.client.data.Record;
import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.types.ListGridFieldType;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.FormItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
@@ -209,6 +210,7 @@ public class AlertDetailsView extends LocatableVLayout implements BookmarkableVi
ListGridField status = new ListGridField("status", MSG.view_alert_common_tab_notifications_status());
status.setWidth("50");
status.setAlign(Alignment.CENTER);
+ status.setType(ListGridFieldType.IMAGE);
status.setCellFormatter(new CellFormatter() {
public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
String statusStr = record.getAttribute("status");
13 years, 1 month
[rhq] 2 commits - modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java | 20 +++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDetailsView.java | 39 +++++++++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsDataSource.java | 6 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java | 7 -
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 2
6 files changed, 66 insertions(+), 10 deletions(-)
New commits:
commit d9c77b890c647450837fb876c74e2d66c01ff789
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 30 19:48:33 2011 -0400
fix notificaton log tab
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java
index f30c23b..58346f0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java
@@ -1,6 +1,7 @@
package org.rhq.enterprise.gui.coregui.client;
import org.rhq.core.domain.alert.AlertPriority;
+import org.rhq.core.domain.alert.notification.ResultState;
import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
import org.rhq.core.domain.event.EventSeverity;
import org.rhq.core.domain.measurement.AvailabilityType;
@@ -405,6 +406,25 @@ public class ImageManager {
return "subsystems/event/Events" + icon + "_16.png";
}
+ public static String getAlertNotificationResultIcon(ResultState status) {
+ if (status == null) {
+ status = ResultState.UNKNOWN;
+ }
+ switch (status) {
+ case SUCCESS:
+ return ImageManager.getAvailabilityIcon(Boolean.TRUE);
+ case FAILURE:
+ return ImageManager.getAvailabilityIcon(Boolean.FALSE);
+ case PARTIAL:
+ return ImageManager.getAvailabilityYellowIcon();
+ case DEFERRED:
+ return "[skin]/actions/redo.png"; // for lack of a better icon
+ case UNKNOWN:
+ default:
+ return ImageManager.getAvailabilityIcon(null);
+ }
+ }
+
/**
* This returns an icon of the badge (e.g. the red X or the blue I) without the
* event icon. This is used if you have a table of events and the user knows they are
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
index 71a698a..262f7d0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
@@ -398,7 +398,7 @@ public class AlertDataSource extends RPCDataSource<Alert, AlertCriteria> {
for (AlertNotificationLog log : from.getAlertNotificationLogs()) {
DataClass dc = new DataClass();
dc.setAttribute("sender", log.getSender());
- dc.setAttribute("status", log.getResultState());
+ dc.setAttribute("status", log.getResultState().name());
dc.setAttribute("message", log.getMessage());
notifications[i++] = dc;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDetailsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDetailsView.java
index 14cfc8a..17dbb52 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDetailsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDetailsView.java
@@ -32,6 +32,8 @@ import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.FormItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
+import com.smartgwt.client.widgets.grid.CellFormatter;
+import com.smartgwt.client.widgets.grid.HoverCustomizer;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
@@ -39,10 +41,12 @@ import com.smartgwt.client.widgets.tab.Tab;
import com.smartgwt.client.widgets.tab.TabSet;
import org.rhq.core.domain.alert.Alert;
+import org.rhq.core.domain.alert.notification.ResultState;
import org.rhq.core.domain.criteria.AlertCriteria;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.components.tab.NamedTab;
import org.rhq.enterprise.gui.coregui.client.components.tab.NamedTabSet;
@@ -198,12 +202,43 @@ public class AlertDetailsView extends LocatableVLayout implements BookmarkableVi
DataClass[] input = record.getAttributeAsRecordArray("notificationLogs");
ListGrid grid = getListGrid();
grid.setData((Record[]) input);
+
ListGridField sender = new ListGridField("sender", MSG.view_alert_common_tab_notifications_sender());
sender.setWidth("33%");
+
ListGridField status = new ListGridField("status", MSG.view_alert_common_tab_notifications_status());
- status.setWidth("33%");
+ status.setWidth("50");
+ status.setAlign(Alignment.CENTER);
+ status.setCellFormatter(new CellFormatter() {
+ public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
+ String statusStr = record.getAttribute("status");
+ ResultState statusEnum = (statusStr == null) ? ResultState.UNKNOWN : ResultState.valueOf(statusStr);
+ return imgHTML(ImageManager.getAlertNotificationResultIcon(statusEnum));
+ }
+ });
+ status.setShowHover(true);
+ status.setHoverCustomizer(new HoverCustomizer() {
+ public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
+ String statusStr = record.getAttribute("status");
+ ResultState statusEnum = (statusStr == null) ? ResultState.UNKNOWN : ResultState.valueOf(statusStr);
+ switch (statusEnum) {
+ case SUCCESS:
+ return MSG.common_status_success();
+ case FAILURE:
+ return MSG.common_status_failed();
+ case PARTIAL:
+ return MSG.common_status_partial();
+ case DEFERRED:
+ return MSG.common_status_deferred();
+ case UNKNOWN:
+ default:
+ return MSG.common_status_unknown();
+ }
+ }
+ });
+
ListGridField message = new ListGridField("message", MSG.view_alert_common_tab_notifications_message());
- message.setWidth("34%");
+ message.setWidth("*");
grid.setFields(sender, status, message);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
index 1838e14..c00a454 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
@@ -23,14 +23,12 @@
package org.rhq.enterprise.gui.coregui.client.bundle.deployment;
import java.util.ArrayList;
-import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.AnimationEffect;
import com.smartgwt.client.types.AutoFitWidthApproach;
-import com.smartgwt.client.types.DateDisplayFormat;
import com.smartgwt.client.types.ListGridFieldType;
import com.smartgwt.client.util.BooleanCallback;
import com.smartgwt.client.util.SC;
@@ -74,6 +72,7 @@ import org.rhq.enterprise.gui.coregui.client.bundle.revert.BundleRevertWizard;
import org.rhq.enterprise.gui.coregui.client.components.HeaderLabel;
import org.rhq.enterprise.gui.coregui.client.components.buttons.BackButton;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
import org.rhq.enterprise.gui.coregui.client.components.tagging.TagEditorView;
import org.rhq.enterprise.gui.coregui.client.components.tagging.TagsChangedCallback;
import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
@@ -164,8 +163,8 @@ public class BundleDeploymentView extends LocatableVLayout implements Bookmarkab
bundleVersionName.setTarget("_self");
StaticTextItem deployed = new StaticTextItem("deployed", MSG.view_bundle_deployed());
- deployed.setDateFormatter(DateDisplayFormat.TOLOCALESTRING);
- deployed.setValue(new Date(deployment.getCtime()));
+ deployed.setValue(TimestampCellFormatter.format(deployment.getCtime(),
+ TimestampCellFormatter.DATE_TIME_FORMAT_FULL));
StaticTextItem deployedBy = new StaticTextItem("deployedBy", MSG.view_bundle_deploy_deployedBy());
deployedBy.setValue(deployment.getSubjectName());
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index c5f4d20..1867bf7 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -235,6 +235,8 @@ common_status_failed = Failed
common_status_inprogress = In Progress
common_status_canceled = Canceled
common_status_unknown = Unknown
+common_status_deferred = Deferred
+common_status_partial = Partial
# 1st, 2nd, 3rd, 4th, etc.
common_val_n1st = {0}st
commit caf6832295d8c0a44cfd77a251a530e28b53c0be
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 30 17:18:11 2011 -0400
fix fields
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsDataSource.java
index afcb435..c221bd4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsDataSource.java
@@ -30,7 +30,6 @@ import com.smartgwt.client.data.Record;
import com.smartgwt.client.data.fields.DataSourceImageField;
import com.smartgwt.client.data.fields.DataSourceTextField;
import com.smartgwt.client.types.Alignment;
-import com.smartgwt.client.types.DateDisplayFormat;
import com.smartgwt.client.types.FieldType;
import com.smartgwt.client.types.ListGridFieldType;
import com.smartgwt.client.widgets.grid.HoverCustomizer;
@@ -42,6 +41,7 @@ import org.rhq.core.domain.criteria.AlertDefinitionCriteria;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
+import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
@@ -87,13 +87,13 @@ public abstract class AbstractAlertDefinitionsDataSource extends
ListGridField ctimeField = new ListGridField(FIELD_CTIME, MSG.view_alerts_field_created_time());
ctimeField.setType(ListGridFieldType.DATE);
- ctimeField.setDateFormatter(DateDisplayFormat.TOLOCALESTRING);
+ TimestampCellFormatter.prepareDateField(ctimeField);
ctimeField.setWidth("15%");
fields.add(ctimeField);
ListGridField mtimeField = new ListGridField(FIELD_MTIME, MSG.view_alerts_field_modified_time());
mtimeField.setType(ListGridFieldType.DATE);
- mtimeField.setDateFormatter(DateDisplayFormat.TOLOCALESTRING);
+ TimestampCellFormatter.prepareDateField(mtimeField);
mtimeField.setWidth("15%");
fields.add(mtimeField);
13 years, 1 month
[rhq] 2 commits - modules/enterprise
by Jay Shaughnessy
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java | 7 +++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java | 15 +++++++---
2 files changed, 16 insertions(+), 6 deletions(-)
New commits:
commit e3ca14ca6588adbc11c58c1fffca0c93841fa88d
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 30 17:46:34 2011 -0400
Fix an issue when performing direct navigation to bookmarkable subtab views.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
index 04d6410..cac30b2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
@@ -247,12 +247,19 @@ public abstract class AbstractTwoLevelTabSetView<T, U extends Layout> extends Lo
// select the subTab (this does not fire an event, just sets the subtab)
tab.getLayout().selectSubTab(subtab);
- // now that the tab/subtab is determined, if currently selected tab is not the desired tab, then
- // select it now (firing a new event).
+ // the target tab/subtab is now determined. if the currently selected tab is not the target tab then
+ // select it now.
if (!tab.equals(this.tabSet.getSelectedTab())) {
- this.tabSet.setIgnoreSelectEvents(false);
+
+ // Fire a tab selection event only if we're at the end of the path. If not then it is assumed that
+ // the subtab view is a BookmarkableView and the navigation will continue in that way, below.
+ if (viewPath.isEnd()) {
+ this.tabSet.setIgnoreSelectEvents(false);
+ this.tabSet.selectTab(tab);
+ return;
+ }
+
this.tabSet.selectTab(tab);
- return;
}
// if the desired tab/subtab are already selected, now we can render the subtab canvas
commit 7e2125b7c5e89bb921be4b0aa2ccb203401ec62e
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 30 17:45:27 2011 -0400
Fix a null protection issue.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java
index e321819..2746c41 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java
@@ -24,6 +24,7 @@ import java.util.Arrays;
import java.util.LinkedHashMap;
import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.ResultSet;
import com.smartgwt.client.data.SortSpecifier;
import com.smartgwt.client.types.MultipleAppearance;
import com.smartgwt.client.types.SortDirection;
@@ -169,7 +170,8 @@ public class AlertHistoryView extends TableSection<AlertDataSource> {
new TableAction() {
public boolean isEnabled(ListGridRecord[] selection) {
ListGrid grid = getListGrid();
- return (hasWriteAccess && grid != null && !grid.getResultSet().isEmpty());
+ ResultSet resultSet = (null != grid) ? grid.getResultSet() : null;
+ return (hasWriteAccess && grid != null && resultSet != null && !resultSet.isEmpty());
}
public void executeAction(ListGridRecord[] selection, Object actionValue) {
@@ -180,7 +182,8 @@ public class AlertHistoryView extends TableSection<AlertDataSource> {
new TableAction() {
public boolean isEnabled(ListGridRecord[] selection) {
ListGrid grid = getListGrid();
- return (hasWriteAccess && grid != null && !grid.getResultSet().isEmpty());
+ ResultSet resultSet = (null != grid) ? grid.getResultSet() : null;
+ return (hasWriteAccess && grid != null && resultSet != null && !resultSet.isEmpty());
}
public void executeAction(ListGridRecord[] selection, Object actionValue) {
13 years, 1 month
[rhq] Branch 'release-3.0.1' - modules/core
by ips
modules/core/client-api/src/main/java/org/rhq/core/clientapi/descriptor/PluginTransformer.java | 27 +++++++++-
1 file changed, 25 insertions(+), 2 deletions(-)
New commits:
commit d4c35ca067f424a0eeb31a1015aeeec1cc05fcbc
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Wed Mar 30 17:17:56 2011 -0400
handle plugin jars whose manifest is not the 2nd entry in the jarfile (https://bugzilla.redhat.com/show_bug.cgi?id=682116)
diff --git a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/descriptor/PluginTransformer.java b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/descriptor/PluginTransformer.java
index ecaa80b..fbefc1d 100644
--- a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/descriptor/PluginTransformer.java
+++ b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/descriptor/PluginTransformer.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
@@ -22,6 +22,8 @@
*/
package org.rhq.core.clientapi.descriptor;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.rhq.core.domain.plugin.Plugin;
import org.rhq.core.clientapi.descriptor.plugin.PluginDescriptor;
import org.rhq.core.clientapi.descriptor.plugin.Help;
@@ -29,6 +31,8 @@ import org.rhq.core.util.MessageDigestGenerator;
import java.net.URL;
import java.io.IOException;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
import java.util.jar.JarInputStream;
import java.util.jar.Manifest;
import java.util.jar.Attributes;
@@ -38,6 +42,8 @@ import java.util.jar.Attributes;
*/
public class PluginTransformer {
+ private static final Log LOG = LogFactory.getLog(PluginTransformer.class);
+
/**
* Takes the given plugin descriptor and plugin JAR file URL and converts them into a
* {@link org.rhq.core.domain.plugin.Plugin} object. This method does not set the <code>content</code> property
@@ -112,8 +118,24 @@ public class PluginTransformer {
private String getVersionFromPluginJarManifest(URL pluginJarUrl) throws IOException {
JarInputStream jarInputStream = new JarInputStream(pluginJarUrl.openStream());
- jarInputStream.close();
Manifest manifest = jarInputStream.getManifest();
+ if (manifest == null) {
+ // BZ 682116 (ips, 03/25/11): The manifest file is not in the standard place as the 2nd entry of the JAR,
+ // but we want to be flexible and support JARs that have a manifest file somewhere else, so scan the entire
+ // JAR for one.
+ JarEntry jarEntry;
+ while((jarEntry = jarInputStream.getNextJarEntry()) != null) {
+ if (JarFile.MANIFEST_NAME.equalsIgnoreCase(jarEntry.getName())) {
+ manifest = new Manifest(jarInputStream);
+ break;
+ }
+ }
+ }
+ try {
+ jarInputStream.close();
+ } catch (IOException e) {
+ LOG.error("Failed to close plugin jar input stream for plugin jar [" + pluginJarUrl + "].", e);
+ }
if (manifest != null) {
Attributes attributes = manifest.getMainAttributes();
return attributes.getValue(Attributes.Name.IMPLEMENTATION_VERSION);
@@ -121,4 +143,5 @@ public class PluginTransformer {
return null;
}
}
+
}
13 years, 1 month
[rhq] Branch 'release-3.0.1' - modules/plugins
by Simeon Pinder
modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerOperationsDelegate.java | 1057 ++++------
modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerPluginConfigurationProperties.java | 2
modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml | 12
3 files changed, 526 insertions(+), 545 deletions(-)
New commits:
commit 2b2bb3e381517867fc6526c406b9a187ed47c9fe
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Wed Mar 30 16:39:07 2011 -0400
BZ-689992: adding customizing for max start/stop WAIT_MAX times.
diff --git a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerOperationsDelegate.java b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerOperationsDelegate.java
index 5f7ae4f..1761b6c 100644
--- a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerOperationsDelegate.java
+++ b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerOperationsDelegate.java
@@ -34,7 +34,9 @@ import org.mc4j.ems.connection.EmsConnection;
import org.mc4j.ems.connection.bean.EmsBean;
import org.mc4j.ems.connection.bean.operation.EmsOperation;
import org.mc4j.ems.connection.bean.parameter.EmsParameter;
+
import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
import org.rhq.core.pluginapi.operation.OperationResult;
@@ -51,108 +53,105 @@ import org.rhq.core.system.SystemInfo;
* @author Jay Shaughnessy
*/
public class ApplicationServerOperationsDelegate {
- /**
- * max amount of time to wait for server to show as unavailable after
- * executing stop - in milliseconds
- */
- private static final long STOP_WAIT_MAX = 1000L * 150; // 2.5 minutes
-
- /**
- * amount of time to wait between availability checks when performing a stop
- * - in milliseconds
- */
- private static final long STOP_WAIT_INTERVAL = 1000L * 5; // 5 seconds
-
- /**
- * amount of time to wait for stop to complete after the loop that checks
- * for DOWN availability terminates - in milliseconds
- */
- private static final long STOP_WAIT_FINAL = 1000L * 30; // 30 seconds
-
- /** max amount of time to wait for start to complete - in milliseconds */
- private static final long START_WAIT_MAX = 1000L * 300; // 5 minutes
-
- /**
- * amount of time to wait between availability checks when performing a
- * start - in milliseconds
- */
- private static final long START_WAIT_INTERVAL = 1000L * 5; // 5 seconds
-
- private final Log log = LogFactory
- .getLog(ApplicationServerOperationsDelegate.class);
-
- private static final String SEPARATOR = "\n-----------------------\n";
-
- static final String DEFAULT_START_SCRIPT = "bin" + File.separator + "run."
- + ((File.separatorChar == '/') ? "sh" : "bat");
- static final String DEFAULT_SHUTDOWN_SCRIPT = "bin" + File.separator
- + "shutdown." + ((File.separatorChar == '/') ? "sh" : "bat");
-
- /**
- * Server component against which the operations are being performed.
- */
- private ApplicationServerComponent serverComponent;
-
- private File configPath;
-
- // Constructors --------------------------------------------
-
- public ApplicationServerOperationsDelegate(
- ApplicationServerComponent serverComponent) {
- this.serverComponent = serverComponent;
- }
-
- // Public --------------------------------------------
-
- /**
- * Performs the specified operation. The result of the operation will be
- * indicated in the return. If there is an error, an
- * <code>RuntimeException</code> will be thrown.
- *
- * @param operation
- * the operation to perform
- * @param parameters
- * parameters to the operation call
- *
- * @return if successful, the result object will contain a success message
- *
- * @throws RuntimeException
- * if any errors occur while trying to perform the operation
- */
- public OperationResult invoke(
- ApplicationServerSupportedOperations operation,
- Configuration parameters) throws InterruptedException {
- OperationResult result = null;
-
- switch (operation) {
- case START: {
- result = start();
- break;
- }
- case SHUTDOWN: {
- result = shutDown();
- break;
- }
- case RESTART: {
- result = restart();
- break;
- }
- }
-
- return result;
- }
-
- // Private --------------------------------------------
-
- /**
- * Starts the underlying AS server.
- *
- * @return success message if no errors are encountered
- * @throws InterruptedException
- * if the plugin container stops this operation while its
- * executing
- */
- private OperationResult start() throws InterruptedException {
+ /**
+ * max amount of time to wait for server to show as unavailable after
+ * executing stop - in milliseconds
+ */
+ private static long STOP_WAIT_MAX = 1000L * 150; // 2.5 minutes
+
+ /**
+ * amount of time to wait between availability checks when performing a stop
+ * - in milliseconds
+ */
+ private static final long STOP_WAIT_INTERVAL = 1000L * 5; // 5 seconds
+
+ /**
+ * amount of time to wait for stop to complete after the loop that checks
+ * for DOWN availability terminates - in milliseconds
+ */
+ private static final long STOP_WAIT_FINAL = 1000L * 30; // 30 seconds
+
+ /** max amount of time to wait for start to complete - in milliseconds */
+ private static long START_WAIT_MAX = 1000L * 300; // 5 minutes
+
+ /**
+ * amount of time to wait between availability checks when performing a
+ * start - in milliseconds
+ */
+ private static final long START_WAIT_INTERVAL = 1000L * 5; // 5 seconds
+
+ private final Log log = LogFactory.getLog(ApplicationServerOperationsDelegate.class);
+
+ private static final String SEPARATOR = "\n-----------------------\n";
+
+ static final String DEFAULT_START_SCRIPT = "bin" + File.separator + "run."
+ + ((File.separatorChar == '/') ? "sh" : "bat");
+ static final String DEFAULT_SHUTDOWN_SCRIPT = "bin" + File.separator + "shutdown."
+ + ((File.separatorChar == '/') ? "sh" : "bat");
+
+ /**
+ * Server component against which the operations are being performed.
+ */
+ private ApplicationServerComponent serverComponent;
+
+ private File configPath;
+
+ // Constructors --------------------------------------------
+
+ public ApplicationServerOperationsDelegate(ApplicationServerComponent serverComponent) {
+ this.serverComponent = serverComponent;
+ }
+
+ // Public --------------------------------------------
+
+ /**
+ * Performs the specified operation. The result of the operation will be
+ * indicated in the return. If there is an error, an
+ * <code>RuntimeException</code> will be thrown.
+ *
+ * @param operation
+ * the operation to perform
+ * @param parameters
+ * parameters to the operation call
+ *
+ * @return if successful, the result object will contain a success message
+ *
+ * @throws RuntimeException
+ * if any errors occur while trying to perform the operation
+ */
+ public OperationResult invoke(ApplicationServerSupportedOperations operation, Configuration parameters)
+ throws InterruptedException {
+ OperationResult result = null;
+
+ switch (operation) {
+ case START: {
+ result = start();
+ break;
+ }
+ case SHUTDOWN: {
+ result = shutDown();
+ break;
+ }
+ case RESTART: {
+ result = restart();
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ // Private --------------------------------------------
+
+ /**
+ * Starts the underlying AS server.
+ *
+ * @return success message if no errors are encountered
+ * @throws InterruptedException
+ * if the plugin container stops this operation while its
+ * executing
+ */
+ private OperationResult start() throws InterruptedException {
AvailabilityType avail = this.serverComponent.getAvailability();
if (avail == AvailabilityType.UP) {
OperationResult result = new OperationResult();
@@ -161,25 +160,20 @@ public class ApplicationServerOperationsDelegate {
}
Configuration pluginConfig = serverComponent.getResourceContext().getPluginConfiguration();
File startScriptFile = getStartScriptPath();
- validateScriptFile(
- startScriptFile,
- ApplicationServerPluginConfigurationProperties.START_SCRIPT_CONFIG_PROP);
+ validateScriptFile(startScriptFile, ApplicationServerPluginConfigurationProperties.START_SCRIPT_CONFIG_PROP);
// The optional command prefix (e.g. sudo or nohup).
- String prefix = pluginConfig
- .getSimple(
- ApplicationServerPluginConfigurationProperties.SCRIPT_PREFIX_CONFIG_PROP)
- .getStringValue();
- String configName = getConfigurationSet();
- String bindAddress = pluginConfig.getSimpleValue(
- ApplicationServerPluginConfigurationProperties.BIND_ADDRESS, null);
+ String prefix = pluginConfig
+ .getSimple(ApplicationServerPluginConfigurationProperties.SCRIPT_PREFIX_CONFIG_PROP).getStringValue();
+ String configName = getConfigurationSet();
+ String bindAddress = pluginConfig.getSimpleValue(ApplicationServerPluginConfigurationProperties.BIND_ADDRESS,
+ null);
- ProcessExecution processExecution;
- if (prefix == null || prefix.replaceAll("\\s", "").equals("")) {
- // Prefix is either null or contains ONLY whitespace characters.
+ ProcessExecution processExecution;
+ if (prefix == null || prefix.replaceAll("\\s", "").equals("")) {
+ // Prefix is either null or contains ONLY whitespace characters.
- processExecution = ProcessExecutionUtility
- .createProcessExecution(startScriptFile);
+ processExecution = ProcessExecutionUtility.createProcessExecution(startScriptFile);
processExecution.getArguments().add("-c");
processExecution.getArguments().add(configName);
@@ -188,111 +182,103 @@ public class ApplicationServerOperationsDelegate {
processExecution.getArguments().add("-b");
processExecution.getArguments().add(bindAddress);
}
- } else {
- // The process execution should be tied to the process represented
- // as the prefix. If there are any other
- // tokens in the prefix, consider them arguments to the prefix
- // process.
- StringTokenizer prefixTokenizer = new StringTokenizer(prefix);
- String processName = prefixTokenizer.nextToken();
- File prefixProcess = new File(processName);
-
- processExecution = ProcessExecutionUtility
- .createProcessExecution(prefixProcess);
-
- while (prefixTokenizer.hasMoreTokens()) {
- String prefixArgument = prefixTokenizer.nextToken();
- processExecution.getArguments().add(prefixArgument);
- }
-
- // Add the AS start script and its options as a single argument to the prefix command.
- String startScriptArgument = startScriptFile.getAbsolutePath();
- startScriptArgument += " -c " + configName;
- if (bindAddress != null) {
- startScriptArgument += " -b " + bindAddress;
- }
- processExecution.getArguments().add(startScriptArgument);
- }
-
- initProcessExecution(processExecution, startScriptFile);
-
- long start = System.currentTimeMillis();
- if (log.isDebugEnabled()) {
- log.debug("About to execute the following process: [" + processExecution + "]");
- }
- SystemInfo systemInfo = serverComponent.getResourceContext().getSystemInformation();
- ProcessExecutionResults results = systemInfo
- .executeProcess(processExecution);
- logExecutionResults(results);
-
- if (results.getError() == null) {
- avail = waitForServerToStart(start);
- } else {
- log.error(
- "Error from process execution while starting the AS instance. Exit code ["
- + results.getExitCode() + "]", results.getError());
- avail = this.serverComponent.getAvailability();
- }
-
- // If, after the loop, the Server is still down, consider the start to be a failure.
- OperationResult result;
+ } else {
+ // The process execution should be tied to the process represented
+ // as the prefix. If there are any other
+ // tokens in the prefix, consider them arguments to the prefix
+ // process.
+ StringTokenizer prefixTokenizer = new StringTokenizer(prefix);
+ String processName = prefixTokenizer.nextToken();
+ File prefixProcess = new File(processName);
+
+ processExecution = ProcessExecutionUtility.createProcessExecution(prefixProcess);
+
+ while (prefixTokenizer.hasMoreTokens()) {
+ String prefixArgument = prefixTokenizer.nextToken();
+ processExecution.getArguments().add(prefixArgument);
+ }
+
+ // Add the AS start script and its options as a single argument to the prefix command.
+ String startScriptArgument = startScriptFile.getAbsolutePath();
+ startScriptArgument += " -c " + configName;
+ if (bindAddress != null) {
+ startScriptArgument += " -b " + bindAddress;
+ }
+ processExecution.getArguments().add(startScriptArgument);
+ }
+
+ initProcessExecution(processExecution, startScriptFile);
+
+ long start = System.currentTimeMillis();
+ if (log.isDebugEnabled()) {
+ log.debug("About to execute the following process: [" + processExecution + "]");
+ }
+ SystemInfo systemInfo = serverComponent.getResourceContext().getSystemInformation();
+ ProcessExecutionResults results = systemInfo.executeProcess(processExecution);
+ logExecutionResults(results);
+
+ if (results.getError() == null) {
+ avail = waitForServerToStart(start);
+ } else {
+ log.error("Error from process execution while starting the AS instance. Exit code ["
+ + results.getExitCode() + "]", results.getError());
+ avail = this.serverComponent.getAvailability();
+ }
+
+ // If, after the loop, the Server is still down, consider the start to be a failure.
+ OperationResult result;
if (avail == AvailabilityType.DOWN) {
- result = new OperationResult();
+ result = new OperationResult();
result.setErrorMessage("The server failed to start: " + results.getCapturedOutput());
- } else {
- result = new OperationResult("The server has been started.");
- }
+ } else {
+ result = new OperationResult("The server has been started.");
+ }
return result;
- }
-
- private String getConfigurationSet() {
- Configuration pluginConfig = serverComponent.getResourceContext().getPluginConfiguration();
- configPath = resolvePathRelativeToHomeDir(getRequiredPropertyValue(
- pluginConfig,
- ApplicationServerPluginConfigurationProperties.SERVER_HOME_DIR));
-
- if (!configPath.exists()) {
- throw new InvalidPluginConfigurationException(
- "Configuration path '" + configPath + "' does not exist.");
- }
- return pluginConfig.getSimpleValue(
- ApplicationServerPluginConfigurationProperties.SERVER_NAME,
- configPath.getName());
- }
-
- private void initProcessExecution(ProcessExecution processExecution,
- File scriptFile) {
- // NOTE: For both run.bat and shutdown.bat, the current working dir must
- // be set to the script's parent dir
- // (e.g. ${JBOSS_HOME}/bin) for the script to work.
- processExecution.setWorkingDirectory(scriptFile.getParent());
-
- // Both scripts require the JAVA_HOME env var to be set.
- File javaHomeDir = getJavaHomePath();
- if (javaHomeDir == null) {
- throw new IllegalStateException(
- "The '"
- + ApplicationServerPluginConfigurationProperties.JAVA_HOME
- + "' connection property must be set in order to start the application server or to stop it via script.");
- }
-
- validateJavaHomePathProperty();
- processExecution.getEnvironmentVariables().put("JAVA_HOME",
- javaHomeDir.getPath());
-
- processExecution.setCaptureOutput(true);
- processExecution.setWaitForCompletion(1000L); // 1 second // TODO:
- // Should we wait longer than one second?
- processExecution.setKillOnTimeout(false);
- }
-
- /**
- * Shuts down the server by dispatching to shutdown via script or JMX. Waits
- * until the server is down.
- *
- * @return The result of the shutdown operation - is successful
- */
- private OperationResult shutDown() {
+ }
+
+ private String getConfigurationSet() {
+ Configuration pluginConfig = serverComponent.getResourceContext().getPluginConfiguration();
+ configPath = resolvePathRelativeToHomeDir(getRequiredPropertyValue(pluginConfig,
+ ApplicationServerPluginConfigurationProperties.SERVER_HOME_DIR));
+
+ if (!configPath.exists()) {
+ throw new InvalidPluginConfigurationException("Configuration path '" + configPath + "' does not exist.");
+ }
+ return pluginConfig.getSimpleValue(ApplicationServerPluginConfigurationProperties.SERVER_NAME, configPath
+ .getName());
+ }
+
+ private void initProcessExecution(ProcessExecution processExecution, File scriptFile) {
+ // NOTE: For both run.bat and shutdown.bat, the current working dir must
+ // be set to the script's parent dir
+ // (e.g. ${JBOSS_HOME}/bin) for the script to work.
+ processExecution.setWorkingDirectory(scriptFile.getParent());
+
+ // Both scripts require the JAVA_HOME env var to be set.
+ File javaHomeDir = getJavaHomePath();
+ if (javaHomeDir == null) {
+ throw new IllegalStateException(
+ "The '"
+ + ApplicationServerPluginConfigurationProperties.JAVA_HOME
+ + "' connection property must be set in order to start the application server or to stop it via script.");
+ }
+
+ validateJavaHomePathProperty();
+ processExecution.getEnvironmentVariables().put("JAVA_HOME", javaHomeDir.getPath());
+
+ processExecution.setCaptureOutput(true);
+ processExecution.setWaitForCompletion(1000L); // 1 second // TODO:
+ // Should we wait longer than one second?
+ processExecution.setKillOnTimeout(false);
+ }
+
+ /**
+ * Shuts down the server by dispatching to shutdown via script or JMX. Waits
+ * until the server is down.
+ *
+ * @return The result of the shutdown operation - is successful
+ */
+ private OperationResult shutDown() {
AvailabilityType avail = this.serverComponent.getAvailability();
if (avail == AvailabilityType.DOWN) {
OperationResult result = new OperationResult();
@@ -301,339 +287,320 @@ public class ApplicationServerOperationsDelegate {
}
Configuration pluginConfig = serverComponent.getResourceContext().getPluginConfiguration();
- ApplicationServerShutdownMethod shutdownMethod = Enum
- .valueOf(
- ApplicationServerShutdownMethod.class,
- pluginConfig
- .getSimple(
- ApplicationServerPluginConfigurationProperties.SHUTDOWN_METHOD_CONFIG_PROP)
- .getStringValue());
- String resultMessage = ApplicationServerShutdownMethod.JMX
- .equals(shutdownMethod) ? shutdownViaJmx()
- : shutdownViaScript();
+ ApplicationServerShutdownMethod shutdownMethod = Enum.valueOf(ApplicationServerShutdownMethod.class,
+ pluginConfig.getSimple(ApplicationServerPluginConfigurationProperties.SHUTDOWN_METHOD_CONFIG_PROP)
+ .getStringValue());
+ String resultMessage = ApplicationServerShutdownMethod.JMX.equals(shutdownMethod) ? shutdownViaJmx()
+ : shutdownViaScript();
avail = waitForServerToShutdown();
- OperationResult result;
+ OperationResult result;
if (avail == AvailabilityType.UP) {
- result = new OperationResult();
+ result = new OperationResult();
result.setErrorMessage("The server failed to shut down.");
- } else {
- return new OperationResult(resultMessage);
- }
+ } else {
+ return new OperationResult(resultMessage);
+ }
return result;
- }
-
- /**
- * Shuts down the AS server using a shutdown script.
- *
- * @return success message if no errors are encountered
- */
- private String shutdownViaScript() {
- File shutdownScriptFile = getShutdownScriptPath();
- validateScriptFile(
- shutdownScriptFile,
- ApplicationServerPluginConfigurationProperties.SHUTDOWN_SCRIPT_CONFIG_PROP);
- Configuration pluginConfig = serverComponent.getResourceContext().getPluginConfiguration();
- String prefix = pluginConfig
- .getSimple(
- ApplicationServerPluginConfigurationProperties.SCRIPT_PREFIX_CONFIG_PROP)
- .getStringValue();
- ProcessExecution processExecution = ProcessExecutionUtility
- .createProcessExecution(prefix, shutdownScriptFile);
-
- initProcessExecution(processExecution, shutdownScriptFile);
-
- String server = pluginConfig.getSimple(
- ApplicationServerPluginConfigurationProperties.NAMING_URL)
- .getStringValue();
- if (server != null) {
- processExecution.getArguments().add("--server=" + server);
- }
-
- String user = pluginConfig.getSimple(
- ApplicationServerComponent.PRINCIPAL_CONFIG_PROP)
- .getStringValue();
- if (user != null) {
- processExecution.getArguments().add("--user=" + user);
- }
-
- String password = pluginConfig.getSimple(
- ApplicationServerComponent.CREDENTIALS_CONFIG_PROP)
- .getStringValue();
- if (password != null) {
- processExecution.getArguments().add("--password=" + password);
- }
-
- processExecution.getArguments().add("--shutdown");
-
- /*
- * This tells shutdown.bat not to call the Windows PAUSE command, which
- * would cause the script to hang indefinitely waiting for input.
- * noinspection ConstantConditions
- */
- processExecution.getEnvironmentVariables().put("NOPAUSE", "1");
-
- if (log.isDebugEnabled()) {
- log.debug("About to execute the following process: ["
- + processExecution + "]");
- }
- SystemInfo systemInfo = serverComponent.getResourceContext().getSystemInformation();
- ProcessExecutionResults results = systemInfo
- .executeProcess(processExecution);
- logExecutionResults(results);
-
- if (results.getError() != null) {
- throw new RuntimeException(
- "Error executing shutdown script while stopping AS instance. Exit code ["
- + results.getExitCode() + "]", results.getError());
- }
-
- return "The server has been shut down.";
- }
-
- private void logExecutionResults(ProcessExecutionResults results) {
- // Always log the output at info level. On Unix we could switch
- // depending on a exitCode being !=0, but ...
- log.info("Exit code from process execution: " + results.getExitCode());
- log.info("Output from process execution: " + SEPARATOR
- + results.getCapturedOutput() + SEPARATOR);
- }
-
- /**
- * Shuts down the AS server via a JMX call.
- *
- * @return success message if no errors are encountered
- */
- private String shutdownViaJmx() {
- Configuration pluginConfig = serverComponent.getResourceContext().getPluginConfiguration();
- String mbeanName = pluginConfig
- .getSimple(
- ApplicationServerPluginConfigurationProperties.SHUTDOWN_MBEAN_CONFIG_PROP)
- .getStringValue();
- String operationName = pluginConfig
- .getSimple(
- ApplicationServerPluginConfigurationProperties.SHUTDOWN_MBEAN_OPERATION_CONFIG_PROP)
- .getStringValue();
-
- EmsConnection connection = this.serverComponent.getEmsConnection();
- if (connection == null) {
- throw new RuntimeException("Can not connect to the server");
- }
- EmsBean bean = connection.getBean(mbeanName);
- EmsOperation operation = bean.getOperation(operationName);
- /*
- * Now see if we got the 'real' method (the one with no param) or the
- * overloaded one. This is a workaround for a bug in EMS that prevents
- * finding operations with same name and different signature.
- * http://sourceforge
- * .net/tracker/index.php?func=detail&aid=2007692&group_id
- * =60228&atid=493495
- *
- * In addition, as we offer the user to specify any MBean and any
- * method, we'd need a clever way for the user to specify parameters
- * anyway.
- */
- List<EmsParameter> params = operation.getParameters();
- int count = params.size();
- if (count == 0)
- operation.invoke(new Object[0]);
- else { // overloaded operation
- operation.invoke(new Object[] { 0 }); // return code of 0
- }
-
- return "The server has been shut down.";
- }
-
- private void validateScriptFile(File scriptFile, String scriptPropertyName) {
- if (!scriptFile.exists()) {
- throw new RuntimeException("Script (" + scriptFile
- + ") specified via '" + scriptPropertyName
- + "' connection property does not exist.");
- }
-
- if (scriptFile.isDirectory()) {
- throw new RuntimeException("Script (" + scriptFile
- + ") specified via '" + scriptPropertyName
- + "' connection property is a directory, not a file.");
- }
- }
-
- /**
- * Restart the server by first trying a shutdown and then a start. This is
- * fail fast.
- *
- * @return A success message on success
- */
- private OperationResult restart() {
- try {
- shutDown();
- } catch (Exception e) {
- throw new RuntimeException("Shutdown may have failed: " + e);
- }
-
- try {
- start();
- } catch (Exception e) {
- throw new RuntimeException("Start following shutdown may have failed: " + e);
- }
-
- return new OperationResult("Server has been restarted.");
-
- }
-
- private AvailabilityType waitForServerToStart(long start)
- throws InterruptedException {
- AvailabilityType avail;
- while (((avail = this.serverComponent.getAvailability()) == AvailabilityType.DOWN)
- && (System.currentTimeMillis() < (start + START_WAIT_MAX))) {
- try {
- Thread.sleep(START_WAIT_INTERVAL);
- } catch (InterruptedException e) {
- // ignore
- }
- }
- return avail;
- }
-
- private AvailabilityType waitForServerToShutdown() {
- long start = System.currentTimeMillis();
+ }
+
+ /**
+ * Shuts down the AS server using a shutdown script.
+ *
+ * @return success message if no errors are encountered
+ */
+ private String shutdownViaScript() {
+ File shutdownScriptFile = getShutdownScriptPath();
+ validateScriptFile(shutdownScriptFile,
+ ApplicationServerPluginConfigurationProperties.SHUTDOWN_SCRIPT_CONFIG_PROP);
+ Configuration pluginConfig = serverComponent.getResourceContext().getPluginConfiguration();
+ String prefix = pluginConfig
+ .getSimple(ApplicationServerPluginConfigurationProperties.SCRIPT_PREFIX_CONFIG_PROP).getStringValue();
+ ProcessExecution processExecution = ProcessExecutionUtility.createProcessExecution(prefix, shutdownScriptFile);
+
+ initProcessExecution(processExecution, shutdownScriptFile);
+
+ String server = pluginConfig.getSimple(ApplicationServerPluginConfigurationProperties.NAMING_URL)
+ .getStringValue();
+ if (server != null) {
+ processExecution.getArguments().add("--server=" + server);
+ }
+
+ String user = pluginConfig.getSimple(ApplicationServerComponent.PRINCIPAL_CONFIG_PROP).getStringValue();
+ if (user != null) {
+ processExecution.getArguments().add("--user=" + user);
+ }
+
+ String password = pluginConfig.getSimple(ApplicationServerComponent.CREDENTIALS_CONFIG_PROP).getStringValue();
+ if (password != null) {
+ processExecution.getArguments().add("--password=" + password);
+ }
+
+ processExecution.getArguments().add("--shutdown");
+
+ /*
+ * This tells shutdown.bat not to call the Windows PAUSE command, which
+ * would cause the script to hang indefinitely waiting for input.
+ * noinspection ConstantConditions
+ */
+ processExecution.getEnvironmentVariables().put("NOPAUSE", "1");
+
+ if (log.isDebugEnabled()) {
+ log.debug("About to execute the following process: [" + processExecution + "]");
+ }
+ SystemInfo systemInfo = serverComponent.getResourceContext().getSystemInformation();
+ ProcessExecutionResults results = systemInfo.executeProcess(processExecution);
+ logExecutionResults(results);
+
+ if (results.getError() != null) {
+ throw new RuntimeException("Error executing shutdown script while stopping AS instance. Exit code ["
+ + results.getExitCode() + "]", results.getError());
+ }
+
+ return "The server has been shut down.";
+ }
+
+ private void logExecutionResults(ProcessExecutionResults results) {
+ // Always log the output at info level. On Unix we could switch
+ // depending on a exitCode being !=0, but ...
+ log.info("Exit code from process execution: " + results.getExitCode());
+ log.info("Output from process execution: " + SEPARATOR + results.getCapturedOutput() + SEPARATOR);
+ }
+
+ /**
+ * Shuts down the AS server via a JMX call.
+ *
+ * @return success message if no errors are encountered
+ */
+ private String shutdownViaJmx() {
+ Configuration pluginConfig = serverComponent.getResourceContext().getPluginConfiguration();
+ String mbeanName = pluginConfig.getSimple(
+ ApplicationServerPluginConfigurationProperties.SHUTDOWN_MBEAN_CONFIG_PROP).getStringValue();
+ String operationName = pluginConfig.getSimple(
+ ApplicationServerPluginConfigurationProperties.SHUTDOWN_MBEAN_OPERATION_CONFIG_PROP).getStringValue();
+
+ EmsConnection connection = this.serverComponent.getEmsConnection();
+ if (connection == null) {
+ throw new RuntimeException("Can not connect to the server");
+ }
+ EmsBean bean = connection.getBean(mbeanName);
+ EmsOperation operation = bean.getOperation(operationName);
+ /*
+ * Now see if we got the 'real' method (the one with no param) or the
+ * overloaded one. This is a workaround for a bug in EMS that prevents
+ * finding operations with same name and different signature.
+ * http://sourceforge
+ * .net/tracker/index.php?func=detail&aid=2007692&group_id
+ * =60228&atid=493495
+ *
+ * In addition, as we offer the user to specify any MBean and any
+ * method, we'd need a clever way for the user to specify parameters
+ * anyway.
+ */
+ List<EmsParameter> params = operation.getParameters();
+ int count = params.size();
+ if (count == 0)
+ operation.invoke(new Object[0]);
+ else { // overloaded operation
+ operation.invoke(new Object[] { 0 }); // return code of 0
+ }
+
+ return "The server has been shut down.";
+ }
+
+ private void validateScriptFile(File scriptFile, String scriptPropertyName) {
+ if (!scriptFile.exists()) {
+ throw new RuntimeException("Script (" + scriptFile + ") specified via '" + scriptPropertyName
+ + "' connection property does not exist.");
+ }
+
+ if (scriptFile.isDirectory()) {
+ throw new RuntimeException("Script (" + scriptFile + ") specified via '" + scriptPropertyName
+ + "' connection property is a directory, not a file.");
+ }
+ }
+
+ /**
+ * Restart the server by first trying a shutdown and then a start. This is
+ * fail fast.
+ *
+ * @return A success message on success
+ */
+ private OperationResult restart() {
+ try {
+ shutDown();
+ } catch (Exception e) {
+ throw new RuntimeException("Shutdown may have failed: " + e);
+ }
+
+ try {
+ start();
+ } catch (Exception e) {
+ throw new RuntimeException("Start following shutdown may have failed: " + e);
+ }
+
+ return new OperationResult("Server has been restarted.");
+
+ }
+
+ private AvailabilityType waitForServerToStart(long start) throws InterruptedException {
AvailabilityType avail;
+ //detect whether startWaitMax property has been set.
+ Configuration pluginConfig = serverComponent.getResourceContext().getPluginConfiguration();
+ PropertySimple property = pluginConfig
+ .getSimple(ApplicationServerPluginConfigurationProperties.START_WAIT_MAX_PROP);
+ //if set and valid, update startWaitMax value
+ if ((property != null) && (property.getIntegerValue() != null)) {
+ int newValue = property.getIntegerValue();
+ if (newValue >= 1) {
+ START_WAIT_MAX = 1000L * 60 * newValue;
+ }
+ }
+ while (((avail = this.serverComponent.getAvailability()) == AvailabilityType.DOWN)
+ && (System.currentTimeMillis() < (start + START_WAIT_MAX))) {
+ try {
+ Thread.sleep(START_WAIT_INTERVAL);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+ }
+ return avail;
+ }
+
+ private AvailabilityType waitForServerToShutdown() {
+ long start = System.currentTimeMillis();
+ AvailabilityType avail;
+ //detect whether stopWaitMax property has been set.
+ Configuration pluginConfig = serverComponent.getResourceContext().getPluginConfiguration();
+ PropertySimple property = pluginConfig
+ .getSimple(ApplicationServerPluginConfigurationProperties.STOP_WAIT_MAX_PROP);
+ //if set and valid update stopWaitMax value
+ if ((property != null) && (property.getIntegerValue() != null)) {
+ int newValue = property.getIntegerValue();
+ if (newValue >= 1) {
+ STOP_WAIT_MAX = 1000L * 60 * newValue;
+ }
+ }
+
while (((avail = this.serverComponent.getAvailability()) == AvailabilityType.UP)
- && (System.currentTimeMillis() < (start + STOP_WAIT_MAX))) {
- try {
- Thread.sleep(STOP_WAIT_INTERVAL);
- } catch (InterruptedException e) {
- // ignore
- }
- }
-
- // After the server becomes unavailable, wait a little longer to hopefully
- // ensure shutdown is complete.
- try {
- Thread.sleep(STOP_WAIT_FINAL);
- } catch (InterruptedException e) {
- // ignore
- }
- return avail;
- }
-
- /**
- * Return the absolute path of this JBoss server's start script (e.g.
- * "C:\opt\jboss-5.1.0.GA\bin\run.sh").
- *
- * @return the absolute path of this JBoss server's start script (e.g.
- * "C:\opt\jboss-5.1.0.GA\bin\run.sh")
- */
- @NotNull
- public File getStartScriptPath() {
- Configuration pluginConfig = serverComponent.getResourceContext()
- .getPluginConfiguration();
- String startScript = pluginConfig
- .getSimpleValue(
- ApplicationServerPluginConfigurationProperties.START_SCRIPT_CONFIG_PROP,
- DEFAULT_START_SCRIPT);
- File startScriptFile = resolvePathRelativeToHomeDir(startScript);
- return startScriptFile;
- }
-
- @NotNull
- private File resolvePathRelativeToHomeDir(@NotNull String path) {
- return resolvePathRelativeToHomeDir(serverComponent
- .getResourceContext().getPluginConfiguration(), path);
- }
-
- @NotNull
- private File resolvePathRelativeToHomeDir(Configuration pluginConfig,
- @NotNull String path) {
- File configDir = new File(path);
- if (!configDir.isAbsolute()) {
- String jbossHomeDir = getRequiredPropertyValue(pluginConfig,
- ApplicationServerPluginConfigurationProperties.HOME_DIR);
- configDir = new File(jbossHomeDir, path);
- }
-
- return configDir;
- }
-
- @NotNull
- private String getRequiredPropertyValue(@NotNull Configuration config,
- @NotNull String propName) {
- String propValue = config.getSimpleValue(propName, null);
- if (propValue == null) {
- // Something's not right - neither autodiscovery, nor the config
- // edit GUI, should ever allow this.
- throw new IllegalStateException("Required property '" + propName
- + "' is not set.");
- }
-
- return propValue;
- }
-
- /**
- * Return the absolute path of this JBoss server's shutdown script (e.g.
- * "C:\opt\jboss-5.1.0.GA\bin\shutdown.sh").
- *
- * @return the absolute path of this JBoss server's shutdown script (e.g.
- * "C:\opt\jboss-5.1.0.GA\bin\shutdown.sh")
- */
- @NotNull
- public File getShutdownScriptPath() {
- Configuration pluginConfig = serverComponent.getResourceContext()
- .getPluginConfiguration();
- String shutdownScript = pluginConfig
- .getSimpleValue(
- ApplicationServerPluginConfigurationProperties.SHUTDOWN_SCRIPT_CONFIG_PROP,
- DEFAULT_SHUTDOWN_SCRIPT);
- File shutdownScriptFile = resolvePathRelativeToHomeDir(shutdownScript);
- return shutdownScriptFile;
- }
-
- /**
- * Return the absolute path of this JBoss server's JAVA_HOME directory (e.g. "C:\opt\jdk1.5.0_14"), as defined by
+ && (System.currentTimeMillis() < (start + STOP_WAIT_MAX))) {
+ try {
+ Thread.sleep(STOP_WAIT_INTERVAL);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+ }
+
+ // After the server becomes unavailable, wait a little longer to hopefully
+ // ensure shutdown is complete.
+ try {
+ Thread.sleep(STOP_WAIT_FINAL);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+ return avail;
+ }
+
+ /**
+ * Return the absolute path of this JBoss server's start script (e.g.
+ * "C:\opt\jboss-5.1.0.GA\bin\run.sh").
+ *
+ * @return the absolute path of this JBoss server's start script (e.g.
+ * "C:\opt\jboss-5.1.0.GA\bin\run.sh")
+ */
+ @NotNull
+ public File getStartScriptPath() {
+ Configuration pluginConfig = serverComponent.getResourceContext().getPluginConfiguration();
+ String startScript = pluginConfig.getSimpleValue(
+ ApplicationServerPluginConfigurationProperties.START_SCRIPT_CONFIG_PROP, DEFAULT_START_SCRIPT);
+ File startScriptFile = resolvePathRelativeToHomeDir(startScript);
+ return startScriptFile;
+ }
+
+ @NotNull
+ private File resolvePathRelativeToHomeDir(@NotNull String path) {
+ return resolvePathRelativeToHomeDir(serverComponent.getResourceContext().getPluginConfiguration(), path);
+ }
+
+ @NotNull
+ private File resolvePathRelativeToHomeDir(Configuration pluginConfig, @NotNull String path) {
+ File configDir = new File(path);
+ if (!configDir.isAbsolute()) {
+ String jbossHomeDir = getRequiredPropertyValue(pluginConfig,
+ ApplicationServerPluginConfigurationProperties.HOME_DIR);
+ configDir = new File(jbossHomeDir, path);
+ }
+
+ return configDir;
+ }
+
+ @NotNull
+ private String getRequiredPropertyValue(@NotNull Configuration config, @NotNull String propName) {
+ String propValue = config.getSimpleValue(propName, null);
+ if (propValue == null) {
+ // Something's not right - neither autodiscovery, nor the config
+ // edit GUI, should ever allow this.
+ throw new IllegalStateException("Required property '" + propName + "' is not set.");
+ }
+
+ return propValue;
+ }
+
+ /**
+ * Return the absolute path of this JBoss server's shutdown script (e.g.
+ * "C:\opt\jboss-5.1.0.GA\bin\shutdown.sh").
+ *
+ * @return the absolute path of this JBoss server's shutdown script (e.g.
+ * "C:\opt\jboss-5.1.0.GA\bin\shutdown.sh")
+ */
+ @NotNull
+ public File getShutdownScriptPath() {
+ Configuration pluginConfig = serverComponent.getResourceContext().getPluginConfiguration();
+ String shutdownScript = pluginConfig.getSimpleValue(
+ ApplicationServerPluginConfigurationProperties.SHUTDOWN_SCRIPT_CONFIG_PROP, DEFAULT_SHUTDOWN_SCRIPT);
+ File shutdownScriptFile = resolvePathRelativeToHomeDir(shutdownScript);
+ return shutdownScriptFile;
+ }
+
+ /**
+ * Return the absolute path of this JBoss server's JAVA_HOME directory (e.g. "C:\opt\jdk1.5.0_14"), as defined by
* the 'javaHome' plugin config prop, or null if that prop is not set.
- *
- * @return the absolute path of this JBoss server's JAVA_HOME directory, as defined by
+ *
+ * @return the absolute path of this JBoss server's JAVA_HOME directory, as defined by
* the 'javaHome' plugin config prop, or null if that prop is not set
- */
- @Nullable
- public File getJavaHomePath() {
- Configuration pluginConfig = serverComponent.getResourceContext().getPluginConfiguration();
- String javaHomePath = pluginConfig.getSimpleValue(ApplicationServerPluginConfigurationProperties.JAVA_HOME,
- null);
- File javaHome = (javaHomePath != null) ? new File(javaHomePath) : null;
- return javaHome;
- }
-
- void validateJavaHomePathProperty() {
- Configuration pluginConfig = serverComponent.getResourceContext().getPluginConfiguration();
- String javaHome = pluginConfig.getSimple(
- ApplicationServerPluginConfigurationProperties.JAVA_HOME)
- .getStringValue();
- if (javaHome != null) {
- File javaHomeDir = new File(javaHome);
- if (!javaHomeDir.isAbsolute()) {
- throw new InvalidPluginConfigurationException(
- ApplicationServerPluginConfigurationProperties.JAVA_HOME
- + " connection property ('"
- + javaHomeDir
- + "') is not an absolute path. Note, on Windows, absolute paths must start with the drive letter (e.g. C:).");
- }
-
- if (!javaHomeDir.exists()) {
- throw new InvalidPluginConfigurationException(
- ApplicationServerPluginConfigurationProperties.JAVA_HOME
- + " connection property ('"
- + javaHomeDir
- + "') does not exist.");
- }
-
- if (!javaHomeDir.isDirectory()) {
- throw new InvalidPluginConfigurationException(
- ApplicationServerPluginConfigurationProperties.JAVA_HOME
- + " connection property ('"
- + javaHomeDir
- + "') is not a directory.");
- }
- }
- }
+ */
+ @Nullable
+ public File getJavaHomePath() {
+ Configuration pluginConfig = serverComponent.getResourceContext().getPluginConfiguration();
+ String javaHomePath = pluginConfig.getSimpleValue(ApplicationServerPluginConfigurationProperties.JAVA_HOME,
+ null);
+ File javaHome = (javaHomePath != null) ? new File(javaHomePath) : null;
+ return javaHome;
+ }
+
+ void validateJavaHomePathProperty() {
+ Configuration pluginConfig = serverComponent.getResourceContext().getPluginConfiguration();
+ String javaHome = pluginConfig.getSimple(ApplicationServerPluginConfigurationProperties.JAVA_HOME)
+ .getStringValue();
+ if (javaHome != null) {
+ File javaHomeDir = new File(javaHome);
+ if (!javaHomeDir.isAbsolute()) {
+ throw new InvalidPluginConfigurationException(
+ ApplicationServerPluginConfigurationProperties.JAVA_HOME
+ + " connection property ('"
+ + javaHomeDir
+ + "') is not an absolute path. Note, on Windows, absolute paths must start with the drive letter (e.g. C:).");
+ }
+
+ if (!javaHomeDir.exists()) {
+ throw new InvalidPluginConfigurationException(ApplicationServerPluginConfigurationProperties.JAVA_HOME
+ + " connection property ('" + javaHomeDir + "') does not exist.");
+ }
+
+ if (!javaHomeDir.isDirectory()) {
+ throw new InvalidPluginConfigurationException(ApplicationServerPluginConfigurationProperties.JAVA_HOME
+ + " connection property ('" + javaHomeDir + "') is not a directory.");
+ }
+ }
+ }
}
diff --git a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerPluginConfigurationProperties.java b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerPluginConfigurationProperties.java
index c87a82f..e0aa0a4 100644
--- a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerPluginConfigurationProperties.java
+++ b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerPluginConfigurationProperties.java
@@ -35,6 +35,8 @@ public class ApplicationServerPluginConfigurationProperties {
public static final String JAVA_HOME = "javaHome";
public static final String BIND_ADDRESS = "bindAddress";
public static final String START_SCRIPT_CONFIG_PROP = "startScript";
+ public static final String START_WAIT_MAX_PROP = "startWaitMax";
+ public static final String STOP_WAIT_MAX_PROP = "stopWaitMax";
public static final String SHUTDOWN_SCRIPT_CONFIG_PROP = "shutdownScript";
public static final String SHUTDOWN_MBEAN_CONFIG_PROP = "shutdownMBeanName";
public static final String SHUTDOWN_MBEAN_OPERATION_CONFIG_PROP = "shutdownMBeanOperation";
diff --git a/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml
index f6c14a1..523d9c4 100644
--- a/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml
@@ -1009,6 +1009,18 @@
this property must be set in order for the Start operation to work,
or for the Shutdown operation to work when the shutdown method is set
to 'shutdown script'."/>
+ <c:simple-property name="startWaitMax" required="false"
+ description="The time, in minutes,(e.g. 1 or 8) that must elapse before the server is considered to have failed to start up. The default is 5 minutes.">
+ <c:constraint>
+ <c:integer-constraint minimum="1"/>
+ </c:constraint>
+ </c:simple-property>
+ <c:simple-property name="stopWaitMax" required="false"
+ description="The time, in minutes,(e.g. 1 or 8) that must elapse before the server is considered to have failed to stop. The default is 2.5 minutes.">
+ <c:constraint>
+ <c:integer-constraint minimum="1"/>
+ </c:constraint>
+ </c:simple-property>
</c:group>
<c:group name="advanced" displayName="Advanced" hiddenByDefault="true">
13 years, 1 month
[rhq] Changes to 'origin/release-3.0.1'
by Simeon Pinder
New branch 'origin/release-3.0.1' available with the following commits:
commit 2b2bb3e381517867fc6526c406b9a187ed47c9fe
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Wed Mar 30 16:39:07 2011 -0400
BZ-689992: adding customizing for max start/stop WAIT_MAX times.
13 years, 1 month
[rhq] 2 commits - modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TimestampCellFormatter.java | 30 +++++++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionDataSource.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java | 27 ++++++++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java | 1
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 2
5 files changed, 52 insertions(+), 10 deletions(-)
New commits:
commit ed227f84f309a55d2e7fe06169cdb1b4cb2ab97d
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 30 16:59:02 2011 -0400
group def interval spinner should step every 1m
label it as (ms) so people know the units
fix some columns
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TimestampCellFormatter.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TimestampCellFormatter.java
index 53a0209..260ed01 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TimestampCellFormatter.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TimestampCellFormatter.java
@@ -23,7 +23,7 @@ public class TimestampCellFormatter implements CellFormatter {
private DateTimeFormat dateTimeFormat;
/**
- * Uses SHORT format.
+ * Uses MEDIUM format.
*/
public TimestampCellFormatter() {
this(DATE_TIME_FORMAT_MEDIUM);
@@ -40,7 +40,7 @@ public class TimestampCellFormatter implements CellFormatter {
/**
* @param value
- * @return SHORT format for value
+ * @return MEDIUM format for value
*/
public static String format(Object value) {
return format(value, DATE_TIME_FORMAT_MEDIUM);
@@ -94,15 +94,27 @@ public class TimestampCellFormatter implements CellFormatter {
return new HoverCustomizer() {
public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
Date attribValue = record.getAttributeAsDate(dateTimeAttributeName);
- if (attribValue != null) {
- StringBuilder sb = new StringBuilder("<p style='width:300px'>");
- sb.append(format(attribValue, DATE_TIME_FORMAT_FULL));
- sb.append("</p>");
- return sb.toString();
- } else {
- return null;
- }
+ return getHoverDateString(attribValue);
}
};
}
+
+ /**
+ * Returns an HTML string that can be used in as hover for a date field.
+ * It formats the date in the FULL format.
+ *
+ * @param date
+ * @return HTML string that shows the date in FULL format,
+ * or <code>null</code> if <code>date</code> is <code>null</code>
+ */
+ public static String getHoverDateString(Date date) {
+ if (date != null) {
+ StringBuilder sb = new StringBuilder("<p style='width:300px'>");
+ sb.append(format(date, DATE_TIME_FORMAT_FULL));
+ sb.append("</p>");
+ return sb.toString();
+ } else {
+ return null;
+ }
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionDataSource.java
index cef860a..0207062 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionDataSource.java
@@ -86,7 +86,7 @@ public class GroupDefinitionDataSource extends RPCDataSource<GroupDefinition, Re
// it is a Long, but there is no DataSourceLongField and I've seen problems trying to use anything other than text field
DataSourceTextField lastCalculationTimeIntervalField = new DataSourceTextField("lastCalculationTime", MSG
- .view_dynagroup_recalculationInterval());
+ .view_dynagroup_lastCalculationTime());
fields.add(lastCalculationTimeIntervalField);
// it is a Long, but there is no DataSourceLongField and I've seen problems trying to use anything other than text field
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java
index 4a9106b..9106e60 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java
@@ -18,6 +18,7 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.groups.definitions;
+import java.util.Date;
import java.util.Set;
import com.google.gwt.user.client.History;
@@ -25,6 +26,7 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.ListGridFieldType;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.grid.CellFormatter;
+import com.smartgwt.client.widgets.grid.HoverCustomizer;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
@@ -47,7 +49,7 @@ import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
* @author Greg Hinkle
* @author Joseph Marques
*/
-public class GroupDefinitionListView extends TableSection {
+public class GroupDefinitionListView extends TableSection<GroupDefinitionDataSource> {
private static final String TITLE = MSG.view_dynagroup_definitions();
public GroupDefinitionListView(String locatorId, String headerIcon) {
@@ -84,6 +86,17 @@ public class GroupDefinitionListView extends TableSection {
return super.format(value, record, rowNum, colNum);
}
});
+ lastCalculationTimeField.setShowHover(true);
+ lastCalculationTimeField.setHoverCustomizer(new HoverCustomizer() {
+ public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
+ String attribValue = record.getAttribute("lastCalculationTime");
+ if (attribValue != null) {
+ return TimestampCellFormatter.getHoverDateString(new Date(Long.valueOf(attribValue).longValue()));
+ } else {
+ return null;
+ }
+ }
+ });
ListGridField nextCalculationTimeField = new ListGridField("nextCalculationTime", MSG
.view_dynagroup_nextCalculationTime(), 175);
@@ -95,6 +108,18 @@ public class GroupDefinitionListView extends TableSection {
return super.format(value, record, rowNum, colNum);
}
});
+ nextCalculationTimeField.setShowHover(true);
+ nextCalculationTimeField.setHoverCustomizer(new HoverCustomizer() {
+ public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
+ String attribValue = record.getAttribute("nextCalculationTime");
+ if (attribValue != null && !("0".equals(attribValue.toString()))) {
+ return TimestampCellFormatter.getHoverDateString(new Date(Long.valueOf(attribValue).longValue()));
+ } else {
+ return null;
+ }
+ }
+ });
+
setListGridFields(idField, nameField, descriptionField, expressionField, lastCalculationTimeField,
nextCalculationTimeField);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java
index 865e03b..a302455 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java
@@ -397,6 +397,7 @@ public class SingleGroupDefinitionView extends LocatableVLayout implements Bookm
//recalculationInterval.setWrapTitle(false); // do not set this - it causes the form to grow abnormally width-wise for some reason
recalculationInterval.setMin(0);
recalculationInterval.setDefaultValue(0);
+ recalculationInterval.setStep(60000); // the recalc interval is in milliseconds, step up one minute at a time
}
public static LinkedHashMap<String, String> getTemplates() {
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index ae8ccbd..c5f4d20 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -1707,7 +1707,7 @@ view_titleBar_group_failInfo = Failed to get general info on group [{0}] with ID
view_titleBar_group_summary_collapsedTooltip = Click to show more details for this group
view_titleBar_group_summary_expandedTooltip = Click to hide details for this group
view_dynagroup_expressionSet = Expression Set
-view_dynagroup_recalculationInterval = Recalculation Interval
+view_dynagroup_recalculationInterval = Recalculation Interval (ms)
view_dynagroup_lastCalculationTime = Last Calculation Time
view_dynagroup_nextCalculationTime = Next Calculation Time
view_dynagroup_definitionCreated = You have successfully created a group definition named [{0}]
commit 9eaaf6b98d89a8756f12f5d8664e495ba11b91d3
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 30 16:24:44 2011 -0400
protect against null attribute value
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TimestampCellFormatter.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TimestampCellFormatter.java
index f17c62f..53a0209 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TimestampCellFormatter.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TimestampCellFormatter.java
@@ -92,12 +92,16 @@ public class TimestampCellFormatter implements CellFormatter {
public static HoverCustomizer getHoverCustomizer(final String dateTimeAttributeName) {
return new HoverCustomizer() {
-
public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
- StringBuilder sb = new StringBuilder("<p style='width:300px'>");
- sb.append(format(record.getAttributeAsDate(dateTimeAttributeName), DATE_TIME_FORMAT_FULL));
- sb.append("</p>");
- return sb.toString();
+ Date attribValue = record.getAttributeAsDate(dateTimeAttributeName);
+ if (attribValue != null) {
+ StringBuilder sb = new StringBuilder("<p style='width:300px'>");
+ sb.append(format(attribValue, DATE_TIME_FORMAT_FULL));
+ sb.append("</p>");
+ return sb.toString();
+ } else {
+ return null;
+ }
}
};
}
13 years, 1 month