modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ConfigurationUtility.java | 46 ++- modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java | 139 ++++++++-- modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 3 modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties | 3 modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties | 3 modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties | 3 modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties | 3 modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties | 3 modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties | 5 modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties | 3 modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css | 4 modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DatasourceComponent.java | 77 +++-- modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml | 2 13 files changed, 225 insertions(+), 69 deletions(-)
New commits: commit f613d685c6e4f87fe8616abb2fb4ebba6558900c Author: Thomas Segismont tsegismo@redhat.com Date: Tue Aug 27 12:28:52 2013 +0200
Bug 1000006 - [JBossAS7] - it is possible to create an XA datasource even without required property
Updated ConfigurationEditor and ConfigurationUtility to validate lists of maps size against configuration definition Updated DatasourceComponent and as7 plugin descriptor, at least one connection property is required for XA Datasources
Tested on Standalone AS7 and Domain EAP6.1 with GUI and CLI
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ConfigurationUtility.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ConfigurationUtility.java index 1c32526..fa9224b 100644 --- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ConfigurationUtility.java +++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ConfigurationUtility.java @@ -1,24 +1,20 @@ /* * RHQ Management Platform - * Copyright (C) 2005-2008 Red Hat, Inc. + * Copyright (C) 2005-2013 Red Hat, Inc. * All rights reserved. * * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2, as - * published by the Free Software Foundation, and/or the GNU Lesser - * General Public License, version 2.1, also as published by the Free - * Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License and the GNU Lesser General Public License - * for more details. + * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * and the GNU Lesser General Public License along with this program; - * if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * along with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ package org.rhq.core.domain.configuration;
@@ -38,7 +34,11 @@ import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple; * * @author Ian Springer */ -public abstract class ConfigurationUtility { +public class ConfigurationUtility { + + private ConfigurationUtility() { + // Utility class + }
/** * This will populate the given configuration definition with a default template. @@ -305,6 +305,7 @@ public abstract class ConfigurationUtility { if (listMemberPropertyDefinition instanceof PropertyDefinitionMap) { PropertyDefinitionMap propertyDefinitionMap = (PropertyDefinitionMap) listMemberPropertyDefinition; PropertyList propertyList = parentPropertyMap.getList(propertyDefinition.getName()); + validatePropertyListSize(propertyList, propertyDefinitionList, errorMessages); for (Property property : propertyList.getList()) { PropertyMap propertyMap = (PropertyMap) property; validatePropertyMap(propertyMap, propertyDefinitionMap, errorMessages); @@ -331,4 +332,25 @@ public abstract class ConfigurationUtility { validateProperty(childPropertyDefinition, propertyMap, errorMessages); } } -} \ No newline at end of file + + private static void validatePropertyListSize(PropertyList propertyList, + PropertyDefinitionList propertyDefinitionList, List<String> errorMessages) { + int listMin = propertyDefinitionList.getMin(); + int listMax = propertyDefinitionList.getMax(); + if (listMin == 0 && listMax == Integer.MAX_VALUE) { + return; + } + int listSize = propertyList.getList().size(); + if (listMin == 0 && listMax < Integer.MAX_VALUE && listSize > listMax) { + errorMessages.add(String.format("The list property '%s' should contain %d row(s) at most", + propertyDefinitionList.getName(), listMax)); + } else if (listMin > 0 && listMax == Integer.MAX_VALUE && listSize < listMin) { + errorMessages.add(String.format("The list property '%s' should contain at least %d row(s)", + propertyDefinitionList.getName(), listMin)); + } else if (listSize < listMin || listSize > listMax) { + errorMessages.add(String.format( + "The list property '%s' should contain a minimum of %d and a maximum of %d row(s)", + propertyDefinitionList.getName(), listMin, listMax)); + } + } +} diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java index 7019d77..f3e290f 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java @@ -1,6 +1,6 @@ /* * RHQ Management Platform - * Copyright (C) 2005-2011 Red Hat, Inc. + * Copyright (C) 2005-2013 Red Hat, Inc. * All rights reserved. * * This program is free software; you can redistribute it and/or modify @@ -13,11 +13,13 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * along with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ package org.rhq.enterprise.gui.coregui.client.components.configuration;
+import static com.smartgwt.client.types.Overflow.VISIBLE; + import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -126,11 +128,11 @@ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup; import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository; import org.rhq.enterprise.gui.coregui.client.util.Log; import org.rhq.enterprise.gui.coregui.client.util.StringUtility; -import org.rhq.enterprise.gui.coregui.client.util.message.Message; import org.rhq.enterprise.gui.coregui.client.util.enhanced.EnhancedHLayout; import org.rhq.enterprise.gui.coregui.client.util.enhanced.EnhancedIButton; import org.rhq.enterprise.gui.coregui.client.util.enhanced.EnhancedToolStrip; import org.rhq.enterprise.gui.coregui.client.util.enhanced.EnhancedVLayout; +import org.rhq.enterprise.gui.coregui.client.util.message.Message;
/** * A SmartGWT widget for editing an RHQ {@link Configuration} that conforms to a {@link ConfigurationDefinition}. @@ -177,6 +179,8 @@ public class ConfigurationEditor extends EnhancedVLayout { private FormItem blurValueItem; private CheckboxItem blurUnsetItem;
+ private HashMap<PropertyDefinitionList, ListGrid> listOfMapsGrids = new HashMap<PropertyDefinitionList, ListGrid>(); + public static enum ConfigType { plugin, resource }; // Need this extra semicolon for the qdox parser @@ -267,11 +271,32 @@ public class ConfigurationEditor extends EnhancedVLayout { }
public boolean validate() { - return (this.topLevelPropertiesValuesManager.validate()); + return this.topLevelPropertiesValuesManager.validate() && listOfMapsGridsAreValid(); + } + + private boolean listOfMapsGridsAreValid() { + for (Map.Entry<PropertyDefinitionList, ListGrid> entry : listOfMapsGrids.entrySet()) { + PropertyDefinitionList propertyDefinitionList = entry.getKey(); + int listMin = propertyDefinitionList.getMin(); + int listMax = propertyDefinitionList.getMax(); + ListGridRecord[] gridRecords = entry.getValue().getRecords(); + if (!isListGridRecordCountValid(gridRecords, listMin, listMax)) { + return false; + } + } + return true; + } + + private boolean isListGridRecordCountValid(ListGridRecord[] gridRecords, int min, int max) { + int gridRecordCount = gridRecords == null ? 0 : gridRecords.length; + if (gridRecordCount < min || gridRecordCount > max) { + return false; + } + return true; }
public boolean isValid() { - return (!this.topLevelPropertiesValuesManager.hasErrors()); + return !this.topLevelPropertiesValuesManager.hasErrors() && listOfMapsGridsAreValid(); }
public void addPropertyValueChangeListener(PropertyValueChangeListener propertyValueChangeListener) { @@ -472,12 +497,22 @@ public class ConfigurationEditor extends EnhancedVLayout { PropertyDefinition propertyDefinition = this.configurationDefinition.get(propertyName); this.invalidPropertyNameToDisplayNameMap.put(propertyName, propertyDefinition.getDisplayName()); } - if (!this.invalidPropertyNameToDisplayNameMap.isEmpty()) { - PropertyValueChangeEvent event = new PropertyValueChangeEvent(null, null, true, - this.invalidPropertyNameToDisplayNameMap); - firePropertyChangedEvent(event); + } + for (Map.Entry<PropertyDefinitionList, ListGrid> entry : listOfMapsGrids.entrySet()) { + PropertyDefinitionList propertyDefinitionList = entry.getKey(); + int listMin = propertyDefinitionList.getMin(); + int listMax = propertyDefinitionList.getMax(); + ListGridRecord[] gridRecords = entry.getValue().getRecords(); + if (!isListGridRecordCountValid(gridRecords, listMin, listMax)) { + this.invalidPropertyNameToDisplayNameMap.put(propertyDefinitionList.getName(), + propertyDefinitionList.getDisplayName()); } } + if (!this.invalidPropertyNameToDisplayNameMap.isEmpty()) { + PropertyValueChangeEvent event = new PropertyValueChangeEvent(null, null, true, + this.invalidPropertyNameToDisplayNameMap); + firePropertyChangedEvent(event); + } }
private EnhancedToolStrip buildToolStrip(EnhancedVLayout layout, final SectionStack sectionStack) { @@ -933,13 +968,18 @@ public class ConfigurationEditor extends EnhancedVLayout { final PropertyDefinitionList propertyDefinitionList, final PropertyList propertyList) { Log.debug("Building list-of-maps grid for " + propertyList + "...");
+ final int listMin = propertyDefinitionList.getMin(); + final int listMax = propertyDefinitionList.getMax(); + final Canvas errorPanel = buildListOfMapsGridErrorPanel(listMin, listMax); + final ListGrid summaryTable = new ListGrid(); + listOfMapsGrids.put(propertyDefinitionList, summaryTable); summaryTable.setAlternateRecordStyles(true); summaryTable.setShowAllRecords(true); // [BZ 822173 - Table layout problem on configuration page.] // setBodyOverflow(Overflow.VISIBLE) && setAutoFitFieldWidths(true) issue - summaryTable.setBodyOverflow(Overflow.VISIBLE); - summaryTable.setOverflow(Overflow.VISIBLE); + summaryTable.setBodyOverflow(VISIBLE); + summaryTable.setOverflow(VISIBLE); summaryTable.setWidth100(); summaryTable.setAutoFitFieldWidths(true); summaryTable.setAutoFitWidthApproach(AutoFitWidthApproach.BOTH); @@ -981,8 +1021,8 @@ public class ConfigurationEditor extends EnhancedVLayout { PropertyMapListGridRecord record = (PropertyMapListGridRecord) recordClickEvent.getRecord(); PropertyMap memberPropertyMap = (PropertyMap) record.getPropertyMap(); Log.debug("Editing property map: " + memberPropertyMap); - displayMapEditor(summaryTable, record, propertyDefinitionList, propertyList, - memberPropertyDefinitionMap, memberPropertyMap, mapReadOnly); + displayMapEditor(summaryTable, errorPanel, record, propertyDefinitionList, propertyList, + memberPropertyDefinitionMap, memberPropertyMap, mapReadOnly); } }); fieldsList.add(editField); @@ -1005,16 +1045,20 @@ public class ConfigurationEditor extends EnhancedVLayout { SC.confirm(MSG.view_configEdit_confirm_2(), new BooleanCallback() { public void execute(Boolean confirmed) { if (confirmed) { - if (summaryTable.getRecordList().getLength() <= propertyDefinitionList.getMin()) { - SC.say(MSG.view_configEdit_minBoundsExceeded(String.valueOf(propertyDefinitionList - .getMin()))); + if (summaryTable.getRecordList().getLength() <= listMin) { + SC.say(MSG.view_configEdit_minBoundsExceeded(String.valueOf(listMin))); } else { PropertyMapListGridRecord recordToBeDeleted = (PropertyMapListGridRecord) recordClickEvent .getRecord(); propertyList.getList().remove(recordToBeDeleted.getIndex()); ListGridRecord[] rows = buildSummaryRecords(propertyList, propertyDefinitions); + boolean listGridRecordCountValid = isListGridRecordCountValid(rows, listMin, listMax); + if (errorPanel.isVisible() && listGridRecordCountValid) { + errorPanel.setVisible(false); + } summaryTable.setData(rows); - firePropertyChangedEvent(propertyList, propertyDefinitionList, true); + firePropertyChangedEvent(propertyList, propertyDefinitionList, + listGridRecordCountValid); } } } @@ -1041,14 +1085,23 @@ public class ConfigurationEditor extends EnhancedVLayout { addRowButton.setIcon(Window.getImgURL(ImageManager.getAddIcon())); addRowButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() { public void onClick(ClickEvent clickEvent) { - displayMapEditor(summaryTable, null, propertyDefinitionList, propertyList, - memberPropertyDefinitionMap, null, mapReadOnly); + if (propertyList.getList().size() >= listMax) { + SC.say(MSG.view_configEdit_maxBoundsExceeded(String.valueOf(propertyDefinitionList.getMax()))); + return; + } + displayMapEditor(summaryTable, errorPanel, null, propertyDefinitionList, propertyList, + memberPropertyDefinitionMap, null, mapReadOnly); } }); toolStrip.addMember(addRowButton); }
- summaryTableHolder.setMembers(summaryTable, toolStrip); + if (isListGridRecordCountValid(summaryTable.getRecords(), listMin, listMax)) { + errorPanel.setVisible(false); + } else { + errorPanel.setVisible(true); + } + summaryTableHolder.setMembers(summaryTable, toolStrip, errorPanel);
CanvasItem canvasItem = buildComplexPropertyField(summaryTableHolder); canvasItem.setColSpan(3); @@ -1057,6 +1110,35 @@ public class ConfigurationEditor extends EnhancedVLayout { return canvasItem; }
+ private Canvas buildListOfMapsGridErrorPanel(int listMin, int listMax) { + Label errorLabel = buildListOfMapsGridErrorLabelForBounds(listMin, listMax); + final HTMLFlow errorPanel = new HTMLFlow(); + errorPanel.setWidth100(); + errorPanel.addChild(errorLabel); + return errorPanel; + } + + private Label buildListOfMapsGridErrorLabelForBounds(int listMin, int listMax) { + Label errorLabel; + if (listMin == 0 && listMax == Integer.MAX_VALUE) { + errorLabel = new Label("---"); + } else if (listMin == 0 && listMax < Integer.MAX_VALUE) { + errorLabel = new Label(MSG.view_configEdit_invalidListSizeMax(String.valueOf(listMax))); + } else if (listMin > 0 && listMax == Integer.MAX_VALUE) { + errorLabel = new Label(MSG.view_configEdit_invalidListSizeMin(String.valueOf(listMin))); + } else { + errorLabel = new Label(MSG.view_configEdit_invalidListSizeMinMax(String.valueOf(listMin), + String.valueOf(listMax))); + } + errorLabel.setWidth100(); + errorLabel.setPadding(5); + errorLabel.setHeight(5); + errorLabel.setOverflow(VISIBLE); + errorLabel.addStyleName("InlineError"); + errorLabel.setIcon("[SKIN]/actions/exclamation.png"); + return errorLabel; + } + private ListGridField createListGridField(PropertyDefinition summaryPropDef) { ListGridField field = new ListGridField(summaryPropDef.getName(), summaryPropDef.getDisplayName(), 90); PropertyDefinitionSimple defSimple = (PropertyDefinitionSimple) summaryPropDef; @@ -1686,9 +1768,10 @@ public class ConfigurationEditor extends EnhancedVLayout { return validators; }
- private void displayMapEditor(final ListGrid summaryTable, final PropertyMapListGridRecord existingRecord, - final PropertyDefinitionList propertyDefinitionList, final PropertyList propertyList, - PropertyDefinitionMap memberMapDefinition, final PropertyMap memberMap, final boolean mapReadOnly) { + private void displayMapEditor(final ListGrid summaryTable, final Canvas errorPanel, + final PropertyMapListGridRecord existingRecord, final PropertyDefinitionList propertyDefinitionList, + final PropertyList propertyList, PropertyDefinitionMap memberMapDefinition, final PropertyMap memberMap, + final boolean mapReadOnly) {
final List<PropertyDefinition> memberDefinitions = new ArrayList<PropertyDefinition>( memberMapDefinition.getOrderedPropertyDefinitions()); @@ -1736,7 +1819,13 @@ public class ConfigurationEditor extends EnhancedVLayout { existingRecord.refresh(); summaryTable.updateData(existingRecord); } - firePropertyChangedEvent(propertyList, propertyDefinitionList, true); + boolean listGridRecordCountValid = isListGridRecordCountValid(summaryTable.getRecords(), propertyDefinitionList.getMin(), + propertyDefinitionList.getMax()); + if (errorPanel.isVisible() + && listGridRecordCountValid) { + errorPanel.setVisible(false); + } + firePropertyChangedEvent(propertyList, propertyDefinitionList, listGridRecordCountValid); summaryTable.redraw(); }
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 92a3e8c..dae0261 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 @@ -1425,6 +1425,9 @@ view_configEdit_hideAll = Hide All view_configEdit_jumpToSection = Jump to Section view_configEdit_maxBoundsExceeded = Cannot add another entry because the maximum size bounds has been met: {0} view_configEdit_minBoundsExceeded = Cannot delete this entry as the minimum has been set to: {0} +view_configEdit_invalidListSizeMin = The list should contain at least {0} row(s) +view_configEdit_invalidListSizeMax = The list should contain {0} row(s) at most +view_configEdit_invalidListSizeMinMax = The list should contain a minimum of {0} and a maximum of {1} row(s) view_configEdit_msg_1 = Added property [{0}] to the set. view_configEdit_msg_2 = Removed properties from the set. view_configEdit_msg_3 = [{0} {1}] deleted from list. diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties index 1e58484..a790810 100644 --- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties +++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties @@ -1438,6 +1438,9 @@ view_configEdit_hideAll = Skrýt vše view_configEdit_jumpToSection = Přejít na sekci ##view_configEdit_maxBoundsExceeded = Cannot add another entry because the maximum size bounds has been met: {0} ##view_configEdit_minBoundsExceeded = Cannot delete this entry as the minimum has been set to: {0} +#view_configEdit_invalidListSizeMin = The list should contain at least {0} row(s) +#view_configEdit_invalidListSizeMax = The list should contain {0} row(s) at most +#view_configEdit_invalidListSizeMinMax = The list should contain a minimum of {0} and a maximum of {1} row(s) view_configEdit_msg_1 = Přidána vlastnost [{0}] view_configEdit_msg_2 = Vlastnost odebrána z množiny. view_configEdit_msg_3 = [{0} {1}] smazáno ze seznamu. diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties index 3d41331..08b1d22 100644 --- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties +++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties @@ -1330,6 +1330,9 @@ view_configEdit_hideAll = Alle verbergen view_configEdit_jumpToSection = Zum Abschnitt springen ##view_configEdit_maxBoundsExceeded = Cannot add another entry because the maximum size bounds has been met: {0} ##view_configEdit_minBoundsExceeded = Cannot delete this entry as the minimum has been set to: {0} +#view_configEdit_invalidListSizeMin = The list should contain at least {0} row(s) +#view_configEdit_invalidListSizeMax = The list should contain {0} row(s) at most +#view_configEdit_invalidListSizeMinMax = The list should contain a minimum of {0} and a maximum of {1} row(s) view_configEdit_msg_1 = Eigentschaft [{0}] zur Menge hinzugefügt ##view_configEdit_msg_2 = Removed properties from the set. view_configEdit_msg_3 = [{0} {1}] aus der Liste gelöscht. diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties index aded1a8..4e14dd0 100644 --- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties +++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties @@ -1415,6 +1415,9 @@ view_configEdit_hideAll = すべて隠す view_configEdit_jumpToSection = セクションへのジャンプ ##view_configEdit_maxBoundsExceeded = Cannot add another entry because the maximum size bounds has been met: {0} ##view_configEdit_minBoundsExceeded = Cannot delete this entry as the minimum has been set to: {0} +#view_configEdit_invalidListSizeMin = The list should contain at least {0} row(s) +#view_configEdit_invalidListSizeMax = The list should contain {0} row(s) at most +#view_configEdit_invalidListSizeMinMax = The list should contain a minimum of {0} and a maximum of {1} row(s) view_configEdit_msg_1 = プロパティ [{0}] をセットに追加しました view_configEdit_msg_2 = セットからプロパティを取り除きました view_configEdit_msg_3 = [{0} {1}] がリストから削除されました diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties index 02fe8fd..9cfec15 100644 --- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties +++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties @@ -1263,6 +1263,9 @@ view_configEdit_files = 파일 view_configEdit_hideAll = 모두 숨기기 view_configEdit_maxBoundsExceeded = 최대 크기 범위가 충족되었기 때문에 또 다른 항목을 추가할 수 없습니다: {0} view_configEdit_minBoundsExceeded = 최소로 설정되었으므로 이 항목을 삭제할 수 없습니다: {0} +#view_configEdit_invalidListSizeMin = The list should contain at least {0} row(s) +#view_configEdit_invalidListSizeMax = The list should contain {0} row(s) at most +#view_configEdit_invalidListSizeMinMax = The list should contain a minimum of {0} and a maximum of {1} row(s) view_configEdit_msg_1 = 속성 [{0}]을 세트에 추가했습니다. view_configEdit_msg_2 = 세트에서 속성을 제거했습니다. view_configEdit_msg_3 = [{0} {1}] 이 목록에서 제거 되었습니다. diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties index e4ff417..d69d7dc 100644 --- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties +++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties @@ -1427,6 +1427,9 @@ view_configEdit_hideAll = Ocultar todos view_configEdit_jumpToSection = Ir direto para a Sele\u00E7\u00E3o ##view_configEdit_maxBoundsExceeded = Cannot add another entry because the maximum size bounds has been met: {0} ##view_configEdit_minBoundsExceeded = Cannot delete this entry as the minimum has been set to: {0} +#view_configEdit_invalidListSizeMin = The list should contain at least {0} row(s) +#view_configEdit_invalidListSizeMax = The list should contain {0} row(s) at most +#view_configEdit_invalidListSizeMinMax = The list should contain a minimum of {0} and a maximum of {1} row(s) view_configEdit_msg_1 = Propriedade [{0}] adicionada ao conjunto. view_configEdit_msg_2 = Propriedades removidas do conjunto. view_configEdit_msg_3 = [{0} {1}] removido da lista. diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties index 6202177..fa3f59c 100644 --- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties +++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties @@ -1312,6 +1312,11 @@ #view_configEdit_files = Files #view_configEdit_hideAll = Hide All #view_configEdit_jumpToSection = Jump to Section +##view_configEdit_maxBoundsExceeded = Cannot add another entry because the maximum size bounds has been met: {0} +##view_configEdit_minBoundsExceeded = Cannot delete this entry as the minimum has been set to: {0} +#view_configEdit_invalidListSizeMin = The list should contain at least {0} row(s) +#view_configEdit_invalidListSizeMax = The list should contain {0} row(s) at most +#view_configEdit_invalidListSizeMinMax = The list should contain a minimum of {0} and a maximum of {1} row(s) #view_configEdit_msg_1 = Added property [{0}] to the set. #view_configEdit_msg_2 = Removed properties from the set. #view_configEdit_msg_3 = [{0} {1}] deleted from list. diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties index 87b706c..ad25cfe 100644 --- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties +++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties @@ -1411,6 +1411,9 @@ view_configEdit_hideAll = \u9690\u85cf\u6240\u6709 view_configEdit_jumpToSection = \u8df3\u81f3\u6a21\u5757 ##view_configEdit_maxBoundsExceeded = Cannot add another entry because the maximum size bounds has been met: {0} ##view_configEdit_minBoundsExceeded = Cannot delete this entry as the minimum has been set to: {0} +#view_configEdit_invalidListSizeMin = The list should contain at least {0} row(s) +#view_configEdit_invalidListSizeMax = The list should contain {0} row(s) at most +#view_configEdit_invalidListSizeMinMax = The list should contain a minimum of {0} and a maximum of {1} row(s) view_configEdit_msg_1 = \u589e\u52a0\u5c5e\u6027 [{0}]\u5230\u96c6\u5408. view_configEdit_msg_2 = \u79fb\u9664\u96c6\u5408\u5185\u6240\u6709\u7684\u5c5e\u6027. view_configEdit_msg_3 = \u4ece\u5217\u8868\u4e2d\u5220\u9664[{0} {1}]\u6210\u529f. diff --git a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css index 393ffb4..dac51cc 100644 --- a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css +++ b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css @@ -376,6 +376,10 @@ a.menuBar, a.menuBar:link, a.menuBar:visited, a.menuBar:hover { color: #00AC3D; /* medium green */ }
+.InlineError { + color: #EE4444; /* medium red */ +} + .log-panel { z-index: 9999999 !important; } diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DatasourceComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DatasourceComponent.java index 9a5071d..30609969 100644 --- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DatasourceComponent.java +++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DatasourceComponent.java @@ -1,3 +1,22 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2013 Red Hat, Inc. + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + package org.rhq.modules.plugins.jbossas7;
import static java.lang.Boolean.FALSE; @@ -112,36 +131,32 @@ public class DatasourceComponent extends BaseComponent<BaseComponent<?>> impleme // outer create resource did not cater for the xa properties, so lets add them now if (createResourceReport.getResourceType().getName().toLowerCase().contains("xa")) { PropertyList listPropertyWrapper = createResourceReport.getResourceConfiguration().getList("*2"); - if (listPropertyWrapper != null) { - List<Property> listProperty = listPropertyWrapper.getList(); - - String baseAddress = resourceReport.getResourceKey(); - - if (!listProperty.isEmpty()) { - CompositeOperation cop = new CompositeOperation(); - for (Property p : listProperty) { - PropertyMap map = (PropertyMap) p; - String key = map.getSimpleValue("key", null); - String value = map.getSimpleValue("value", null); - if (key == null || value == null) - continue; - - Address propertyAddress = new Address(baseAddress); - propertyAddress.add("xa-datasource-properties", key); - Operation op = new Operation("add", propertyAddress); - op.addAdditionalProperty("value", value); - cop.addStep(op); + List<Property> listProperty = listPropertyWrapper.getList();
- } + String baseAddress = resourceReport.getResourceKey();
- Result res = getASConnection().execute(cop); - if (!res.isSuccess()) { - resourceReport.setErrorMessage("Datasource was added, but setting xa-properties failed: " - + res.getFailureDescription()); - resourceReport.setStatus(CreateResourceStatus.FAILURE); - return resourceReport; - } - } + CompositeOperation cop = new CompositeOperation(); + for (Property p : listProperty) { + PropertyMap map = (PropertyMap) p; + String key = map.getSimpleValue("key", null); + String value = map.getSimpleValue("value", null); + if (key == null || value == null) + continue; + + Address propertyAddress = new Address(baseAddress); + propertyAddress.add("xa-datasource-properties", key); + Operation op = new Operation("add", propertyAddress); + op.addAdditionalProperty("value", value); + cop.addStep(op); + + } + + Result res = getASConnection().execute(cop); + if (!res.isSuccess()) { + resourceReport.setErrorMessage("Datasource was added, but setting xa-properties failed: " + + res.getFailureDescription()); + resourceReport.setStatus(CreateResourceStatus.INVALID_ARTIFACT); + return resourceReport; } }
@@ -157,21 +172,21 @@ public class DatasourceComponent extends BaseComponent<BaseComponent<?>> impleme .setAttributeValue(enabledPropertyValue, new EnabledAttributeHelperCallbacks() { @Override public void onReadAttributeFailure(Result opResult) { - resourceReport.setStatus(CreateResourceStatus.FAILURE); + resourceReport.setStatus(CreateResourceStatus.INVALID_ARTIFACT); resourceReport.setErrorMessage("Data source was added, " + "but could not read its configuration after creation: " + opResult.getFailureDescription()); }
@Override public void onEnableOperationFailure(Result opResult) { - resourceReport.setStatus(CreateResourceStatus.FAILURE); + resourceReport.setStatus(CreateResourceStatus.INVALID_ARTIFACT); resourceReport.setErrorMessage("Datasource was added but not enabled: " + opResult.getFailureDescription()); }
@Override public void onDisableOperationFailure(Result opResult) { - resourceReport.setStatus(CreateResourceStatus.FAILURE); + resourceReport.setStatus(CreateResourceStatus.INVALID_ARTIFACT); resourceReport.setErrorMessage("Datasource was added but not disabled: " + opResult.getFailureDescription()); } diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml index 1fd2e82..e7cf5a1 100644 --- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml @@ -688,7 +688,7 @@ <c:simple-property name="no-recovery" required="false" type="boolean" readOnly="true" description="if true no recovery are tried for this connection pool"/>
<c:group name="children:xa-datasource-properties:key+-" displayName="XA Datasource Properties"> - <c:list-property name="*2" displayName="Properties" required="false" readOnly="false"> + <c:list-property name="*2" displayName="Properties" required="true" readOnly="false" min="1"> <c:map-property name="*:key" displayName="Name" readOnly="false"> <c:simple-property name="key" displayName="Property-Name" readOnly="false"/> <c:simple-property name="value" displayName="Value" readOnly="false"/>
rhq-commits@lists.fedorahosted.org