[rhq] Branch 'rhq-on-as7' - 22 commits - modules/core modules/enterprise modules/integration-tests modules/plugins

Jay Shaughnessy jshaughn at fedoraproject.org
Fri Aug 31 17:54:30 UTC 2012


 modules/core/dbutils/pom.xml                                                                                                               |    2 
 modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml                                                                             |   25 +
 modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertCondition.java                                                            |    2 
 modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ObfuscatedPropertySimple.java                                          |    3 
 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/CliNotificationSenderForm.java        |    5 
 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java                             |   45 ++
 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java |    1 
 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceCompositeSearchView.java     |  116 ++++--
 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java              |    6 
 modules/enterprise/server/appserver/pom.xml                                                                                                |    1 
 modules/enterprise/server/sars/services-sar/pom.xml                                                                                        |    7 
 modules/integration-tests/pom.xml                                                                                                          |   24 -
 modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java                                         |   31 +
 modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ConfigurationWriteDelegate.java                                  |   27 +
 modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ConnectorDiscoveryGroupValidatorComponent.java                   |   83 ++++
 modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DatasourceComponent.java                                         |   43 ++
 modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HornetQComponent.java                                            |   27 -
 modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HostControllerComponent.java                                     |    7 
 modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/JmsComponent.java                                                |   32 -
 modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SocketBindingGroupComponent.java                                 |   11 
 modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/StandaloneASComponent.java                                       |   56 ++-
 modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/TransactionsComponent.java                                       |   62 +++
 modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml                                                                      |  175 ++++++----
 modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/ConfigurationUpdatingTest.java                                   |   21 -
 modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/ResourcesStandaloneServerTest.java              |    3 
 modules/plugins/snmptrapd/pom.xml                                                                                                          |   12 
 26 files changed, 575 insertions(+), 252 deletions(-)

New commits:
commit dbafd8efeb4837643d79d4f6cf30c3bb5956a78a
Author: Jay Shaughnessy <jshaughn at jshaughn.csb>
Date:   Fri Aug 31 13:53:51 2012 -0400

    Don't play with the rhq.ear deployment marker files.  When building
    from the top we get an unwanted .dodeploy which messes up the initial
    server startup.  It worked well when building the invidual module,
    but now the dev will likely need to manually rebuild or redeploy the ear.

diff --git a/modules/enterprise/server/sars/services-sar/pom.xml b/modules/enterprise/server/sars/services-sar/pom.xml
index 143982e..a66aa8a 100644
--- a/modules/enterprise/server/sars/services-sar/pom.xml
+++ b/modules/enterprise/server/sars/services-sar/pom.xml
@@ -81,13 +81,6 @@
                                         <jar destfile="${deployment.dir}">
                                             <fileset dir="target/${project.build.finalName}" />
                                         </jar>
-                                        <property name="dodeploy.file" location="${deployment.dir}/../../${rhq.earName}.dodeploy" />
-                                        <property name="skipdeploy.file" location="${deployment.dir}/../../${rhq.earName}.skipdeploy" />
-                                        <property name="failed.file" location="${deployment.dir}/../../${rhq.earName}.failed" />
-                                        <echo>*** Touching ${dodeploy.file} to force redeployment of ${rhq.deploymentName}...</echo>
-                                        <touch file="${dodeploy.file}" />
-                                        <delete file="${skipdeploy.file}" /> <!-- in case this exists -->
-                                        <delete file="${failed.file}" /> <!-- in case this exists -->
                                     </target>
                                 </configuration>
                                 <goals>


commit 7bd638810c7bac3b3a779ea264ef17aca21fc6c4
Author: Jay Shaughnessy <jshaughn at jshaughn.csb>
Date:   Fri Aug 31 13:19:55 2012 -0400

    A few more legacy hibernate3 deps removed.

diff --git a/modules/enterprise/server/appserver/pom.xml b/modules/enterprise/server/appserver/pom.xml
index 36a74a4..099e649 100644
--- a/modules/enterprise/server/appserver/pom.xml
+++ b/modules/enterprise/server/appserver/pom.xml
@@ -147,7 +147,6 @@
                                     <property name="jboss-javassist.version"       value="${jboss-javassist.version}" />
                                     <property name="jsf-api.version"               value="${jsf-api.version}" />
                                     <property name="jsf-impl.version"              value="${jsf-impl.version}" />
-                                    <property name="hibernate3.version"            value="${hibernate3.version}" />
                                     <property name="quartz.version"                value="${quartz.version}" />
                                     <property name="xercesImpl.version"            value="${xercesImpl.version}" />
 
diff --git a/modules/integration-tests/pom.xml b/modules/integration-tests/pom.xml
index 82f32cd..3b00c78 100644
--- a/modules/integration-tests/pom.xml
+++ b/modules/integration-tests/pom.xml
@@ -31,30 +31,6 @@
             <scope>provided</scope>
         </dependency>
 
-        <!--
-           TODO: This is a fix for the Javac bug requiring annotations to be available when compiling dependent classes.
-           It is fixed in JDK 6.
-        -->
-        <dependency>
-            <groupId>javax.persistence</groupId>
-            <artifactId>persistence-api</artifactId>
-            <version>1.0</version>
-            <scope>provided</scope>
-            <!-- by RHQ container -->
-        </dependency>
-
-        <!--
-           TODO: This is a fix for the Javac bug requiring annotations to be available when compiling dependent classes;
-           it is fixed in JDK 6.
-        -->
-        <dependency>
-            <groupId>jboss.jboss-embeddable-ejb3</groupId>
-            <artifactId>hibernate-all</artifactId>
-            <version>1.0.0.Alpha9</version>
-            <scope>provided</scope>
-            <!-- by RHQ container -->
-        </dependency>
-
     </dependencies>
 
     <profiles>
diff --git a/modules/plugins/snmptrapd/pom.xml b/modules/plugins/snmptrapd/pom.xml
index 46faaa9..ad78190 100644
--- a/modules/plugins/snmptrapd/pom.xml
+++ b/modules/plugins/snmptrapd/pom.xml
@@ -246,18 +246,6 @@
       <scope>provided</scope>
     </dependency>
     <dependency>
-      <groupId>javax.persistence</groupId>
-      <artifactId>persistence-api</artifactId>
-      <version>1.0</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>hibernate-annotations</groupId>
-      <artifactId>hibernate-annotations</artifactId>
-      <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
       <groupId>javax.xml.bind</groupId>
       <artifactId>jaxb-api</artifactId>
       <version>2.1</version>


commit f6b064194713feb1617baea52939acaa9739da6f
Merge: d60bd46 e33404e
Author: Jay Shaughnessy <jshaughn at jshaughn.csb>
Date:   Fri Aug 31 13:03:43 2012 -0400

    Merge branch 'master' into rhq-on-as7



commit e33404e91d4b0cfc681e7816872e93c107b5d8f5
Author: Jirka Kremser <jkremser at redhat.com>
Date:   Fri Aug 31 13:02:07 2012 +0200

    [BZ 773626 - Failed to load resource composite data error when refreshing Inventory page (Unavailable Servers, Servers, etc)] handling the exception on the client side and re-fetch the data

diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
index 55271c6..383602b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
@@ -171,6 +171,12 @@ public class ResourceDatasource extends RPCDataSource<Resource, ResourceCriteria
                 if (caught.getMessage().contains("SearchExpressionException")) {
                     Message message = new Message("Invalid search expression.", Message.Severity.Error);
                     CoreGUI.getMessageCenter().notify(message);
+                } else if (caught.getMessage().contains("PageList was passed an empty collection")) {
+                    // Because of bug 773626
+                    Log.warn(caught.getMessage());
+                    criteria.setPageControl(new PageControl(0, getDataPageSize()));
+                    executeFetch(request, response, criteria);
+                    return;
                 } else {
                     CoreGUI.getErrorHandler().handleError(MSG.view_inventory_resources_loadFailed(), caught);
                 }


commit 1293a88ef64918b6401bd830a0739c8f22398fc9
Author: Simeon Pinder <spinder at fulliautomatix.conchfritter.com>
Date:   Thu Aug 30 16:11:28 2012 -0400

     [BZ 840512] adding logic to defend against @PostLoad logic not being called after installation as expected.

diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ObfuscatedPropertySimple.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ObfuscatedPropertySimple.java
index 07b3467..bb00ef5 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ObfuscatedPropertySimple.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ObfuscatedPropertySimple.java
@@ -122,6 +122,9 @@ public class ObfuscatedPropertySimple extends PropertySimple {
      */
     @Override
     public String getStringValue() {
+        if (clearTextValue == null) {
+            initClearTextValue();
+        }
         return clearTextValue;
     }
     


commit 26941dd6fb00043842ad5d4e6786b1f5ed391382
Author: Jay Shaughnessy <jshaughn at redhat.com>
Date:   Thu Aug 30 11:18:30 2012 -0400

    [Bug 852561 - AlertCondition.name is null in database after JON 2.4 to 3.1 upgrade]
    fix merge issue

diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index 94fa46f..1443b80 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -4010,20 +4010,22 @@
 <!-- RHQ 4.4, JON 3.1.0 RELEASE uses DB Schema 2.121 -->
             
             <schemaSpec version="2.122">
-                <statement desc="Updating DOWN Alert Conditions to new format">
-                    UPDATE RHQ_ALERT_CONDITION
-                       SET NAME = 'AVAIL_GOES_DOWN', OPTION_STATUS = NULL 
-                     WHERE TYPE = 'AVAILABILITY' 
-                       AND NAME IS NULL
-                       AND OPTION_STATUS = 'DOWN'
-                </statement>
-                <statement desc="Updating UP Alert Conditions to new format">
-                    UPDATE RHQ_ALERT_CONDITION
-                       SET NAME = 'AVAIL_GOES_UP', OPTION_STATUS = NULL 
-                     WHERE TYPE = 'AVAILABILITY'
-                       AND NAME IS NULL
-                       AND OPTION_STATUS = 'UP'
-                </statement>                
+                <schema-directSQL>                
+                   <statement desc="Updating DOWN Alert Conditions to new format">
+                      UPDATE RHQ_ALERT_CONDITION
+                         SET NAME = 'AVAIL_GOES_DOWN', OPTION_STATUS = NULL 
+                       WHERE TYPE = 'AVAILABILITY' 
+                         AND NAME IS NULL
+                         AND OPTION_STATUS = 'DOWN'
+                   </statement>
+                   <statement desc="Updating UP Alert Conditions to new format">
+                      UPDATE RHQ_ALERT_CONDITION
+                         SET NAME = 'AVAIL_GOES_UP', OPTION_STATUS = NULL 
+                       WHERE TYPE = 'AVAILABILITY'
+                         AND NAME IS NULL
+                         AND OPTION_STATUS = 'UP'
+                   </statement>      
+                </schema-directSQL>                    
             </schemaSpec>
             
 <!-- JON 3.1.1 RELEASE uses DB Schema 2.122 -->            


commit 35c152e87e280d8a5cd93353892da39067883819
Author: Jay Shaughnessy <jshaughn at redhat.com>
Date:   Wed Aug 29 15:39:00 2012 -0400

    [Bug 852561 - AlertCondition.name is null in database after JON 2.4 to 3.1 upgrade]
    From an RHQ perspective this should have affected upgrades to RHQ 4.4.  Add
    a db upgrade step to convert relevant alert condition rows to the new format.

diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index d4b5505..eee04da 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -17,7 +17,7 @@
     <description>Database schema setup, upgrade and other utilities</description>
 
     <properties>
-        <db.schema.version>2.122</db.schema.version>
+        <db.schema.version>2.123</db.schema.version>
         <rhq.ds.type-mapping>${rhq.test.ds.type-mapping}</rhq.ds.type-mapping>
         <rhq.ds.server-name>${rhq.test.ds.server-name}</rhq.ds.server-name>
         <rhq.ds.db-name>${rhq.test.ds.db-name}</rhq.ds.db-name>
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index 2cee9f4..94fa46f 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -4007,7 +4007,28 @@
               <schema-javaTask className="ContentSourceConfigurationObfuscationUpgradeTask" />
             </schemaSpec>
 
-             <schemaSpec version="2.122">
+<!-- RHQ 4.4, JON 3.1.0 RELEASE uses DB Schema 2.121 -->
+            
+            <schemaSpec version="2.122">
+                <statement desc="Updating DOWN Alert Conditions to new format">
+                    UPDATE RHQ_ALERT_CONDITION
+                       SET NAME = 'AVAIL_GOES_DOWN', OPTION_STATUS = NULL 
+                     WHERE TYPE = 'AVAILABILITY' 
+                       AND NAME IS NULL
+                       AND OPTION_STATUS = 'DOWN'
+                </statement>
+                <statement desc="Updating UP Alert Conditions to new format">
+                    UPDATE RHQ_ALERT_CONDITION
+                       SET NAME = 'AVAIL_GOES_UP', OPTION_STATUS = NULL 
+                     WHERE TYPE = 'AVAILABILITY'
+                       AND NAME IS NULL
+                       AND OPTION_STATUS = 'UP'
+                </statement>                
+            </schemaSpec>
+            
+<!-- JON 3.1.1 RELEASE uses DB Schema 2.122 -->            
+
+            <schemaSpec version="2.123">
                <schema-addColumn   table="RHQ_CONFIG_PROP_DEF" column="MIN_ENTRIES" columnType="INTEGER"/>
                <schema-addColumn   table="RHQ_CONFIG_PROP_DEF" column="MAX_ENTRIES" columnType="INTEGER"/>
             </schemaSpec>
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertCondition.java b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertCondition.java
index 8a72244..0744199 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertCondition.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertCondition.java
@@ -427,7 +427,7 @@ public class AlertCondition implements Serializable {
     /**
      * The name of the condition whose semantics are different based on this condition's category:
      * 
-     * AVAILABILITY: n/a (null)
+     * AVAILABILITY: The relevant Avail AlertConditionOperator name
      * THRESHOLD: the name of the metric (TODO: today its the display name, very bad for i18n purposes)
      * BASELINE: the name of the metric (TODO: today its the display name, very bad for i18n purposes)
      * CHANGE: the name of the metric (TODO: today its the display name, very bad for i18n purposes)


commit 74704eda37bce26278fa089437d98bcd590b4317
Author: Jirka Kremser <jkremser at redhat.com>
Date:   Wed Aug 29 14:15:26 2012 +0200

    [BZ 814305 - Dealing with singletons in inventory] Refresh button now takes into consideration the already created singletons and they are not populated in the create/import child combobox

diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
index 2eea340..d539136 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
@@ -597,7 +597,7 @@ public class Table<DS extends RPCDataSource> extends LocatableHLayout implements
             } else {
                 // menu action
                 LocatableMenu menu = new LocatableMenu(tableAction.getLocatorId() + "Menu");
-                final Map<String, ? extends Object> menuEntries = tableAction.getValueMap();
+                final Map<String, Object> menuEntries = tableAction.getValueMap();
                 for (final String key : menuEntries.keySet()) {
                     MenuItem item = new MenuItem(key);
                     item.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
@@ -980,7 +980,7 @@ public class Table<DS extends RPCDataSource> extends LocatableHLayout implements
      * completion. Failure to do so may leave the widgets disabled.
      */
     public void addTableAction(String locatorId, String title, String confirmation,
-        LinkedHashMap<String, ? extends Object> valueMap, TableAction tableAction) {
+        Map<String, Object> valueMap, TableAction tableAction) {
         // If the specified locator ID is qualified, strip off the ancestry prefix, so we can make sure its locator ID
         // extends the footer's locator ID as it should.
         int underscoreIndex = locatorId.lastIndexOf('_');
@@ -995,6 +995,37 @@ public class Table<DS extends RPCDataSource> extends LocatableHLayout implements
         tableActions.add(info);
     }
 
+    /**
+     * Updates the list of table's associated actions <code>tableActions</code>.
+     * It automatically updates the gui by calling <code>drawFooter()</code> provided the table has been initialized.
+     * 
+     * Note: To prevent user action while a current action completes, all widgets on the footer are disabled
+     * when footer actions take place, typically a button click. It is up to the action to ensure the page
+     * (via refresh() or CoreGUI.refresh()) or footer (via refreshTableActions) are refreshed as needed at action
+     * completion. Failure to do so may leave the widgets disabled.
+     * 
+     * @param title the title of a modified action
+     * @param valueMap the map containing the tuples with name of a select item and <code>actionValue</code> which is 
+     * then passed to <code>tableAction.executeAction()</code>; use the <code>LinkedHashMap</code> if you want to 
+     * preserve the order of map items
+     * @param tableAction the tableAction object (on this object the <code>executeAction()</code> is actually invoked)
+     */
+    public void updateTableAction(String title, Map<String, Object> valueMap,
+        TableAction tableAction) {
+        if (title == null) {
+            return;
+        }
+        for (TableActionInfo info : tableActions) {
+            if (title.equals(info.getTitle())) {
+                if (valueMap != null) info.setValueMap(valueMap);
+                if (tableAction != null) info.setAction(tableAction);
+                // the action listeners have to be re-added
+                if (isInitialized()) drawFooter();
+                break;
+            }
+        }
+    }
+
     public void setListGridDoubleClickHandler(DoubleClickHandler handler) {
         doubleClickHandler = handler;
     }
@@ -1247,12 +1278,12 @@ public class Table<DS extends RPCDataSource> extends LocatableHLayout implements
         private String locatorId;
         private String title;
         private String confirmMessage;
-        private LinkedHashMap<String, ? extends Object> valueMap;
+        private Map<String, Object> valueMap;
         private TableAction action;
         private Canvas actionCanvas;
 
         protected TableActionInfo(String locatorId, String title, String confirmMessage,
-            LinkedHashMap<String, ? extends Object> valueMap, TableAction action) {
+            Map<String, Object> valueMap, TableAction action) {
             this.locatorId = locatorId;
             this.title = title;
             this.confirmMessage = confirmMessage;
@@ -1272,9 +1303,13 @@ public class Table<DS extends RPCDataSource> extends LocatableHLayout implements
             return confirmMessage;
         }
 
-        public LinkedHashMap<String, ? extends Object> getValueMap() {
+        public Map<String, Object> getValueMap() {
             return valueMap;
         }
+        
+        public void setValueMap(Map<String, Object> valueMap) {
+            this.valueMap = valueMap;
+        }
 
         public Canvas getActionCanvas() {
             return actionCanvas;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceCompositeSearchView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceCompositeSearchView.java
index bb43f26..265778b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceCompositeSearchView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceCompositeSearchView.java
@@ -89,41 +89,49 @@ public class ResourceCompositeSearchView extends ResourceSearchView {
         super.onInit();
 
         // To properly filter Create Child and Import menus we need existing singleton child resources. If the
-        // user has creat permission and the parent type has singleton child types and creatable or importable child
+        // user has create permission and the parent type has singleton child types and creatable or importable child
         // types, perform an async call to fetch the singleton children. If we make the async call don't declare this
-        // instance initialized until after it completesas we must  have the children before the menu buttons can be drawn.
+        // instance initialized until after it completes as we must have the children before the menu buttons can be drawn.
 
         final Resource parentResource = parentResourceComposite.getResource();
         ResourceType parentType = parentResource.getResourceType();
-
         creatableChildTypes = getCreatableChildTypes(parentType);
         importableChildTypes = getImportableChildTypes(parentType);
         hasCreatableTypes = !creatableChildTypes.isEmpty();
         hasImportableTypes = !importableChildTypes.isEmpty();
-        singletonChildren = new ArrayList(); // initialize to non-null
+        refreshSingletons(parentResource, null);
+        
+    }
+    
+    private void refreshSingletons(final Resource parentResource, final AsyncCallback<PageList<Resource>> callback) {
+        singletonChildren = new ArrayList<Resource>(); // initialize to non-null
 
-        Integer[] singletonChildTypes = getSingletonChildTypes(parentType);
+        Integer[] singletonChildTypes = getSingletonChildTypes(parentResource.getResourceType());
 
         if (canCreate && singletonChildTypes.length > 0 && (hasCreatableTypes || hasImportableTypes)) {
             ResourceCriteria criteria = new ResourceCriteria();
             criteria.addFilterParentResourceId(parentResource.getId());
             criteria.addFilterResourceTypeIds(singletonChildTypes);
-            GWTServiceLookup.getResourceService().findResourcesByCriteria(criteria,
-                new AsyncCallback<PageList<Resource>>() {
-
-                    @Override
-                    public void onSuccess(PageList<Resource> result) {
-                        singletonChildren = result;
-                        initialized = true;
+            GWTServiceLookup.getResourceService().findResourcesByCriteria(criteria, new AsyncCallback<PageList<Resource>>() {
+
+                @Override
+                public void onSuccess(PageList<Resource> result) {
+                    singletonChildren = result;
+                    initialized = true;
+                    if (callback != null) {
+                        callback.onSuccess(result);
                     }
+                }
 
-                    @Override
-                    public void onFailure(Throwable caught) {
-                        Log.error("Failed to load child resources for [" + parentResource + "]", caught);
-                        initialized = true;
+                @Override
+                public void onFailure(Throwable caught) {
+                    Log.error("Failed to load child resources for [" + parentResource + "]", caught);
+                    initialized = true;
+                    if (callback != null) {
+                        callback.onFailure(caught);
                     }
-                });
-
+                }
+            });
         } else {
             initialized = true;
         }
@@ -196,34 +204,38 @@ public class ResourceCompositeSearchView extends ResourceSearchView {
                 }
             });
 
-        addImportAndCreateButtons();
+        addImportAndCreateButtons(false);
 
         super.configureTable();
     }
 
     @SuppressWarnings("unchecked")
-    private void addImportAndCreateButtons() {
+    private void addImportAndCreateButtons(boolean override) {
 
         final Resource parentResource = parentResourceComposite.getResource();
         ResourceType parentType = parentResource.getResourceType();
 
         // Create Child Menu and Manual Import Menu
         if (canCreate && (hasCreatableTypes || hasImportableTypes)) {
-
             if (hasCreatableTypes) {
                 Map<String, ResourceType> displayNameMap = getDisplayNames(creatableChildTypes);
                 LinkedHashMap<String, ResourceType> createTypeValueMap = new LinkedHashMap<String, ResourceType>(
                     displayNameMap);
                 removeExistingSingletons(singletonChildren, createTypeValueMap);
-                addTableAction(extendLocatorId("CreateChild"), MSG.common_button_create_child(), null,
-                    createTypeValueMap, new AbstractTableAction(TableActionEnablement.ALWAYS) {
-                        public void executeAction(ListGridRecord[] selection, Object actionValue) {
-                            ResourceFactoryCreateWizard.showCreateWizard(parentResource, (ResourceType) actionValue);
-                            // we can refresh the table buttons immediately since the wizard is a dialog, the
-                            // user can't access enabled buttons anyway.
-                            ResourceCompositeSearchView.this.refreshTableInfo();
-                        }
-                    });
+                AbstractTableAction createAction = new AbstractTableAction(TableActionEnablement.ALWAYS) {
+                    public void executeAction(ListGridRecord[] selection, Object actionValue) {
+                        ResourceFactoryCreateWizard.showCreateWizard(parentResource, (ResourceType) actionValue);
+                        // we can refresh the table buttons immediately since the wizard is a dialog, the
+                        // user can't access enabled buttons anyway.
+                        ResourceCompositeSearchView.this.refreshTableInfo();
+                    }
+                };
+                if (override) {
+                    updateTableAction(MSG.common_button_create_child(), createTypeValueMap, createAction);
+                } else {
+                    addTableAction(extendLocatorId("CreateChild"), MSG.common_button_create_child(), null,
+                        createTypeValueMap, createAction);
+                }
             }
 
             if (hasImportableTypes) {
@@ -231,18 +243,23 @@ public class ResourceCompositeSearchView extends ResourceSearchView {
                 LinkedHashMap<String, ResourceType> importTypeValueMap = new LinkedHashMap<String, ResourceType>(
                     displayNameMap);
                 removeExistingSingletons(singletonChildren, importTypeValueMap);
-                addTableAction(extendLocatorId("Import"), MSG.common_button_import(), null, importTypeValueMap,
-                    new AbstractTableAction(TableActionEnablement.ALWAYS) {
-                        public void executeAction(ListGridRecord[] selection, Object actionValue) {
-                            ResourceFactoryImportWizard.showImportWizard(parentResource, (ResourceType) actionValue);
-                            // we can refresh the table buttons immediately since the wizard is a dialog, the
-                            // user can't access enabled buttons anyway.
-                            ResourceCompositeSearchView.this.refreshTableInfo();
-                        }
-                    });
+                AbstractTableAction importAction = new AbstractTableAction(TableActionEnablement.ALWAYS) {
+                    public void executeAction(ListGridRecord[] selection, Object actionValue) {
+                        ResourceFactoryImportWizard.showImportWizard(parentResource, (ResourceType) actionValue);
+                        // we can refresh the table buttons immediately since the wizard is a dialog, the
+                        // user can't access enabled buttons anyway.
+                        ResourceCompositeSearchView.this.refreshTableInfo();
+                    }
+                };
+                if (override) {
+                    updateTableAction(MSG.common_button_import(), importTypeValueMap, importAction);
+                } else {
+                    addTableAction(extendLocatorId("Import"), MSG.common_button_import(), null, importTypeValueMap,
+                        importAction);
+                }
             }
 
-        } else {
+        } else if (!override) {
             if (!canCreate && hasCreatableTypes) {
                 addTableAction(extendLocatorId("CreateChild"), MSG.common_button_create_child(),
                     new AbstractTableAction(TableActionEnablement.NEVER) {
@@ -261,6 +278,7 @@ public class ResourceCompositeSearchView extends ResourceSearchView {
             }
         }
     }
+   
 
     private void removeExistingSingletons(List<Resource> singletonChildren, Map<String, ResourceType> displayNameMap) {
 
@@ -359,5 +377,23 @@ public class ResourceCompositeSearchView extends ResourceSearchView {
         return new ResourceCompositeSearchView(locatorId, parentResourceComposite, new Criteria("parentId",
             String.valueOf(parentResourceComposite.getResource().getId())), MSG.view_tabs_common_child_resources());
     }
+    
+    @Override
+    public void refresh() {
+        refreshSingletons(parentResourceComposite.getResource(), new AsyncCallback<PageList<Resource>>() {
+
+            @Override
+            public void onSuccess(PageList<Resource> result) {
+                addImportAndCreateButtons(true);
+                ResourceCompositeSearchView.super.refresh();
+            }
+
+            @Override
+            public void onFailure(Throwable caught) {
+                ResourceCompositeSearchView.super.refresh();
+            }
+        });
+
+    }
 
 }


commit c6c1e7819fbd8f667649223e12355e66ddd33252
Author: Stefan Negrea <snegrea at redhat.com>
Date:   Wed Aug 29 03:06:38 2012 -0500

    [BZ 852632] Remove allow-direct-connections-only property from configuration to prevent sending the value to the application server. If this property is not left undefined, the configuration file for the server becomes invalid if the user attempts to use discovery-group-name.

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 01618e2..46b3084 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
@@ -4714,7 +4714,6 @@
           <metric property="started" dataType="trait" description="Whether the cluster connection is started."/>
 
           <resource-configuration>
-            <c:simple-property name="allow-direct-connections-only" required="false" type="boolean" readOnly="true" defaultValue="false" description="Whether, if a node learns of the existence of a node that is more than 1 hop away, we do not create a bridge for direct cluster connection. Only relevant if &apos;static&#45;connectors&apos; is defined. The default value is false."/>
             <c:simple-property name="call-timeout" required="false" type="long" readOnly="true" defaultValue="30000" description="The timeout (in ms) for remote calls made by the cluster connection. The default value is 30000."/>
             <c:simple-property name="check-period" required="false" type="long" readOnly="true" defaultValue="30000" description="The period (in milliseconds) between client failure check. The default value is 30000."/>
             <c:simple-property name="cluster-connection-address" required="true" type="string" readOnly="true" description="Each cluster connection only applies to messages sent to an address that starts with this value."/>
@@ -6843,7 +6842,6 @@
           </plugin-configuration>
 
           <resource-configuration>
-            <c:simple-property name="allow-direct-connections-only" required="false" type="boolean" readOnly="false" defaultValue="false" description="Whether, if a node learns of the existence of a node that is more than 1 hop away, we do not create a bridge for direct cluster connection. Only relevant if &apos;static&#45;connectors&apos; is defined. The default value is false."/>
             <c:simple-property name="call-timeout" required="false" type="long" readOnly="false" defaultValue="30000" description="The timeout (in ms) for remote calls made by the cluster connection. The default value is 30000."/>
             <c:simple-property name="check-period" required="false" type="long" readOnly="false" defaultValue="30000" description="The period (in milliseconds) between client failure check. The default value is 30000."/>
             <c:simple-property name="cluster-connection-address" required="true" type="string" readOnly="false" description="Each cluster connection only applies to messages sent to an address that starts with this value."/>
@@ -12948,7 +12946,6 @@
         <metric property="started" dataType="trait" description="Whether the cluster connection is started."/>
 
         <resource-configuration>
-          <c:simple-property name="allow-direct-connections-only" required="false" type="boolean" readOnly="false" defaultValue="false" description="Whether, if a node learns of the existence of a node that is more than 1 hop away, we do not create a bridge for direct cluster connection. Only relevant if &apos;static&#45;connectors&apos; is defined. The default value is false."/>
           <c:simple-property name="call-timeout" required="false" type="long" readOnly="false" defaultValue="30000" description="The timeout (in ms) for remote calls made by the cluster connection. The default value is 30000."/>
           <c:simple-property name="check-period" required="false" type="long" readOnly="false" defaultValue="30000" description="The period (in milliseconds) between client failure check. The default value is 30000."/>
           <c:simple-property name="cluster-connection-address" required="true" type="string" readOnly="false" description="Each cluster connection only applies to messages sent to an address that starts with this value."/>


commit 74aa0f7f9b0f2dd1044450d924f61b3faee78c27
Author: Stefan Negrea <snegrea at redhat.com>
Date:   Wed Aug 29 02:52:42 2012 -0500

    [BZ 852552] Updates to set correctly all the data-source and xa-data-source properties that do not support null values and cannot be undefined.
    
    While these properties look undefined in the server, they cannot undefined or set to null at any point in time. The application server makes use of the default value at all times.

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 a4efae1..5011120 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
@@ -13,6 +13,9 @@ import org.rhq.core.domain.configuration.Configuration;
 import org.rhq.core.domain.configuration.Property;
 import org.rhq.core.domain.configuration.PropertyList;
 import org.rhq.core.domain.configuration.PropertyMap;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
 import org.rhq.core.domain.measurement.MeasurementDataNumeric;
 import org.rhq.core.domain.measurement.MeasurementDataTrait;
 import org.rhq.core.domain.measurement.MeasurementReport;
@@ -174,6 +177,27 @@ public class DatasourceComponent extends BaseComponent<BaseComponent<?>> impleme
         }
     }
 
+    @Override
+    public void updateResourceConfiguration(ConfigurationUpdateReport report) {
+        Configuration config = report.getConfiguration();
+        ConfigurationDefinition configDef = context.getResourceType().getResourceConfigurationDefinition();
+
+        //These properties cannot be undefined once set.
+        //Also the AS7 server does not accept null values even if the properties are still unset.
+        replaceWithDefaultIfNull("max-pool-size", config, configDef);
+        replaceWithDefaultIfNull("min-pool-size", config, configDef);
+        replaceWithDefaultIfNull("pool-prefill", config, configDef);
+        replaceWithDefaultIfNull("pool-use-strict-min", config, configDef);
+        replaceWithDefaultIfNull("blocking-timeout-wait-millis", config, configDef);
+        replaceWithDefaultIfNull("idle-timeout-minutes", config, configDef);
+        replaceWithDefaultIfNull("background-validation-millis", config, configDef);
+        replaceWithDefaultIfNull("background-validation-minutes", config, configDef);
+        replaceWithDefaultIfNull("background-validation", config, configDef);
+
+        ConfigurationWriteDelegate delegate = new ConfigurationWriteDelegate(configDef, getASConnection(), address);
+        delegate.updateResourceConfiguration(report);
+    }
+
     private void getRCAsMetric(MeasurementReport report, MeasurementScheduleRequest request) {
         Operation op = new ReadAttribute(getAddress(), request.getName());
         Result res = getASConnection().execute(op);
@@ -204,4 +228,23 @@ public class DatasourceComponent extends BaseComponent<BaseComponent<?>> impleme
 
         return trait;
     }
+
+    /**
+     * Replace the value configured by the user with the default value from the resource descriptor if
+     * the value to be sent to the server is null or empty.
+     *
+     * @param propertyName property name
+     * @param config configuration update
+     * @param configDef configuration definition
+     */
+    private void replaceWithDefaultIfNull(String propertyName, Configuration config, ConfigurationDefinition configDef) {
+        PropertyDefinitionSimple propertyDefinition = configDef.getPropertyDefinitionSimple(propertyName);
+
+        if (propertyDefinition != null) {
+            String propertyValue = config.getSimpleValue(propertyName);
+            if (propertyValue == null || propertyValue.isEmpty()) {
+                config.put(new PropertySimple(propertyName, propertyDefinition.getDefaultValue()));
+            }
+        }
+    }
 }
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 29ef057..01618e2 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
@@ -412,10 +412,10 @@
         <c:simple-property name="use-java-context" type="boolean" readOnly="false" required="false" default="true" description="Setting this to false will bind the DataSource into global JNDI;"/>
         <c:simple-property name="enabled" type="boolean" readOnly="true" required="false" description="Specifies if the datasource should be enabled"/>
         <c:simple-property name="jta" type="boolean" readOnly="false" required="false" default="true" description="Enable JTA integration"/>
-        <c:simple-property name="max-pool-size" type="integer" readOnly="false" required="false" description="The max-pool-size element indicates the maximum number of connections for a pool. No more connections will be created in each sub-pool."/>
-        <c:simple-property name="min-pool-size" type="integer" readOnly="false" required="false" description="The min-pool-size element indicates the minimum number of connections a pool should hold. These are not created until a Subject is known from a request for a connection."/>
-        <c:simple-property name="pool-prefill" type="boolean" readOnly="false" required="false" default="false" description="Whether to attempt to prefill the connection pool. Changing this value require a server restart."/>
-        <c:simple-property name="pool-use-strict-min" type="boolean" readOnly="false" required="false" default="false" description="Define if the min-pool-size should be considered a strictly."/>
+        <c:simple-property name="max-pool-size" type="integer" readOnly="false" required="false" defaultValue="20" description="The max-pool-size element indicates the maximum number of connections for a pool. No more connections will be created in each sub-pool."/>
+        <c:simple-property name="min-pool-size" type="integer" readOnly="false" required="false" defaultValue="0" description="The min-pool-size element indicates the minimum number of connections a pool should hold. These are not created until a Subject is known from a request for a connection."/>
+        <c:simple-property name="pool-prefill" type="boolean" readOnly="false" required="false" defaultValue="false" description="Whether to attempt to prefill the connection pool. Changing this value require a server restart."/>
+        <c:simple-property name="pool-use-strict-min" type="boolean" readOnly="false" required="false" defaultValue="false" description="Define if the min-pool-size should be considered a strictly."/>
         <c:simple-property name="security-domain" required="false" type="string" readOnly="false" description="Indicates Subject (from security domain) are used to distinguish connections in the pool. The content of the security-domain is the name of the JAAS security manager that will handleauthentication. This name correlates to the JAAS login-config.xml descriptor application-policy/name attribute."/>
         <c:simple-property name="reauth-plugin-class-name" required="false" type="string" readOnly="false" description="re-authentication plugin implementation provided for specific purpose (i.e vendor)"/>
         <!--
@@ -433,7 +433,7 @@
         </c:simple-property>
 
         <c:simple-property name="allow-multiple-users" type="boolean" required="false" readOnly="false" description="Specifies if multiple users will access the datasource through the getConnection(user, password) method and hence if the internal pool type should account for that"/>
-        <c:simple-property name="prepared-statements-cacheSize" type="long" readOnly="false" required="false" description="The number of prepared statements per connection in an LRU cache"/>
+        <c:simple-property name="prepared-statements-cache-size" type="long" readOnly="false" required="false" description="The number of prepared statements per connection in an LRU cache"/>
         <c:simple-property name="share-prepared-statements" type="boolean" readOnly="false" required="false" default="false" description="Whether to share prepare statements, i.e. whether asking for same statement twice without closing uses the same underlying prepared statement"/>
         <c:simple-property name="track-statements" type="string" readOnly="false" required="false" description="Whether to check for unclosed statements when a connection is returned to the pool and result sets are closed when a statement is closed/return to the prepared statement cache. valid values are: false - do not track statements and results true - track statements and result sets and warn when they are not closed nowarn - track statements but do no warn about them being unclosed">
           <c:property-options>
@@ -444,8 +444,8 @@
         </c:simple-property>
         <c:simple-property name="allocation-retry" type="integer" readOnly="false" required="false" description="The allocation retry element indicates the number of times that allocating a connection should be tried before throwing an exception."/>
         <c:simple-property name="allocation-retry-wait-millis" type="long" readOnly="false" required="false" description="Indicates the time in milliseconds to wait between retrying to allocate a connection."/>
-        <c:simple-property name="blocking-timeout-wait-millis" type="long" readOnly="false" required="false" description="The blocking-timeout-millis element indicates the maximum time in milliseconds to block while waiting for a connection before throwing an exception. Note that this blocks only while waiting for a permit for a connection, and will never throw an exception if creating a new connection takes an inordinately long time."/>
-        <c:simple-property name="idle-timeout-minutes" type="long" readOnly="false" required="false" description="The idle-timeout-minutes elements indicates the maximum time in minutes a connection may be idle before being closed. The actual maximum time depends also on the IdleRemover scan time, which is 1/2 the smallest idle-timeout-minutes of any pool. Changing this value require a server restart."/>
+        <c:simple-property name="blocking-timeout-wait-millis" type="long" readOnly="false" required="false" defaultValue="30000" description="The blocking-timeout-millis element indicates the maximum time in milliseconds to block while waiting for a connection before throwing an exception. Note that this blocks only while waiting for a permit for a connection, and will never throw an exception if creating a new connection takes an inordinately long time."/>
+        <c:simple-property name="idle-timeout-minutes" type="long" readOnly="false" required="false" defaultValue="15" description="The idle-timeout-minutes elements indicates the maximum time in minutes a connection may be idle before being closed. The actual maximum time depends also on the IdleRemover scan time, which is 1/2 the smallest idle-timeout-minutes of any pool. Changing this value require a server restart."/>
         <c:simple-property name="query-timeout" type="long" readOnly="false" required="false" description="Any configured query timeout in seconds The default is no timeout"/>
         <c:simple-property name="use-try-lock" type="long" readOnly="false" required="false" description="Any configured timeout for internal locks on the resource adapter objects in seconds"/>
         <c:simple-property name="set-tx-query-timeout" type="boolean" readOnly="false" required="false" default="false" description="Whether to set the query timeout based on the time remaining until transaction timeout, any configured query timeout will be used if there is no transaction."/>
@@ -462,8 +462,8 @@
         <c:simple-property name="exception-sorter-class-name" type="string" readOnly="false" required="false" description="An org.jboss.jca.adapters.jdbc.ExceptionSorter that provides a boolean isExceptionFatal(SQLException e) method to validate is an exception should be broadcast to all javax.resource.spi.ConnectionEventListener as a connectionErrorOccurred"/>
         <c:simple-property name="stale-connection-checker-class-name" type="string" readOnly="false" required="false" description="An org.jboss.jca.adapters.jdbc.StaleConnectionChecker that provides a boolean isStaleConnection(SQLException e) method which if it it returns true will wrap the exception in an org.jboss.jca.adapters.jdbc.StaleConnectionException"/>
         <c:simple-property name="valid-connection-checker-class-name" type="string" readOnly="false" required="false" description="An org.jboss.jca.adapters.jdbc.ValidConnectionChecker that provides a SQLException isValidConnection(Connection e) method to validate is a connection is valid. An exception means the connection is destroyed. This overrides the check-valid-connection-sql when present."/>
-        <c:simple-property name="background-validation-millis" type="long" readOnly="false" required="false" description="The background-validation-minutes element specifies the amount of time, in minutes, that background validation will run. Changing this value require a server restart."/>
-        <c:simple-property name="background-validation" type="boolean" readOnly="false" required="false" default="false" description="An element to specify that connections should be validated on a background thread versus being validated prior to use. Changing this value require a server restart."/>
+        <c:simple-property name="background-validation-millis" type="long" readOnly="false" required="false" defaultValue="600000" description="The background-validation-minutes element specifies the amount of time, in minutes, that background validation will run. Changing this value require a server restart."/>
+        <c:simple-property name="background-validation" type="boolean" readOnly="false" required="false" defaultValue="false" description="An element to specify that connections should be validated on a background thread versus being validated prior to use. Changing this value require a server restart."/>
         <c:simple-property name="use-fast-fail" type="boolean" readOnly="false" required="false" description="Whether fail a connection allocation on the first connection if it is invalid (true) or keep trying until the pool is exhausted of all potential connections (false)"/>
         <c:simple-property name="validate-on-match" type="boolean" readOnly="false" required="false" default="false" description="The validate-on-match element indicates whether or not connection level validation should be done when a connection factory attempts to match a managed connection for a given set. This is typically exclusive to the use of background validation"/>
         <c:simple-property name="spy" type="boolean" readOnly="false" required="false" defaultValue="false" description="whatever spy or not the jdbc connection"/>
@@ -515,7 +515,7 @@
           </c:property-options>
         </c:simple-property>
 
-        <c:simple-property name="prepared-statements-cacheSize" type="long" readOnly="true" required="false" description="The number of prepared statements per connection in an LRU cache"/>
+        <c:simple-property name="prepared-statements-cache-size" type="long" readOnly="true" required="false" description="The number of prepared statements per connection in an LRU cache"/>
         <c:simple-property name="share-prepared-statements" type="boolean" readOnly="true" required="false" description="Whether to share prepare statements, i.e. whether asking for same statement twice without closing uses the same underlying prepared statement"/>
         <c:simple-property name="track-statements" type="string" readOnly="true" required="false" description="Whether to check for unclosed statements when a connection is returned to the pool and result sets are closed when a statement is closed/return to the prepared statement cache. valid values are: false - do not track statements and results true - track statements and result sets and warn when they are not closed nowarn - track statements but do no warn about them being unclosed"/>
         <c:simple-property name="allocation-retry" type="integer" readOnly="true" required="false" description="The allocation retry element indicates the number of times that allocating a connection should be tried before throwing an exception."/>
@@ -570,10 +570,10 @@
         <c:simple-property name="url-selector-strategy-class-name" required="false" type="string" readOnly="true" description="A class that implements org.jboss.jca.adapters.jdbc.URLSelectorStrategy"/>
         <c:simple-property name="use-java-context" required="false" type="boolean" readOnly="true" description="Setting this to false will bind the DataSource into global JNDI;"/>
         <c:simple-property name="enabled" required="false" type="boolean" readOnly="true" description="Specifies if the datasource should be enabled"/>
-        <c:simple-property name="max-pool-size" required="false" type="integer" readOnly="false" description="The max-pool-size element indicates the maximum number of connections for a pool. No more connections will be created in each sub-pool."/>
-        <c:simple-property name="min-pool-size" required="false" type="integer" readOnly="false" description="The min-pool-size element indicates the minimum number of connections a pool should hold. These are not created until a Subject is known from a request for a connection."/>
-        <c:simple-property name="pool-prefill" required="false" type="boolean" readOnly="false" description="Whether to attempt to prefill the connection pool. Changing this value require a server restart."/>
-        <c:simple-property name="pool-use-strict-min" required="false" type="boolean" readOnly="false" description="Define if the min-pool-size should be considered a strictly."/>
+        <c:simple-property name="max-pool-size" required="false" type="integer" readOnly="false" defaultValue="20" description="The max-pool-size element indicates the maximum number of connections for a pool. No more connections will be created in each sub-pool."/>
+        <c:simple-property name="min-pool-size" required="false" type="integer" readOnly="false" defaultValue="0" description="The min-pool-size element indicates the minimum number of connections a pool should hold. These are not created until a Subject is known from a request for a connection."/>
+        <c:simple-property name="pool-prefill" required="false" type="boolean" readOnly="false" defaultValue="false" description="Whether to attempt to prefill the connection pool. Changing this value require a server restart."/>
+        <c:simple-property name="pool-use-strict-min" required="false" type="boolean" readOnly="false" defaultValue="false" description="Define if the min-pool-size should be considered a strictly."/>
         <c:simple-property name="interleaving" required="false" type="boolean" readOnly="true" description="An element to enable interleaving for XA connection factories"/>
         <c:simple-property name="no-tx-separate-pool" required="false" type="boolean" readOnly="true" description="Oracle does not like XA connections getting used both inside and outside a JTA transaction. To workaround the problem you can create separate sub-pools for the different context"/>
         <c:simple-property name="pad-xid" required="false" type="boolean" readOnly="true" description="Should the Xid be padded"/>
@@ -596,13 +596,13 @@
             <c:option value="EntirePool"/>
           </c:property-options>
         </c:simple-property>
-        <c:simple-property name="prepared-statements-cacheSize" required="false" type="long" readOnly="true" description="The number of prepared statements per connection in an LRU cache"/>
+        <c:simple-property name="prepared-statements-cache-size" required="false" type="long" readOnly="true" description="The number of prepared statements per connection in an LRU cache"/>
         <c:simple-property name="share-prepared-statements" required="false" type="boolean" readOnly="true" description="Whether to share prepare statements, i.e. whether asking for same statement twice without closing uses the same underlying prepared statement"/>
         <c:simple-property name="track-statements" required="false" type="string" readOnly="true" description="Whether to check for unclosed statements when a connection is returned to the pool and result sets are closed when a statement is closed/return to the prepared statement cache. valid values are: false - do not track statements and results true - track statements and result sets and warn when they are not closed nowarn - track statements but do no warn about them being unclosed"/>
         <c:simple-property name="allocation-retry" required="false" type="integer" readOnly="true" description="The allocation retry element indicates the number of times that allocating a connection should be tried before throwing an exception."/>
         <c:simple-property name="allocation-retry-wait-millis" required="false" type="long" readOnly="true" description="he allocation retry wait millis element indicates the time in milliseconds to wait between retrying to allocate a connection."/>
-        <c:simple-property name="blocking-timeout-wait-millis" required="false" type="long" readOnly="false" description="The blocking-timeout-millis element indicates the maximum time in milliseconds to block while waiting for a connection before throwing an exception. Note that this blocks only while waiting for a permit for a connection, and will never throw an exception if creating a new connection takes an inordinately long time."/>
-        <c:simple-property name="idle-timeout-minutes" required="false" type="long" readOnly="false" description="The idle-timeout-minutes elements indicates the maximum time in minutes a connection may be idle before being closed. The actual maximum time depends also on the IdleRemover scan time, which is 1/2 the smallest idle-timeout-minutes of any pool. Changing this value require a server restart."/>
+        <c:simple-property name="blocking-timeout-wait-millis" required="false" type="long" readOnly="false" defaultValue="30000" description="The blocking-timeout-millis element indicates the maximum time in milliseconds to block while waiting for a connection before throwing an exception. Note that this blocks only while waiting for a permit for a connection, and will never throw an exception if creating a new connection takes an inordinately long time."/>
+        <c:simple-property name="idle-timeout-minutes" required="false" type="long" readOnly="false" defaultValue="15" description="The idle-timeout-minutes elements indicates the maximum time in minutes a connection may be idle before being closed. The actual maximum time depends also on the IdleRemover scan time, which is 1/2 the smallest idle-timeout-minutes of any pool. Changing this value require a server restart."/>
         <c:simple-property name="query-timeout" required="false" type="long" readOnly="true" description="Any configured query timeout in seconds The default is no timeout"/>
         <c:simple-property name="use-try-lock" required="false" type="long" readOnly="true" description="Any configured timeout for internal locks on the resource adapter objects in seconds"/>
         <c:simple-property name="set-tx-query-timeout" required="false" type="boolean" readOnly="true" description="Whether to set the query timeout based on the time remaining until transaction timeout, any configured query timeout will be used if there is no transaction."/>
@@ -637,8 +637,8 @@
                             configuration
                         </c:map-property>
         -->
-        <c:simple-property name="background-validation-minutes" required="false" type="long" readOnly="false" description="The background-validation-minutes element specifies the amount of time, in minutes, that background validation will run. Changing this value require a server restart."/>
-        <c:simple-property name="background-validation" required="false" type="boolean" readOnly="false" description="An element to specify that connections should be validated on a background thread versus being validated prior to use. Changing this value require a server restart."/>
+        <c:simple-property name="background-validation-minutes" required="false" type="long" readOnly="false" defaultValue="10" description="The background-validation-minutes element specifies the amount of time, in minutes, that background validation will run. Changing this value require a server restart."/>
+        <c:simple-property name="background-validation" required="false" type="boolean" readOnly="false" defaultValue="false" description="An element to specify that connections should be validated on a background thread versus being validated prior to use. Changing this value require a server restart."/>
         <c:simple-property name="use-fast-fail" required="false" type="boolean" readOnly="false" description="Whether fail a connection allocation on the first connection if it is invalid (true) or keep trying until the pool is exhausted of all potential connections (false)"/>
         <c:simple-property name="validate-on-match" required="false" type="boolean" readOnly="true" description="The validate-on-match element indicates whether or not connection level validation should be done when a connection factory attempts to match a managed connection for a given set. This is typically exclusive to the use of background validation"/>
         <c:simple-property name="xa-resource-timeout" required="false" type="integer" readOnly="true" description="Passed to XAResource.setTransactionTimeout() Default is zero which does not invoke the setter. In seconds"/>
@@ -706,7 +706,7 @@
             <c:option value="EntirePool"/>
           </c:property-options>
         </c:simple-property>
-        <c:simple-property name="prepared-statements-cacheSize" required="false" type="long" readOnly="true" description="The number of prepared statements per connection in an LRU cache"/>
+        <c:simple-property name="prepared-statements-cache-size" required="false" type="long" readOnly="true" description="The number of prepared statements per connection in an LRU cache"/>
         <c:simple-property name="share-prepared-statements" required="false" type="boolean" readOnly="true" description="Whether to share prepare statements, i.e. whether asking for same statement twice without closing uses the same underlying prepared statement"/>
         <c:simple-property name="track-statements" required="false" type="string" readOnly="true" description="Whether to check for unclosed statements when a connection is returned to the pool and result sets are closed when a statement is closed/return to the prepared statement cache. valid values are: false - do not track statements and results true - track statements and result sets and warn when they are not closed nowarn - track statements but do no warn about them being unclosed"/>
         <c:simple-property name="allocation-retry" required="false" type="integer" readOnly="true" description="The allocation retry element indicates the number of times that allocating a connection should be tried before throwing an exception."/>


commit e6e91058f3ac76c6458847bd66a8ee5c9c24493e
Author: Stefan Negrea <snegrea at redhat.com>
Date:   Wed Aug 29 02:20:24 2012 -0500

    [BZ 847674] Updated all the wait methods for reload, shutdown, and restart to have the same design. All the methods now take into account possible exceptions for the test operation sent to the application server.

diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java
index 27b1133..98a46d2 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java
@@ -241,25 +241,36 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend
         return startServer();
     }
 
-    protected boolean waitUntilDown(OperationResult tmp) throws InterruptedException {
+    protected boolean waitUntilDown() throws InterruptedException {
         boolean down=false;
         int count=0;
+
         while (!down) {
             Operation op = new ReadAttribute(new Address(),"release-version");
-            Result res = getASConnection().execute(op);
-            if (!res.isSuccess()) { // If op succeeds, server is not down
-                down=true;
-            } else if (count > 20) {
-                tmp.setErrorMessage("Was not able to shut down the server");
-                return true;
+
+            try{
+                Result res = getASConnection().execute(op);
+                if (!res.isSuccess()) { // If op succeeds, server is not down
+                    down = true;
+                } else if (count > 20) {
+                    break;
+                }
+            } catch (Exception e) {
+                down = true;
             }
+
             if (!down) {
-                Thread.sleep(1000); // Wait 1s
+                try {
+                    Thread.sleep(1000); // Wait 1s
+                } catch (InterruptedException e) {
+                    // ignore
+                }
             }
             count++;
         }
-        log.debug("waitUntilDown: Used " + count + " delay round(s) to shut down");
-        return false;
+
+        log.debug("waitUntilDown: Used " + count + " delay round(s) to shut down. Server down=" + down);
+        return down;
     }
 
     /**
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HostControllerComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HostControllerComponent.java
index 565add2..7ea12b9 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HostControllerComponent.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HostControllerComponent.java
@@ -92,8 +92,11 @@ public class HostControllerComponent<T extends ResourceComponent<?>> extends Bas
             Result res = getASConnection().execute(op);
             operationResult = postProcessResult(name, res);
 
-            waitUntilDown(operationResult);
-
+            if (waitUntilDown()) {
+                operationResult.setSimpleResult("Success");
+            } else {
+                operationResult.setErrorMessage("Was not able to shut down the server.");
+            }
         } else if (name.equals("installRhqUser")) {
             operationResult = installManagementUser(parameters, pluginConfiguration);
         } else {
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/StandaloneASComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/StandaloneASComponent.java
index 573742e..778d127 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/StandaloneASComponent.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/StandaloneASComponent.java
@@ -163,39 +163,59 @@ public class StandaloneASComponent<T extends ResourceComponent<?>> extends BaseS
 
         OperationResult operationResult = postProcessResult(name, res);
 
-        if (name.equals("shutdown"))
-            waitUntilDown(operationResult);
+        if (name.equals("shutdown")) {
+            if (waitUntilDown()) {
+                operationResult.setSimpleResult("Success");
+            } else {
+                operationResult.setErrorMessage("Was not able to shut down the server.");
+            }
+        }
 
-        if (name.equals("reload"))
-            waitUntilReloaded(operationResult);
+        if (name.equals("reload")) {
+            if (waitUntilReloaded()) {
+                operationResult.setSimpleResult("Success");
+            } else {
+                operationResult.setErrorMessage("Was not able to reload the server.");
+            }
+        }
 
         context.getAvailabilityContext().requestAvailabilityCheck();
 
         return operationResult;
     }
 
-    private void waitUntilReloaded(OperationResult operationResult) {
+    private boolean waitUntilReloaded() {
         boolean reloaded = false;
         int count = 0;
+
         while (!reloaded) {
-            try {
-                Thread.sleep(2000); // Wait 2s
-            } catch (InterruptedException e) {
-                // Ignore
+            Operation op = new ReadAttribute(new Address(), "release-version");
+            try{
+                Result res = getASConnection().execute(op);
+                if (res.isSuccess() && !res.isReloadRequired()) {
+                    reloaded = true;
+                } else if (count > 20) {
+                    break;
+                }
+            } catch (Exception e) {
+                //do absolutely nothing
+                //if an exception is thrown that means the server is still reloading, so consider this
+                //a single failed attempt, equivalent to res.isSuccess == false
             }
 
-            Operation op = new ReadAttribute(new Address(), "release-version");
-            Result res = getASConnection().execute(op);
-            if (res.isSuccess() && !res.isReloadRequired()) {
-                reloaded = true;
-            } else if (count > 20) {
-                operationResult.setErrorMessage("Was not able to reload the server");
-                return;
+            if (!reloaded) {
+                try {
+                    Thread.sleep(1000); // Wait 1s
+                } catch (InterruptedException e) {
+                    // ignore
+                }
             }
             count++;
         }
-        log.debug("waitUntilReloaded: Used " + count + " delay round(s) to reload");
-        return;
+
+        log.debug("waitUntilReloaded: Used " + count + " delay round(s) to reload. Reload=" + reloaded);
+
+        return reloaded;
     }
 
     @Override


commit 96602db100b087e36016b1aa6a2e39780b583898
Author: Stefan Negrea <snegrea at redhat.com>
Date:   Tue Aug 28 23:33:45 2012 -0500

    [BZ 852552] Adding special validation for the transaction subsystem.
    
    The special case for this subsystem:
    
    If [process-id-uuid] == true then do not send updates for [process-id-socket-binding], this property will be undefined by the AS7 on the next reload/restart
    
    If [process-id-uuid] == false then allow AS7 to perform property validation * If [process-id-uuid] == false then send [process-id-socket-binding] value and allow AS7 to perform property validation

diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/TransactionsComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/TransactionsComponent.java
new file mode 100644
index 0000000..102118b
--- /dev/null
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/TransactionsComponent.java
@@ -0,0 +1,62 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.modules.plugins.jbossas7;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
+import org.rhq.core.pluginapi.inventory.ResourceComponent;
+
+/**
+ * Support for transactions subsystem configuration updates.
+ *
+ * The special case for this subsystem:
+ *
+ * If [process-id-uuid] == true then do not send updates for [process-id-socket-binding], this property
+ * will be undefined by the AS7 on the next server reload/restart
+ *
+ * If [process-id-uuid] == false then send [process-id-socket-binding] value and
+ * allow AS7 to perform property validation
+ *
+ *
+ * @author Stefan Negrea
+ */
+public class TransactionsComponent extends BaseComponent<ResourceComponent<?>> {
+
+    @Override
+    public void updateResourceConfiguration(ConfigurationUpdateReport report) {
+        Configuration config = report.getConfiguration();
+        ConfigurationDefinition configDef = context.getResourceType().getResourceConfigurationDefinition();
+
+        boolean processIdUuid = Boolean.valueOf(config.getSimpleValue("process-id-uuid"));
+        if (processIdUuid == true) {
+            //Do not even send the updates for [process-id-socket-binding] because the AS7 will
+            //undefine it during the next reload/restart.
+            //Also, sending null for [process-id-socket-binding] with [process-id-uuid] == true causes
+            //a validation error on the server.
+            configDef.getPropertyDefinitions().remove("process-id-socket-binding");
+            config.remove("process-id-socket-binding");
+        }
+
+        ConfigurationWriteDelegate delegate = new ConfigurationWriteDelegate(configDef, getASConnection(), address);
+        delegate.updateResourceConfiguration(report);
+    }
+}
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 0f150a4..29ef057 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
@@ -8338,7 +8338,7 @@
 
   <service name="Transactions Subsystem (Standalone)"
            discovery="SubsystemDiscovery"
-           class="BaseComponent"
+           class="TransactionsComponent"
            singleton="true"
            description="The transactions subsystem.">
 
@@ -8460,7 +8460,7 @@
 
   <service name="Transactions Subsystem (Profile)"
            discovery="SubsystemDiscovery"
-           class="BaseComponent"
+           class="TransactionsComponent"
            singleton="true"
            description="The transactions subsystem.">
 
@@ -8516,7 +8516,7 @@
 
   <service name="Transactions Subsystem (Managed)"
            discovery="SubsystemDiscovery"
-           class="BaseComponent"
+           class="TransactionsComponent"
            singleton="true"
            description="The transactions subsystem.">
 


commit b8d890aaf85b9d3f74eb60d1bad32af02d030759
Author: Stefan Negrea <snegrea at redhat.com>
Date:   Tue Aug 28 23:01:08 2012 -0500

    [BZ 852552] Add two resource types to the list of ignored resources for this integration test. Both of these resources have special requirements with regards to configuration updates.

diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/ResourcesStandaloneServerTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/ResourcesStandaloneServerTest.java
index aad8739..824162a 100644
--- a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/ResourcesStandaloneServerTest.java
+++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/ResourcesStandaloneServerTest.java
@@ -86,6 +86,9 @@ public class ResourcesStandaloneServerTest extends AbstractJBossAS7PluginTest  {
         //will revisit after BZ 826542 is resolved
         //        ignoredResources.add("Authentication (Classic)");
 
+        ignoredResources.add("Memory Pool");
+        ignoredResources.add("Periodic Rotating File Handler");
+
         Resource platform = this.pluginContainer.getInventoryManager().getPlatform();
         Resource server = getResourceByTypeAndKey(platform, StandaloneServerComponentTest.RESOURCE_TYPE,
             StandaloneServerComponentTest.RESOURCE_KEY);


commit a31197fcd63548c6e49606525b9938c123e5ffb2
Author: Stefan Negrea <snegrea at redhat.com>
Date:   Tue Aug 28 22:59:02 2012 -0500

    [BZ 852552] Update socket binding group to not send at all port-offset for non-standalone servers.
    
    Just setting port-offset to null was not enough since now all the unset properties are sent to the AS7 server. The property and property definition are now removed from updates sent host controllers.

diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SocketBindingGroupComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SocketBindingGroupComponent.java
index 00d28ca..573db2e 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SocketBindingGroupComponent.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SocketBindingGroupComponent.java
@@ -2,6 +2,7 @@ package org.rhq.modules.plugins.jbossas7;
 
 import org.rhq.core.domain.configuration.Configuration;
 import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
 import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
 import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
 
@@ -29,12 +30,14 @@ public class SocketBindingGroupComponent extends BaseComponent implements Config
     public void updateResourceConfiguration(ConfigurationUpdateReport report) {
 
         Configuration config = report.getConfiguration();
+        ConfigurationDefinition configDef = context.getResourceType().getResourceConfigurationDefinition();
+
         if (!(context.getParentResourceComponent() instanceof StandaloneASComponent)) { // TODO what about managed servers
-            config.put(new PropertySimple("port-offset",null));
+            configDef.getPropertyDefinitions().remove("port-offset");
+            config.remove("port-offset");
         }
 
-        super.updateResourceConfiguration(report);
-
-
+        ConfigurationWriteDelegate delegate = new ConfigurationWriteDelegate(configDef, getASConnection(), address);
+        delegate.updateResourceConfiguration(report);
     }
 }


commit 91aaaf71e585022ca85f62e371a7d63ae554ff6d
Author: Stefan Negrea <snegrea at redhat.com>
Date:   Tue Aug 28 22:55:05 2012 -0500

    [BZ 852552] Create a separate distributed cache definition because this resource contains addtional properties not available for invalidation and replicate caches.
    
    The diferrence between these caches was obvious only after the updates to always send unset properties. All these extra properties (which are null) were sent to the server causing failures for caches that do not have them in their definition.

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 81ddfe9..0f150a4 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
@@ -2002,7 +2002,7 @@
                  class="TemplatedComponent">
 
           <plugin-configuration>
-            <c:simple-property name="path" readOnly="true" default="distributed-cache|invalidation-cache|replicated-cache"/>
+            <c:simple-property name="path" readOnly="true" default="invalidation-cache|replicated-cache"/>
           </plugin-configuration>
 
           <resource-configuration>
@@ -2031,30 +2031,64 @@
             <c:simple-property name="queue-flush-interval" required="false" type="long" readOnly="true" default="10" description="In ASYNC mode, this attribute controls how often the asynchronous thread used to flush the replication queue runs. This should be a positive integer which represents thread wakeup time in milliseconds."/>
             <c:simple-property name="remote-timeout" required="false" type="long" readOnly="true" default="17500" description="In SYNC mode, the timeout (in ms) used to wait for an acknowledgment when making a remote call, after which the call is aborted and an exception is thrown."/>
             <c:simple-property name="async-marshalling" required="false" type="boolean" readOnly="true" defaultValue="false" description="If enabled, this will cause marshalling of entries to be performed asynchronously. The default value is false."/>
-            <c:simple-property name="l1-lifespan" required="false" type="long" readOnly="true" defaultValue="600000" description="Maximum lifespan of an entry placed in the L1 cache. This element configures the L1 cache behavior in &apos;distributed&apos; caches instances. In any other cache modes, this element is ignored. The default value is 600000."/>
             <c:simple-property name="module" required="false" type="string" readOnly="true" description="The module whose class loader should be used when building this cache&apos;s configuration."/>
-            <c:simple-property name="owners" required="false" type="integer" readOnly="true" defaultValue="2" description="Number of cluster&#45;wide replicas for each cache entry. The default value is 2."/>
-            <c:simple-property name="virtual-nodes" required="false" type="integer" readOnly="true" defaultValue="1" description="Controls the number of virtual nodes per &apos;real&apos; node. If numVirtualNodes is 1, then virtual nodes are disabled. The topology aware consistent hash must be used if you wish to take advantage of virtual nodes. A default of 1 is used. The default value is 1."/>
 
-            <c:simple-property name="__type" displayName="Type of cache" required="true" readOnly="true" default="local-cache" description="Type of cache">
+            <c:simple-property name="__type" displayName="Type of cache" required="true" readOnly="true" default="invalidation-cache" description="Type of cache">
               <c:property-options>
                 <c:option value="invalidation-cache"/>
-                <c:option value="distributed-cache"/>
                 <c:option value="replicated-cache"/>
               </c:property-options>
             </c:simple-property>
             <c:template name="Invalidation Cache" description="Invalidation Cache">
               <c:simple-property name="__type" readOnly="true" default="invalidation-cache"/>
             </c:template>
-            <c:template name="Distributed Cache" description="Distributed Cache">
-              <c:simple-property name="__type" readOnly="true" default="distributed-cache"/>
-            </c:template>
             <c:template name="Replicated Cache" description="Replicated Cache">
               <c:simple-property name="__type" readOnly="true" default="replicated-cache"/>
             </c:template>
           </resource-configuration>
         </service>
 
+        <service name="Distributed Cache (Managed Server)"
+                 discovery="SubsystemDiscovery"
+                 class="BaseComponent">
+
+          <plugin-configuration>
+            <c:simple-property name="path" readOnly="true" default="distributed-cache"/>
+          </plugin-configuration>
+
+          <resource-configuration>
+            <c:simple-property name="start" required="false" type="string" readOnly="true" default="LAZY" description="The cache start mode, which can be EAGER (immediate start) or LAZY (on-demand start).">
+              <c:property-options>
+                <c:option value="LAZY"/>
+                <c:option value="EAGER"/>
+              </c:property-options>
+            </c:simple-property>
+            <c:simple-property name="batching" required="false" type="boolean" readOnly="true" default="false" description="If enabled, the invocation batching API will be made available for this cache."/>
+            <c:simple-property name="indexing" required="false" type="string" readOnly="true" default="NONE" description="If enabled, entries will be indexed when they are added to the cache. Indexes will be updated as entries change or are removed.">
+              <c:property-options>
+                <c:option value="NONE"/>
+                <c:option value="LOCAL"/>
+                <c:option value="ALL"/>
+              </c:property-options>
+            </c:simple-property>
+            <c:simple-property name="jndi-name" required="false" type="string" readOnly="true" description="The jndi-name to which to bind this cache instance."/>
+            <c:simple-property name="mode" required="false" type="string" readOnly="true" default="SYNC" description="Sets the clustered cache mode, ASYNC for asynchronous operation, or SYNC for synchronous operation.">
+              <c:property-options>
+                <c:option value="SYNC"/>
+                <c:option value="ASYNC"/>
+              </c:property-options>
+            </c:simple-property>
+            <c:simple-property name="queue-size" required="false" type="integer" readOnly="true" default="0" description="In ASYNC mode, this attribute can be used to trigger flushing of the queue when it reaches a specific threshold."/>
+            <c:simple-property name="queue-flush-interval" required="false" type="long" readOnly="true" default="10" description="In ASYNC mode, this attribute controls how often the asynchronous thread used to flush the replication queue runs. This should be a positive integer which represents thread wakeup time in milliseconds."/>
+            <c:simple-property name="remote-timeout" required="false" type="long" readOnly="true" default="17500" description="In SYNC mode, the timeout (in ms) used to wait for an acknowledgment when making a remote call, after which the call is aborted and an exception is thrown."/>
+            <c:simple-property name="async-marshalling" required="false" type="boolean" readOnly="true" defaultValue="false" description="If enabled, this will cause marshalling of entries to be performed asynchronously. The default value is false."/>
+            <c:simple-property name="l1-lifespan" required="false" type="long" readOnly="true" defaultValue="600000" description="Maximum lifespan of an entry placed in the L1 cache. This element configures the L1 cache behavior in &apos;distributed&apos; caches instances. In any other cache modes, this element is ignored. The default value is 600000."/>
+            <c:simple-property name="module" required="false" type="string" readOnly="true" description="The module whose class loader should be used when building this cache&apos;s configuration."/>
+            <c:simple-property name="owners" required="false" type="integer" readOnly="true" defaultValue="2" description="Number of cluster&#45;wide replicas for each cache entry. The default value is 2."/>
+            <c:simple-property name="virtual-nodes" required="false" type="integer" readOnly="true" defaultValue="1" description="Controls the number of virtual nodes per &apos;real&apos; node. If numVirtualNodes is 1, then virtual nodes are disabled. The topology aware consistent hash must be used if you wish to take advantage of virtual nodes. A default of 1 is used. The default value is 1."/>
+          </resource-configuration>
+        </service>
+
         <service name="Local Cache (Managed Server)"
                  discovery="SubsystemDiscovery"
                  class="BaseComponent"
@@ -11331,7 +11365,7 @@
                creationDataType="configuration">
 
         <plugin-configuration>
-          <c:simple-property name="path" readOnly="true" default="distributed-cache|invalidation-cache|replicated-cache"/>
+          <c:simple-property name="path" readOnly="true" default="invalidation-cache|replicated-cache"/>
         </plugin-configuration>
 
         <resource-configuration>
@@ -11360,30 +11394,66 @@
           <c:simple-property name="queue-flush-interval" required="false" type="long" readOnly="false" default="10" description="In ASYNC mode, this attribute controls how often the asynchronous thread used to flush the replication queue runs. This should be a positive integer which represents thread wakeup time in milliseconds."/>
           <c:simple-property name="remote-timeout" required="false" type="long" readOnly="false" default="17500" description="In SYNC mode, the timeout (in ms) used to wait for an acknowledgment when making a remote call, after which the call is aborted and an exception is thrown."/>
           <c:simple-property name="async-marshalling" required="false" type="boolean" readOnly="false" defaultValue="false" description="If enabled, this will cause marshalling of entries to be performed asynchronously. The default value is false."/>
-          <c:simple-property name="l1-lifespan" required="false" type="long" readOnly="false" defaultValue="600000" description="Maximum lifespan of an entry placed in the L1 cache. This element configures the L1 cache behavior in &apos;distributed&apos; caches instances. In any other cache modes, this element is ignored. The default value is 600000."/>
           <c:simple-property name="module" required="false" type="string" readOnly="false" description="The module whose class loader should be used when building this cache&apos;s configuration."/>
-          <c:simple-property name="owners" required="false" type="integer" readOnly="false" defaultValue="2" description="Number of cluster&#45;wide replicas for each cache entry. The default value is 2."/>
-          <c:simple-property name="virtual-nodes" required="false" type="integer" readOnly="false" defaultValue="1" description="Controls the number of virtual nodes per &apos;real&apos; node. If numVirtualNodes is 1, then virtual nodes are disabled. The topology aware consistent hash must be used if you wish to take advantage of virtual nodes. A default of 1 is used. The default value is 1."/>
 
-          <c:simple-property name="__type" displayName="Type of cache" required="true" readOnly="true" default="local-cache" description="Type of cache">
+          <c:simple-property name="__type" displayName="Type of cache" required="true" readOnly="true" default="invalidation-cache" description="Type of cache">
             <c:property-options>
               <c:option value="invalidation-cache"/>
-              <c:option value="distributed-cache"/>
               <c:option value="replicated-cache"/>
             </c:property-options>
           </c:simple-property>
           <c:template name="Invalidation Cache" description="Invalidation Cache">
             <c:simple-property name="__type" readOnly="true" default="invalidation-cache"/>
           </c:template>
-          <c:template name="Distributed Cache" description="Distributed Cache">
-            <c:simple-property name="__type" readOnly="true" default="distributed-cache"/>
-          </c:template>
           <c:template name="Replicated Cache" description="Replicated Cache">
             <c:simple-property name="__type" readOnly="true" default="replicated-cache"/>
           </c:template>
         </resource-configuration>
       </service>
 
+      <service name="Distributed Cache"
+               discovery="SubsystemDiscovery"
+               class="BaseComponent"
+               createDeletePolicy="both"
+               creationDataType="configuration">
+
+        <plugin-configuration>
+          <c:simple-property name="path" readOnly="true" default="distributed-cache"/>
+        </plugin-configuration>
+
+        <resource-configuration>
+          <c:simple-property name="start" required="false" type="string" readOnly="false" default="LAZY" description="The cache start mode, which can be EAGER (immediate start) or LAZY (on-demand start).">
+            <c:property-options>
+              <c:option value="LAZY"/>
+              <c:option value="EAGER"/>
+            </c:property-options>
+          </c:simple-property>
+          <c:simple-property name="batching" required="false" type="boolean" readOnly="false" default="false" description="If enabled, the invocation batching API will be made available for this cache."/>
+          <c:simple-property name="indexing" required="false" type="string" readOnly="false" default="NONE" description="If enabled, entries will be indexed when they are added to the cache. Indexes will be updated as entries change or are removed.">
+            <c:property-options>
+              <c:option value="NONE"/>
+              <c:option value="LOCAL"/>
+              <c:option value="ALL"/>
+            </c:property-options>
+          </c:simple-property>
+          <c:simple-property name="jndi-name" required="false" type="string" readOnly="false" description="The jndi-name to which to bind this cache instance."/>
+          <c:simple-property name="mode" required="true" type="string" readOnly="false" default="SYNC" defaultValue="SYNC" description="Sets the clustered cache mode, ASYNC for asynchronous operation, or SYNC for synchronous operation.">
+            <c:property-options>
+              <c:option value="SYNC"/>
+              <c:option value="ASYNC"/>
+            </c:property-options>
+          </c:simple-property>
+          <c:simple-property name="queue-size" required="false" type="integer" readOnly="false" default="0" description="In ASYNC mode, this attribute can be used to trigger flushing of the queue when it reaches a specific threshold."/>
+          <c:simple-property name="queue-flush-interval" required="false" type="long" readOnly="false" default="10" description="In ASYNC mode, this attribute controls how often the asynchronous thread used to flush the replication queue runs. This should be a positive integer which represents thread wakeup time in milliseconds."/>
+          <c:simple-property name="remote-timeout" required="false" type="long" readOnly="false" default="17500" description="In SYNC mode, the timeout (in ms) used to wait for an acknowledgment when making a remote call, after which the call is aborted and an exception is thrown."/>
+          <c:simple-property name="async-marshalling" required="false" type="boolean" readOnly="false" defaultValue="false" description="If enabled, this will cause marshalling of entries to be performed asynchronously. The default value is false."/>
+          <c:simple-property name="l1-lifespan" required="false" type="long" readOnly="false" defaultValue="600000" description="Maximum lifespan of an entry placed in the L1 cache. This element configures the L1 cache behavior in &apos;distributed&apos; caches instances. In any other cache modes, this element is ignored. The default value is 600000."/>
+          <c:simple-property name="module" required="false" type="string" readOnly="false" description="The module whose class loader should be used when building this cache&apos;s configuration."/>
+          <c:simple-property name="owners" required="false" type="integer" readOnly="false" defaultValue="2" description="Number of cluster&#45;wide replicas for each cache entry. The default value is 2."/>
+          <c:simple-property name="virtual-nodes" required="false" type="integer" readOnly="false" defaultValue="1" description="Controls the number of virtual nodes per &apos;real&apos; node. If numVirtualNodes is 1, then virtual nodes are disabled. The topology aware consistent hash must be used if you wish to take advantage of virtual nodes. A default of 1 is used. The default value is 1."/>
+        </resource-configuration>
+      </service>
+
       <service name="Local Cache"
                discovery="SubsystemDiscovery"
                class="BaseComponent"


commit 9320bfa050c332a5f89334fcf5606395e5ef9098
Author: Stefan Negrea <snegrea at redhat.com>
Date:   Tue Aug 28 22:46:02 2012 -0500

    [BZ 852552] Update mod-cluster property name to load-balancing-group. The "domain" alias no longer works for load-balancing-group causing configuration updates to fail with unknown domain property.

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 bef06ec..81ddfe9 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
@@ -168,7 +168,7 @@
             <c:simple-property name="connector" required="true" type="string" readOnly="false" defaultValue="ajp" description="Name of the web connector used to communicate with the load balancer.">
               <c:option-source target="resource" expression="type=Connector plugin=&pluginName;"/>
             </c:simple-property>
-            <c:simple-property name="domain" required="false" type="string" readOnly="false" description="loadBalancingGroup name."/>
+            <c:simple-property name="load-balancing-group" required="false" type="string" readOnly="false" description="loadBalancingGroup name."/>
           </c:group>
 
           <c:group name="context" displayName="Web Context Options">


commit 9f82d413e980967ea3fae7ffe2579c44cc29cbb7
Author: Stefan Negrea <snegrea at redhat.com>
Date:   Tue Aug 28 22:44:05 2012 -0500

    [BZ 852552] Removing properties from the Transport subresource because the resource definition no longer contains them.
    
    Because unset properties are now always sent to the AS7 server, all these removed Transport properties were sent to the AS7 causing an unknown property failure.

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 6f13412..bef06ec 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
@@ -2099,9 +2099,6 @@
             <c:simple-property name="cluster" required="false" type="string" readOnly="true" description="The name of the group communication cluster"/>
             <c:simple-property name="executor" required="false" type="string" readOnly="true" description="The executor to use for the transport"/>
             <c:simple-property name="lock-timeout" required="false" type="long" readOnly="true" defaultValue="240000" description="The timeout for locks for the transport. The default value is 240000."/>
-            <c:simple-property name="machine" required="false" type="string" readOnly="true" description="A machine identifier for the transport"/>
-            <c:simple-property name="rack" required="false" type="string" readOnly="true" description="A rack identifier for the transport"/>
-            <c:simple-property name="site" required="false" type="string" readOnly="true" description="A site identifier for the transport"/>
             <c:simple-property name="stack" required="false" type="string" readOnly="true" description="The jgroups stack to use for the transport"/>
           </resource-configuration>
         </service>
@@ -11431,9 +11428,6 @@
           <c:simple-property name="cluster" required="false" type="string" readOnly="false" description="The name of the group communication cluster"/>
           <c:simple-property name="executor" required="false" type="string" readOnly="false" description="The executor to use for the transport"/>
           <c:simple-property name="lock-timeout" required="false" type="long" readOnly="false" defaultValue="240000" description="The timeout for locks for the transport. The default value is 240000."/>
-          <c:simple-property name="machine" required="false" type="string" readOnly="false" description="A machine identifier for the transport"/>
-          <c:simple-property name="rack" required="false" type="string" readOnly="false" description="A rack identifier for the transport"/>
-          <c:simple-property name="site" required="false" type="string" readOnly="false" description="A site identifier for the transport"/>
           <c:simple-property name="stack" required="false" type="string" readOnly="false" description="The jgroups stack to use for the transport"/>
         </resource-configuration>
       </service>


commit c1655d4d576311b9034a31b505e75981b1d6e720
Author: Stefan Negrea <snegrea at redhat.com>
Date:   Tue Aug 28 22:39:35 2012 -0500

    [BZ 852552] Send unset properties to AS7 as null.
    
    Existing code was not sending updates for unset properties at all to AS7 making it impossible to unset (or set to empty) a property after it was set to something not null.

diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ConfigurationWriteDelegate.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ConfigurationWriteDelegate.java
index aad2105..f73ccf5 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ConfigurationWriteDelegate.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ConfigurationWriteDelegate.java
@@ -431,16 +431,25 @@ public class ConfigurationWriteDelegate implements ConfigurationFacet {
     private void createWriteAttributePropertySimple(CompositeOperation cop, PropertySimple property,
         PropertyDefinitionSimple propertyDefinition, Address address) {
 
-        // If the property value is null and the property is optional, skip too
-        if (property.getStringValue() == null && !propertyDefinition.isRequired())
-            return;
-
         if (property.getName().endsWith(":ignore")) // Caller takes care
             return;
 
         if (propertyDefinition.isReadOnly() && !createChildRequested)
             return;
 
+        //If the property value is null and the property is optional,
+        //then send default value or null to the server
+        if (property.getStringValue() == null && !propertyDefinition.isRequired()) {
+            String name = property.getName();
+            if (name.indexOf(':') != -1) {
+                name = name.substring(0, name.indexOf(":"));
+            }
+
+            Operation writeAttribute = new WriteAttribute(address, name, null);
+            cop.addStep(writeAttribute);
+            return;
+        }
+
         SimpleEntry<String, Object> entry = this.preparePropertySimple(property, propertyDefinition);
         Operation writeAttribute = new WriteAttribute(address, entry.getKey(), entry.getValue());
         cop.addStep(writeAttribute);
diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/ConfigurationUpdatingTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/ConfigurationUpdatingTest.java
index 21e3d5f..48b6783 100644
--- a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/ConfigurationUpdatingTest.java
+++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/ConfigurationUpdatingTest.java
@@ -59,7 +59,6 @@ public class ConfigurationUpdatingTest extends AbstractConfigurationHandlingTest
     public void test1() throws Exception {
 
         ConfigurationDefinition definition = loadDescriptor("simple1");
-
         FakeConnection connection = new FakeConnection();
 
         ConfigurationWriteDelegate delegate = new ConfigurationWriteDelegate(definition, connection, null);
@@ -70,12 +69,22 @@ public class ConfigurationUpdatingTest extends AbstractConfigurationHandlingTest
 
         CompositeOperation cop = delegate.updateGenerateOperationFromProperties(conf, new Address());
 
-        assert cop.numberOfSteps() == 1;
-        Operation step1 = cop.step(0);
-        assert step1.getOperation().equals("write-attribute");
-        Map<String, Object> props = step1.getAdditionalProperties();
-        assert props.size() == 2;
+        Assert.assertEquals(cop.numberOfSteps(), 2);
 
+        for (int i = 0; i < cop.numberOfSteps(); i++) {
+            Operation step = cop.step(0);
+            Assert.assertEquals(step.getOperation(), "write-attribute");
+            Map<String, Object> stepProps = step.getAdditionalProperties();
+            Assert.assertEquals(stepProps.size(), 2);
+
+            if (stepProps.get("name").equals("needed")) {
+                Assert.assertEquals(stepProps.get("value"), "test");
+            } else if (stepProps.get("name").equals("optional")) {
+                Assert.assertEquals(stepProps.get("value"), null);
+            } else {
+                Assert.fail("Unexepected property found!");
+            }
+        }
     }
 
     public void test2() throws Exception {


commit e1d2190442ddcfe023696fa59b040f78929a27c6
Author: Stefan Negrea <snegrea at redhat.com>
Date:   Tue Aug 28 20:14:08 2012 -0500

    [BZ 846400] Add validation for components that rely connectors and discovery group name. A compoment should have either the connector or discovery group configured, but not both.
    
    This validation is handled by the AS7 server itself for new resource creation but the validation is missing for configuration updates. Without this validation code in place, the AS7 server accepts the commands, persists the configuration, but fails to reload or restart rendering the server unusable until the configuration file is manually edited. With this fix, the AS7 plugin will not send the configuration updates to the AS7 server unless they meet the descriptor requirements.

diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ConnectorDiscoveryGroupValidatorComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ConnectorDiscoveryGroupValidatorComponent.java
new file mode 100644
index 0000000..fab342f
--- /dev/null
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ConnectorDiscoveryGroupValidatorComponent.java
@@ -0,0 +1,83 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.modules.plugins.jbossas7;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
+import org.rhq.core.domain.configuration.PropertyList;
+import org.rhq.core.domain.configuration.PropertyMap;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
+import org.rhq.core.pluginapi.inventory.ResourceComponent;
+
+/**
+ * @author Stefan Negrea
+ *
+ */
+public class ConnectorDiscoveryGroupValidatorComponent extends BaseComponent<ResourceComponent<?>> {
+
+    @Override
+    public void updateResourceConfiguration(ConfigurationUpdateReport report) {
+        Configuration resourceConfiguration = report.getConfiguration();
+        ResourceType resourceType = this.context.getResourceType();
+
+        // we need to check that a connector XOR a discovery-group-name is given
+        int configuredItemsFound = 0;
+        String errorMessage = "";
+
+        if (resourceType.getName().equals("Connection Factory")
+            || resourceType.getName().equals("Pooled Connection Factory")) {
+
+            PropertyMap connector = resourceConfiguration.getMap("connector:collapsed");
+            if (connector != null) {
+                String name = connector.getSimpleValue("name:0", "");
+                if (!name.isEmpty()) {
+                    configuredItemsFound++;
+                }
+            }
+
+            errorMessage = "You need to provide either a connector name OR a discovery-group-name. ";
+        } else if (resourceType.getName().equals("Bridge") || resourceType.getName().equals("Cluster Connection")) {
+
+            PropertyList staticConnectors = resourceConfiguration.getList("static-connectors:nullable");
+            if (staticConnectors != null) {
+                if (!staticConnectors.getList().isEmpty()) {
+                    configuredItemsFound++;
+                }
+            }
+
+            errorMessage = "You need to provide either static connectors name OR a discovery-group-name. ";
+        }
+
+        String discoveryGroup = resourceConfiguration.getSimpleValue("discovery-group-name", "");
+        if (!discoveryGroup.isEmpty()) {
+            configuredItemsFound++;
+        }
+
+        if (configuredItemsFound != 1) {
+            errorMessage += (configuredItemsFound == 0) ? "You provided none." : "You provided both.";
+            report.setErrorMessage(errorMessage);
+            report.setStatus(ConfigurationUpdateStatus.FAILURE);
+        } else {
+            super.updateResourceConfiguration(report);
+        }
+    }
+}
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HornetQComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HornetQComponent.java
index dad90bc..cd791fa 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HornetQComponent.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HornetQComponent.java
@@ -21,9 +21,7 @@ package org.rhq.modules.plugins.jbossas7;
 
 import org.rhq.core.domain.configuration.Configuration;
 import org.rhq.core.domain.configuration.PropertyList;
-import org.rhq.core.domain.configuration.PropertyMap;
 import org.rhq.core.domain.resource.CreateResourceStatus;
-import org.rhq.core.domain.resource.ResourceType;
 import org.rhq.core.pluginapi.inventory.CreateResourceReport;
 
 /**
@@ -43,31 +41,6 @@ public class HornetQComponent extends TemplatedSubResourcesComponent {
             return report;
         }
 
-        ResourceType resourceType = report.getResourceType();
-        if (resourceType.getName().equals("Connection-Factory")) {
-            // we need to check that a connector XOR a discovery-group-name is given
-            int found = 0;
-            PropertyMap connector = resourceConfiguration.getMap("connector:collapsed");
-
-            if (connector != null) {
-
-                String name = connector.getSimpleValue("name:0", "");
-                if (!name.isEmpty())
-                    found++;
-            }
-            String discoveryGroup = resourceConfiguration.getSimpleValue("discovery-group-name", "");
-            if (!discoveryGroup.isEmpty())
-                found++;
-
-            if (found == 0 || found == 2) {
-                String errorMessage = "You need to provide either a connector name OR a discovery-group-name. You provided ";
-                errorMessage += (found == 0) ? "none" : "both";
-                report.setErrorMessage(errorMessage);
-                report.setStatus(CreateResourceStatus.FAILURE);
-                return report;
-            }
-        }
-
         report = super.createResource(report);
         return report;
     }
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/JmsComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/JmsComponent.java
index 8b6eb12..1ede55e 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/JmsComponent.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/JmsComponent.java
@@ -21,16 +21,13 @@ package org.rhq.modules.plugins.jbossas7;
 import org.rhq.core.domain.configuration.Configuration;
 import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
 import org.rhq.core.domain.configuration.PropertyList;
-import org.rhq.core.domain.configuration.PropertyMap;
-import org.rhq.core.domain.resource.CreateResourceStatus;
-import org.rhq.core.domain.resource.ResourceType;
 import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
 
 /**
  * Component class for the JMS subsystem
  * @author Heiko W. Rupp
  */
-public class JmsComponent extends BaseComponent {
+public class JmsComponent extends ConnectorDiscoveryGroupValidatorComponent {
 
     @Override
     public void updateResourceConfiguration(ConfigurationUpdateReport report) {
@@ -43,31 +40,8 @@ public class JmsComponent extends BaseComponent {
             return;
         }
 
-        ResourceType resourceType = context.getResourceType();
-        if (resourceType.getName().equals("Connection-Factory")) {
-            // we need to check that a connector XOR a discovery-group-name is given
-            int found = 0;
-            PropertyMap connector = resourceConfiguration.getMap("connector:collapsed");
-
-            if (connector != null) {
-
-                String name = connector.getSimpleValue("name:0", "");
-                if (!name.isEmpty())
-                    found++;
-            }
-            String discoveryGroup = resourceConfiguration.getSimpleValue("discovery-group-name", "");
-            if (!discoveryGroup.isEmpty())
-                found++;
-
-            if (found == 0 || found == 2) {
-                String errorMessage = "You need to provide either a connector name OR a discovery-group-name. You provided ";
-                errorMessage += (found == 0) ? "none" : "both";
-                report.setErrorMessage(errorMessage);
-                report.setStatus(ConfigurationUpdateStatus.FAILURE);
-                return;
-            }
-        }
-
+        //defer the rest of the validation for connector and discovery group name to
+        //the base class
         super.updateResourceConfiguration(report);
     }
 }
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 8143d04..6f13412 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
@@ -4654,7 +4654,7 @@
 
         <service name="Cluster Connection (Managed Server)"
                  discovery="SubsystemDiscovery"
-                 class="BaseComponent"
+                 class="ConnectorDiscoveryGroupValidatorComponent"
                  createDeletePolicy="neither">
 
           <plugin-configuration>
@@ -4784,7 +4784,7 @@
 
         <service name="Bridge (Managed Server)"
                  discovery="SubsystemDiscovery"
-                 class="BaseComponent"
+                 class="ConnectorDiscoveryGroupValidatorComponent"
                  createDeletePolicy="neither">
 
           <plugin-configuration>
@@ -6804,7 +6804,7 @@
 
         <service name="Cluster Connection (Profile)"
                  discovery="SubsystemDiscovery"
-                 class="BaseComponent"
+                 class="ConnectorDiscoveryGroupValidatorComponent"
                  createDeletePolicy="both">
 
           <plugin-configuration>
@@ -6893,7 +6893,7 @@
 
         <service name="Bridge (Profile)"
                  discovery="SubsystemDiscovery"
-                 class="BaseComponent"
+                 class="ConnectorDiscoveryGroupValidatorComponent"
                  createDeletePolicy="both">
 
           <plugin-configuration>
@@ -12855,7 +12855,7 @@
 
       <service name="Cluster Connection"
                discovery="SubsystemDiscovery"
-               class="BaseComponent"
+               class="ConnectorDiscoveryGroupValidatorComponent"
                createDeletePolicy="both">
 
         <plugin-configuration>
@@ -12985,7 +12985,7 @@
 
       <service name="Bridge"
                discovery="SubsystemDiscovery"
-               class="BaseComponent"
+               class="ConnectorDiscoveryGroupValidatorComponent"
                createDeletePolicy="both">
 
         <plugin-configuration>


commit e96ce182758719f86364bdc7a2e73c287dddbe4c
Author: Stefan Negrea <snegrea at redhat.com>
Date:   Tue Aug 28 15:22:40 2012 -0500

    [BZ 852534] Collapsed maps with null keys should be set to null. Attempting to send maps with null values to the application server results in validation errors.

diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ConfigurationWriteDelegate.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ConfigurationWriteDelegate.java
index 8286f17..aad2105 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ConfigurationWriteDelegate.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ConfigurationWriteDelegate.java
@@ -628,10 +628,14 @@ public class ConfigurationWriteDelegate implements ConfigurationFacet {
                 throw new IllegalArgumentException("Member names in a :collapsed map must end in :0 and :1");
         }
 
-        Map<String, Object> resultMap = new HashMap<String, Object>();
-        resultMap.put(key, value);
+        if (key != null) {
+            Map<String, Object> resultMap = new HashMap<String, Object>();
+            resultMap.put(key, value);
 
-        return resultMap;
+            return resultMap;
+        } else {
+            return null;
+        }
     }
 
 


commit 9fda60f21e354f3b33a1ecf85b81cae19e0af1af
Author: Jirka Kremser <jkremser at redhat.com>
Date:   Tue Aug 28 14:34:23 2012 +0200

    [BZ 850818 - Globally uncaught exception on clicking OK button while adding CLI Script alert notification to the alert definition] Added the check whether the repository has been picked

diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/CliNotificationSenderForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/CliNotificationSenderForm.java
index f63eb55..b212043 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/CliNotificationSenderForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/CliNotificationSenderForm.java
@@ -403,6 +403,11 @@ public class CliNotificationSenderForm extends AbstractNotificationSenderForm {
     }
 
     private void validatePackage(final AsyncCallback<Void> callback) {
+        if (config.selectedRepo == null) {
+            repoSelector.setIcons(failureIcon);
+            callback.onFailure(null);
+            return;
+        }
         getConfiguration().put(new PropertySimple(PROP_REPO_ID, config.selectedRepo.getId()));
 
         if (packageSelector.getSelectedIndex() == 0) {


commit f3f26d0a85bf71fad532424b6267a331bd048136
Author: Mike Thompson <mithomps at redhat.com>
Date:   Mon Aug 27 14:42:26 2012 -0700

    [BZ 848501] - IE8 rendering of resource measurement time overlaid on the actual metric name

diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java
index c27e626..8a0898d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java
@@ -290,6 +290,7 @@ public class ResourceMetricsPortlet extends GroupMetricsPortlet {
                                                         StaticTextItem value = AbstractActivityView
                                                             .newTextItem(convertedValue);
                                                         value.setVAlign(VerticalAlignment.TOP);
+                                                        value.setAlign(Alignment.RIGHT);
 
                                                         row.setItems(graphContainer, link, value);
                                                         row.setWidth100();




More information about the rhq-commits mailing list