[rhq] Branch 'drift' - 28 commits - etc/scripts modules/enterprise
by John Sanda
etc/scripts/install-rhq-agent.sh | 111 ++++++
etc/scripts/install-rhq-server.sh | 69 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/AutodiscoveryQueueDataSource.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java | 185 ++++++----
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 18
modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/discovery/DiscoveryBossBeanTest.xml | 2
modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/inventory/InventoryManagerBeanTest.xml | 2
modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/plugin_v1.xml | 2
8 files changed, 324 insertions(+), 67 deletions(-)
New commits:
commit 673ba8a68dc3edf4c037fb99225afc9df1130356
Merge: 87ad74d 4fa820c
Author: John Sanda <jsanda(a)redhat.com>
Date: Thu Jul 7 21:15:42 2011 -0400
Merge branch 'master' into drift
Conflicts:
modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/plugin_v1.xml
diff --cc modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/inventory/InventoryManagerBeanTest.xml
index 055f2fd,0cfe2f1..cf2c277
--- a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/inventory/InventoryManagerBeanTest.xml
+++ b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/inventory/InventoryManagerBeanTest.xml
@@@ -104,8 -105,9 +104,8 @@@
<rhq_availability/>
<rhq_measurement_sched/>
<rhq_content_source/>
- <rhq_content_source_type/>
- <rhq_repo_content_src_map/>
<rhq_package/>
<rhq_bundle/>
+ <rhq_drift_template_map/>
<rhq_plugin/>
- </dataset>
+ </dataset>
diff --cc modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/plugin_v1.xml
index c00a7d0,ea8aaba..c12357e
--- a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/plugin_v1.xml
+++ b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/plugin_v1.xml
@@@ -34,7 -34,7 +34,7 @@@
</operation>
<metric displayName="Metric 1" property="metric1" displayType="summary" defaultInterval="300000"/>
- <metric displayName="Metric 2" property="metric2" displayType="summary" defaultInterval="300000" dataType="trait"/>
- <metric displayName="Metric 2" property="metric2" displayType="summary" defaultInterval="300000"/>
++ <metric displayName="Metric 2" property="metric2" displayType="summary" defaultInterval="300000" dataType="summary"/>
<event name="logAEntry" description="an entry was appended to a log file"/>
<event name="logBEntry" description="an entry was appended to a log file"/>
commit 4fa820c8bfdea5f64b3bf34f109de218049c1083
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Thu Jul 7 15:18:05 2011 -0400
make sure TreeGrid and buttons refresh on data arrival
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
index 678bc74..4daa3c6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
@@ -40,6 +40,8 @@ import com.smartgwt.client.widgets.form.fields.SelectItem;
import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.grid.events.DataArrivedEvent;
+import com.smartgwt.client.widgets.grid.events.DataArrivedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionEvent;
import com.smartgwt.client.widgets.layout.HLayout;
@@ -260,6 +262,20 @@ public class ResourceAutodiscoveryView extends LocatableVLayout implements Refre
});
+ treeGrid.addDataArrivedHandler(new DataArrivedHandler() {
+ public void onDataArrived(DataArrivedEvent dataArrivedEvent) {
+ if (treeGrid != null) {
+ updateButtonEnablement(selectAllButton, deselectAllButton, importButton, ignoreButton,
+ unignoreButton);
+ // NOTE: Due to a SmartGWT bug, the TreeGrid is not automatically redrawn upon data arrival, and
+ // calling treeGrid.markForRedraw() doesn't redraw it either. The user can mouse over the grid
+ // to cause it to redraw, but it is obviously not reasonable to expect that. So we must
+ // explicitly call redraw() here.
+ treeGrid.redraw();
+ }
+ }
+ });
+
selectAllButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
SC.ask(MSG.view_autoDiscoveryQ_confirmSelectAll(), new BooleanCallback() {
@@ -371,6 +387,7 @@ public class ResourceAutodiscoveryView extends LocatableVLayout implements Refre
importButton.setDisabled(true);
ignoreButton.setDisabled(true);
unignoreButton.setDisabled(true);
+ markForRedraw();
return;
}
@@ -426,8 +443,10 @@ public class ResourceAutodiscoveryView extends LocatableVLayout implements Refre
* Custom refresh operation, as we cannot extend Table because we use a TreeGrid, not a ListGrid.
*/
public void refresh() {
- this.treeGrid.invalidateCache();
- this.treeGrid.markForRedraw();
+ if (this.treeGrid != null) {
+ this.treeGrid.invalidateCache();
+ this.treeGrid.markForRedraw();
+ }
}
public DataSource getDataSource() {
commit 132864a0fdb6c0bcf6d7a9c948633c9bbff98c9e
Author: John Sanda <jsanda(a)redhat.com>
Date: Thu Jul 7 14:35:00 2011 -0400
Removing drift plugin descriptor elements that are not yet in master
diff --git a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/plugin_v1.xml b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/plugin_v1.xml
index 36eb2b5..ea8aaba 100644
--- a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/plugin_v1.xml
+++ b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/plugin_v1.xml
@@ -51,14 +51,6 @@
</configuration>
</content>
- <drift-configuration name="drift1">
- <basedir>
- <value-context>pluginConfiguration</value-context>
- <value-name>connectionPropertyX</value-name>
- </basedir>
- </drift-configuration>
-
-<!-- THIS CAUSES A DEADLOCK DURING PLUGIN REGISTRATION! -->
<bundle-target>
<destination-base-dir name="bundleTarget1">
<value-context>pluginConfiguration</value-context>
commit 4aba34c876baca85751e3ed749efaf485574879c
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Thu Jul 7 13:13:11 2011 -0400
fix a couple bugs in the recently added selectAll/deselectAll functionality on the autodiscovery queue view
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
index e504f2a..678bc74 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
@@ -265,19 +265,24 @@ public class ResourceAutodiscoveryView extends LocatableVLayout implements Refre
SC.ask(MSG.view_autoDiscoveryQ_confirmSelectAll(), new BooleanCallback() {
public void execute(Boolean selectChildServers) {
selectionChangedHandlerDisabled = true;
+ TreeNode[] nodesToSelect;
if (selectChildServers) {
- treeGrid.selectAllRecords();
+ // NOTE: We do not use treeGrid.selectAllRecords() here, because it only selects nodes that
+ // are currently visible, and we want to select all nodes, including server nodes
+ // under a collapsed platform node.
+ nodesToSelect = treeGrid.getTree().getAllNodes();
} else {
- // Select only the platforms.
TreeNode rootNode = treeGrid.getTree().getRoot();
- TreeNode[] platformNodes = treeGrid.getTree().getChildren(rootNode);
- for (TreeNode platformNode : platformNodes) {
- treeGrid.selectRecord(platformNode);
- }
+ // The children of the root node are the platform nodes.
+ nodesToSelect = treeGrid.getTree().getChildren(rootNode);
}
- selectionChangedHandlerDisabled = false;
+ for (TreeNode nodeToSelect : nodesToSelect) {
+ treeGrid.selectRecord(nodeToSelect);
+ }
+ treeGrid.markForRedraw();
updateButtonEnablement(selectAllButton, deselectAllButton, importButton, ignoreButton,
unignoreButton);
+ selectionChangedHandlerDisabled = false;
}
});
}
@@ -287,8 +292,9 @@ public class ResourceAutodiscoveryView extends LocatableVLayout implements Refre
public void onClick(ClickEvent clickEvent) {
selectionChangedHandlerDisabled = true;
treeGrid.deselectAllRecords();
- selectionChangedHandlerDisabled = false;
+ treeGrid.markForRedraw();
updateButtonEnablement(selectAllButton, deselectAllButton, importButton, ignoreButton, unignoreButton);
+ selectionChangedHandlerDisabled = false;
}
});
commit 306e16a8d1812d7ce693887911922f3028c24486
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Thu Jul 7 13:12:17 2011 -0400
more work on automated install scripts
diff --git a/etc/scripts/install-rhq-agent.sh b/etc/scripts/install-rhq-agent.sh
index 0cc583f..46618c4 100644
--- a/etc/scripts/install-rhq-agent.sh
+++ b/etc/scripts/install-rhq-agent.sh
@@ -1,5 +1,24 @@
#!/bin/sh
+#
+# This script silently installs an RHQ Agent. It requires that the RHQ Server
+# that the Agent will register with be up and running. It is configured via the
+# following environment variables. For convenience, these variables can be
+# defined in a file named install-rhq-agent-env.sh located in the same directory
+# as this script.
+#
+# RHQ_AGENT_ENV_URL - the URL or path of the rhq-agent-env.sh to be used by the
+# Agent
+# RHQ_AGENT_CONFIGURATION_URL - the URL or path of the agent-configuration.xml
+# to be used by the Agent for its initial
+# configuration
+# RHQ_AGENT_INSTALL_PARENT_DIR - the path of the directory under which the Agent
+# install directory (rhq-agent) will be created
+# (e.g. $HOME/Applications)
+# RHQ_AGENT_NAME - the Agent name
+# RHQ_AGENT_SERVER_BIND_ADDRESS - the Server bind address
+#
+
# Define functions.
abort()
{
@@ -15,12 +34,23 @@ usage()
abort "$@" "Usage: $EXE RHQ_SERVER_URL RHQ_AGENT_ENV_URL RHQ_AGENT_CONFIGURATION_URL RHQ_AGENT_INSTALL_PARENT_DIR" "Example: $EXE http://localhost:7080/ rhq-agent-env.sh agent-configuration.xml ~/Applications"
}
+SCRIPT_PATH=`readlink -e "$0" 2>/dev/null || readlink "$0" 2>/dev/null || echo "$0"`
+SCRIPT_PARENT_DIR=`dirname "$SCRIPT_PATH"`
+
+SCRIPT_ENV_PATH="${SCRIPT_PARENT_DIR}/install-rhq-agent-env.sh"
+if [ -f "$SCRIPT_ENV_PATH" ]; then
+ . "$SCRIPT_ENV_PATH" $*
+else
+ echo "No environment script found at: $SCRIPT_ENV_PATH"
+fi
+
# Process command line args.
EXE=`basename $0`
if [ "$#" -ne 4 ]; then
usage "Invalid number of arguments."
fi
-RHQ_SERVER_URL="$1"
+
+RHQ_SERVER_URL="http://$RHQ_AGENT_SERVER_BIND_ADDRESS:7080/"
RHQ_AGENT_ENV_URL="$2"
RHQ_AGENT_CONFIGURATION_URL="$3"
RHQ_AGENT_INSTALL_PARENT_DIR="$4"
commit d977b4d7a60b1a71c28d33d4667e6ce4773bb8d2
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Wed Jul 6 17:29:13 2011 -0400
first cut of shell scripts for silently installing RHQ Server or RHQ Agents
diff --git a/etc/scripts/install-rhq-agent.sh b/etc/scripts/install-rhq-agent.sh
new file mode 100644
index 0000000..0cc583f
--- /dev/null
+++ b/etc/scripts/install-rhq-agent.sh
@@ -0,0 +1,81 @@
+#!/bin/sh
+
+# Define functions.
+abort()
+{
+ echo >&2
+ for ARG in "$@"; do
+ echo "$ARG" >&2
+ done
+ exit 1
+}
+
+usage()
+{
+ abort "$@" "Usage: $EXE RHQ_SERVER_URL RHQ_AGENT_ENV_URL RHQ_AGENT_CONFIGURATION_URL RHQ_AGENT_INSTALL_PARENT_DIR" "Example: $EXE http://localhost:7080/ rhq-agent-env.sh agent-configuration.xml ~/Applications"
+}
+
+# Process command line args.
+EXE=`basename $0`
+if [ "$#" -ne 4 ]; then
+ usage "Invalid number of arguments."
+fi
+RHQ_SERVER_URL="$1"
+RHQ_AGENT_ENV_URL="$2"
+RHQ_AGENT_CONFIGURATION_URL="$3"
+RHQ_AGENT_INSTALL_PARENT_DIR="$4"
+
+# Download the Agent installer jarfile.
+mkdir -p "$HOME/Downloads/tmp"
+cd "$HOME/Downloads/tmp"
+rm -rf *
+wget --content-disposition --timestamping "$RHQ_SERVER_URL/agentupdate/download"
+RHQ_AGENT_DIST_FILE_NAME=`echo *`
+mv $RHQ_AGENT_DIST_FILE_NAME ..
+
+# Download the Agent env file.
+if [ -f "$RHQ_AGENT_ENV_URL" ]; then
+ RHQ_AGENT_ENV_FILE="$RHQ_AGENT_ENV_URL"
+else
+ mkdir -p "$HOME/Downloads/tmp"
+ cd "$HOME/Downloads/tmp"
+ rm -rf *
+ wget --content-disposition --no-check-certificate --timestamping "$RHQ_AGENT_ENV_URL"
+ RHQ_AGENT_ENV_FILE_NAME=`echo *`
+ RHQ_AGENT_ENV_FILE="$HOME/Downloads/tmp/$RHQ_AGENT_ENV_FILE_NAME"
+fi
+
+# Download the Agent config file.
+if [ -f "$RHQ_AGENT_CONFIGURATION_URL" ]; then
+ RHQ_AGENT_CONFIGURATION_FILE="$RHQ_AGENT_CONFIGURATION_URL"
+else
+ mkdir -p "$HOME/Downloads/tmp"
+ cd "$HOME/Downloads/tmp"
+ rm -rf *
+ wget --content-disposition --no-check-certificate --timestamping "$RHQ_AGENT_CONFIGURATION_URL"
+ RHQ_AGENT_CONFIGURATION_FILE_NAME=`echo *`
+ RHQ_AGENT_CONFIGURATION_FILE="$HOME/Downloads/tmp/$RHQ_AGENT_CONFIGURATION_FILE_NAME"
+fi
+
+# Install the Agent.
+cd "$RHQ_AGENT_INSTALL_PARENT_DIR"
+# The Agent installer installs the Agent to ./rhq-agent.
+RHQ_AGENT_HOME="$RHQ_SERVER_INSTALL_PARENT_DIR/rhq-agent"
+if [ -f "$RHQ_AGENT_HOME" ]; then
+ # Backup existing Agent installation.
+ rm -rf "$RHQ_AGENT_HOME.bak"
+ mv "$RHQ_AGENT_HOME" "$RHQ_AGENT_HOME.bak"
+fi
+java -jar "$HOME/Downloads/$RHQ_AGENT_DIST_FILE_NAME" --install
+
+# Install the Agent env file.
+mv -f "$RHQ_AGENT_ENV_FILE" "$RHQ_AGENT_HOME/bin/rhq-agent-env.sh"
+sed -e "s/@@HOSTNAME@@/`hostname`/g" -e "s/@@SHORT_HOSTNAME@@/`hostname -s`/g" "$RHQ_AGENT_HOME/bin/rhq-agent-env.sh"
+
+# Install the Agent configuration file.
+mv -f "$RHQ_AGENT_CONFIGURATION_FILE" "$RHQ_AGENT_HOME/conf/agent-configuration.xml"
+sed -e "s/@@HOSTNAME@@/`hostname`/g" -e "s/@@SHORT_HOSTNAME@@/`hostname -s`/g" "$RHQ_AGENT_HOME/conf/agent-configuration.xml"
+
+# Start the Agent
+$RHQ_AGENT_HOME/bin/rhq-agent-wrapper.sh start
+
diff --git a/etc/scripts/install-rhq-server.sh b/etc/scripts/install-rhq-server.sh
new file mode 100644
index 0000000..e01f8f1
--- /dev/null
+++ b/etc/scripts/install-rhq-server.sh
@@ -0,0 +1,69 @@
+#!/bin/sh
+
+# Define functions.
+abort()
+{
+ echo >&2
+ for ARG in "$@"; do
+ echo "$ARG" >&2
+ done
+ exit 1
+}
+
+usage()
+{
+ abort "$@" "Usage: $EXE RHQ_SERVER_DIST_URL RHQ_SERVER_PROPERTIES_URL RHQ_SERVER_INSTALL_PARENT_DIR" "Example: $EXE http://sourceforge.net/projects/rhq/files/rhq/rhq-4.0.1/rhq-server-4.0.1.... rhq-server.properties /home/bob/Applications"
+}
+
+# Process command line args.
+EXE=`basename $0`
+if [ "$#" -ne 3 ]; then
+ usage "Invalid number of arguments."
+fi
+RHQ_SERVER_DIST_URL="$1"
+RHQ_SERVER_PROPERTIES_URL="$2"
+RHQ_SERVER_INSTALL_PARENT_DIR="$3"
+
+echo "If you are upgrading or replacing existing RHQ Servers, make sure all of those Servers are stopped, then hit Enter to continue."
+read
+
+# Download the Server zipfile.
+mkdir -p "$HOME/Downloads/tmp"
+cd "$HOME/Downloads/tmp"
+rm -rf *
+wget --content-disposition --no-check-certificate --timestamping "$RHQ_SERVER_DOWNLOAD_URL"
+RHQ_SERVER_DIST_FILE_NAME=`echo *`
+mv $RHQ_SERVER_DIST_FILE_NAME ..
+
+# Download the Server properties file.
+if [ -f "$RHQ_SERVER_PROPERTIES_URL" ]; then
+ RHQ_SERVER_PROPERTIES_FILE="$RHQ_SERVER_PROPERTIES_URL"
+else
+ mkdir -p "$HOME/Downloads/tmp"
+ cd "$HOME/Downloads/tmp"
+ rm -rf *
+ wget --content-disposition --no-check-certificate --timestamping "$RHQ_SERVER_PROPERTIES_URL"
+ RHQ_SERVER_PROPERTIES_FILE_NAME=`echo *`
+ RHQ_SERVER_PROPERTIES_FILE="/tmp/$RHQ_SERVER_PROPERTIES_FILE_NAME"
+fi
+
+# Unzip the Server zipfile.
+mkdir "$RHQ_SERVER_INSTALL_PARENT_DIR/tmp"
+cd "$RHQ_SERVER_INSTALL_PARENT_DIR/tmp"
+unzip -q "$HOME/Downloads/$RHQ_SERVER_DIST_FILE_NAME"
+RHQ_SERVER_HOME_BASE_NAME=`echo *`
+RHQ_SERVER_HOME="$RHQ_SERVER_INSTALL_PARENT_DIR/$RHQ_SERVER_HOME_BASE_NAME"
+if [ -f "$RHQ_SERVER_HOME" ]; then
+ # Backup existing Server installation.
+ rm -rf "$RHQ_SERVER_HOME.bak"
+ mv "$RHQ_SERVER_HOME" "$RHQ_SERVER_HOME.bak"
+fi
+mv $RHQ_SERVER_HOME_BASE_NAME ..
+
+# Install the Server properties file.
+mv -f "$RHQ_SERVER_PROPERTIES_FILE" "$RHQ_SERVER_HOME/bin/rhq-server.properties"
+sed -e "s/@@HOSTNAME@@/`hostname`/g" -e "s/@@SHORT_HOSTNAME@@/`hostname -s`/g" "$RHQ_SERVER_HOME/bin/rhq-server.properties"
+
+# Start the Server
+$RHQ_SERVER_HOME/bin/rhq-server.sh start
+
commit 2ffae275d74d321668ad36009bdad223cea78cb5
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Wed Jul 6 13:20:56 2011 -0400
[BZ 718335] add Select All and Deselect All buttons to autodiscovery view (https://bugzilla.redhat.com/show_bug.cgi?id=718335); right-align inventory status filter in footer, along with Select All, Deselect All, and Refresh buttons
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
index da3768c..e504f2a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
+ * Copyright (C) 2005-2011 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -51,6 +51,7 @@ import com.smartgwt.client.widgets.tree.TreeNode;
import org.rhq.core.domain.resource.InventoryStatus;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.RefreshableView;
import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
@@ -64,7 +65,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
* @author Greg Hinkle
*/
-public class ResourceAutodiscoveryView extends LocatableVLayout {
+public class ResourceAutodiscoveryView extends LocatableVLayout implements RefreshableView {
private static final String TITLE = MSG.view_autoDiscoveryQ_title();
private static final String HEADER_ICON = "global/AutoDiscovery_24.png";
@@ -73,6 +74,8 @@ public class ResourceAutodiscoveryView extends LocatableVLayout {
private TreeGrid treeGrid;
private ToolStrip footer;
private DataSource dataSource;
+ // This allows the selection handler to ignore selection changes initiated by us, as opposed to by the user.
+ private boolean selectionChangedHandlerDisabled;
private ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService(1000000);
@@ -167,6 +170,10 @@ public class ResourceAutodiscoveryView extends LocatableVLayout {
disableButtons(importButton, ignoreButton, unignoreButton);
+ footer.addMember(new LayoutSpacer());
+
+ // The remaining footer items (status filter, (de)select all buttons, and refresh button) will be right-aligned.
+
DynamicForm form = new LocatableDynamicForm(this.extendLocatorId("Status"));
final SelectItem statusSelectItem = new SelectItem("status", MSG.view_autoDiscoveryQ_showStatus());
statusSelectItem.setValueMap(AutodiscoveryQueueDataSource.NEW, AutodiscoveryQueueDataSource.IGNORED,
@@ -182,7 +189,13 @@ public class ResourceAutodiscoveryView extends LocatableVLayout {
});
footer.addMember(form);
- footer.addMember(new LayoutSpacer());
+ final IButton selectAllButton = new LocatableIButton(this.extendLocatorId("SelectAll"),
+ MSG.view_autoDiscoveryQ_selectAll());
+ footer.addMember(selectAllButton);
+ final IButton deselectAllButton = new LocatableIButton(this.extendLocatorId("DeselectAll"),
+ MSG.view_autoDiscoveryQ_deselectAll());
+ deselectAllButton.setDisabled(true);
+ footer.addMember(deselectAllButton);
IButton refreshButton = new LocatableIButton(extendLocatorId("Refresh"), MSG.common_button_refresh());
refreshButton.addClickHandler(new ClickHandler() {
@@ -193,9 +206,6 @@ public class ResourceAutodiscoveryView extends LocatableVLayout {
footer.addMember(refreshButton);
treeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
- // use this to ignore selection changes we initiate from within this handler
- private boolean selectionChangedHandlerDisabled = false;
-
public void onSelectionChanged(SelectionEvent selectionEvent) {
if (selectionChangedHandlerDisabled || selectionEvent.isRightButtonDown()) {
return;
@@ -218,7 +228,8 @@ public class ResourceAutodiscoveryView extends LocatableVLayout {
}
}
}
- updateButtonEnablement(importButton, ignoreButton, unignoreButton);
+ updateButtonEnablement(selectAllButton, deselectAllButton, importButton, ignoreButton,
+ unignoreButton);
selectionChangedHandlerDisabled = false;
}
});
@@ -228,10 +239,11 @@ public class ResourceAutodiscoveryView extends LocatableVLayout {
treeGrid.deselectRecord(child);
}
}
- // the immediate redraw below should not be necessary but without it the deselected
+ // the immediate redraw below should not be necessary, but without it the deselected
// platform checkbox remained checked.
treeGrid.redraw();
- updateButtonEnablement(importButton, ignoreButton, unignoreButton);
+ updateButtonEnablement(selectAllButton, deselectAllButton, importButton, ignoreButton,
+ unignoreButton);
selectionChangedHandlerDisabled = false;
}
} else {
@@ -240,52 +252,51 @@ public class ResourceAutodiscoveryView extends LocatableVLayout {
treeGrid.selectRecord(parentNode);
}
}
- updateButtonEnablement(importButton, ignoreButton, unignoreButton);
+ updateButtonEnablement(selectAllButton, deselectAllButton, importButton, ignoreButton,
+ unignoreButton);
selectionChangedHandlerDisabled = false;
}
}
- private void updateButtonEnablement(IButton importButton, IButton ignoreButton, IButton unignoreButton) {
- if (treeGrid.getSelection().length == 0) {
- importButton.setDisabled(true);
- ignoreButton.setDisabled(true);
- unignoreButton.setDisabled(true);
- return;
- }
-
- boolean importOk = false;
- boolean ignoreOk = false;
- boolean unignoreOk = false;
-
- for (ListGridRecord listGridRecord : treeGrid.getSelection()) {
- TreeNode node = (TreeNode) listGridRecord;
- String status = node.getAttributeAsString("status");
- TreeNode parentNode = treeGrid.getTree().getParent(node);
- boolean isPlatform = treeGrid.getTree().isRoot(parentNode);
-
- importOk |= InventoryStatus.NEW.name().equals(status);
- unignoreOk |= InventoryStatus.IGNORED.name().equals(status);
+ });
- if (!isPlatform) {
- String parentStatus = parentNode.getAttributeAsString("status");
- if (InventoryStatus.COMMITTED.name().equals(parentStatus)) {
- ignoreOk |= InventoryStatus.NEW.name().equals(status);
+ selectAllButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ SC.ask(MSG.view_autoDiscoveryQ_confirmSelectAll(), new BooleanCallback() {
+ public void execute(Boolean selectChildServers) {
+ selectionChangedHandlerDisabled = true;
+ if (selectChildServers) {
+ treeGrid.selectAllRecords();
+ } else {
+ // Select only the platforms.
+ TreeNode rootNode = treeGrid.getTree().getRoot();
+ TreeNode[] platformNodes = treeGrid.getTree().getChildren(rootNode);
+ for (TreeNode platformNode : platformNodes) {
+ treeGrid.selectRecord(platformNode);
+ }
}
+ selectionChangedHandlerDisabled = false;
+ updateButtonEnablement(selectAllButton, deselectAllButton, importButton, ignoreButton,
+ unignoreButton);
}
- }
+ });
+ }
+ });
- importButton.setDisabled(!importOk || unignoreOk);
- ignoreButton.setDisabled(!ignoreOk || unignoreOk);
- unignoreButton.setDisabled(!unignoreOk || importOk || ignoreOk);
- markForRedraw();
+ deselectAllButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ selectionChangedHandlerDisabled = true;
+ treeGrid.deselectAllRecords();
+ selectionChangedHandlerDisabled = false;
+ updateButtonEnablement(selectAllButton, deselectAllButton, importButton, ignoreButton, unignoreButton);
}
});
importButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
- disableButtons(importButton, ignoreButton, unignoreButton);
+ disableButtons(selectAllButton, deselectAllButton, importButton, ignoreButton, unignoreButton);
CoreGUI.getMessageCenter().notify(
- new Message("Importing the selected Resources...", Message.Severity.Info, EnumSet
+ new Message(MSG.view_autoDiscoveryQ_importInProgress(), Message.Severity.Info, EnumSet
.of(Message.Option.Transient)));
resourceService.importResources(getSelectedIds(), new AsyncCallback<Void>() {
@@ -304,9 +315,9 @@ public class ResourceAutodiscoveryView extends LocatableVLayout {
ignoreButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
- disableButtons(importButton, ignoreButton, unignoreButton);
+ disableButtons(selectAllButton, deselectAllButton, importButton, ignoreButton, unignoreButton);
CoreGUI.getMessageCenter().notify(
- new Message("Ignoring the selected Resources...", Message.Severity.Info, EnumSet
+ new Message(MSG.view_autoDiscoveryQ_ignoreInProgress(), Message.Severity.Info, EnumSet
.of(Message.Option.Transient)));
resourceService.ignoreResources(getSelectedIds(), new AsyncCallback<Void>() {
@@ -325,9 +336,9 @@ public class ResourceAutodiscoveryView extends LocatableVLayout {
unignoreButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
- disableButtons(importButton, ignoreButton, unignoreButton);
+ disableButtons(selectAllButton, deselectAllButton, importButton, ignoreButton, unignoreButton);
CoreGUI.getMessageCenter().notify(
- new Message("Unignoring the selected Resources...", Message.Severity.Info, EnumSet
+ new Message(MSG.view_autoDiscoveryQ_unignoreInProgress(), Message.Severity.Info, EnumSet
.of(Message.Option.Transient)));
resourceService.unignoreResources(getSelectedIds(), new AsyncCallback<Void>() {
@@ -346,6 +357,48 @@ public class ResourceAutodiscoveryView extends LocatableVLayout {
}
+ private void updateButtonEnablement(IButton selectAllButton, IButton deselectAllButton,
+ IButton importButton, IButton ignoreButton, IButton unignoreButton) {
+ if (treeGrid.getSelection().length == 0) {
+ selectAllButton.setDisabled(false);
+ deselectAllButton.setDisabled(true);
+ importButton.setDisabled(true);
+ ignoreButton.setDisabled(true);
+ unignoreButton.setDisabled(true);
+ return;
+ }
+
+ boolean allSelected = (treeGrid.getSelection().length == treeGrid.getRecords().length);
+ selectAllButton.setDisabled(allSelected);
+ deselectAllButton.setDisabled(false);
+
+ boolean importOk = false;
+ boolean ignoreOk = false;
+ boolean unignoreOk = false;
+
+ for (ListGridRecord listGridRecord : treeGrid.getSelection()) {
+ TreeNode node = (TreeNode) listGridRecord;
+ String status = node.getAttributeAsString("status");
+ TreeNode parentNode = treeGrid.getTree().getParent(node);
+ boolean isPlatform = treeGrid.getTree().isRoot(parentNode);
+
+ importOk |= InventoryStatus.NEW.name().equals(status);
+ unignoreOk |= InventoryStatus.IGNORED.name().equals(status);
+
+ if (!isPlatform) {
+ String parentStatus = parentNode.getAttributeAsString("status");
+ if (InventoryStatus.COMMITTED.name().equals(parentStatus)) {
+ ignoreOk |= InventoryStatus.NEW.name().equals(status);
+ }
+ }
+ }
+
+ importButton.setDisabled(!importOk || unignoreOk);
+ ignoreButton.setDisabled(!ignoreOk || unignoreOk);
+ unignoreButton.setDisabled(!unignoreOk || importOk || ignoreOk);
+ markForRedraw();
+ }
+
private void disableButtons(IButton... buttons) {
for (IButton button : buttons) {
button.setDisabled(true);
@@ -363,17 +416,10 @@ public class ResourceAutodiscoveryView extends LocatableVLayout {
return TableUtility.getIds(selected);
}
- /** Custom refresh operation as we cannot directly extend Table because it
- * contains a TreeGrid, not a ListGrid.
+ /**
+ * Custom refresh operation, as we cannot extend Table because we use a TreeGrid, not a ListGrid.
*/
- @Override
- public void redraw() {
- super.redraw();
- // Now reload the table data.
- refresh();
- }
-
- private void refresh() {
+ public void refresh() {
this.treeGrid.invalidateCache();
this.treeGrid.markForRedraw();
}
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index ddd0d3e..f7f6f75 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -831,29 +831,35 @@ view_alerts_table_title_group = Group Alert History
view_alerts_table_title_resource = Resource Alert History
view_autoDiscoveryQ_committed = Committed
view_autoDiscoveryQ_confirmSelect = Also select the platform children?
+view_autoDiscoveryQ_confirmSelectAll = Also select the children of each platform?
view_autoDiscoveryQ_deleted = Deleted
+view_autoDiscoveryQ_deselectAll = Deselect All
view_autoDiscoveryQ_field_discoveryTime = Discovery Time
view_autoDiscoveryQ_field_inventoryStatus = Inventory Status
view_autoDiscoveryQ_field_key = Resource Key
view_autoDiscoveryQ_field_name = Resource Name
view_autoDiscoveryQ_field_parentId = Parent ID
view_autoDiscoveryQ_ignore = Ignore
-view_autoDiscoveryQ_ignoreFailure = Failed to ignore resources
-view_autoDiscoveryQ_ignoreSuccessful = You have successfully ignored the selected resources.
+view_autoDiscoveryQ_ignoreFailure = Failed to ignore Resources
+view_autoDiscoveryQ_ignoreInProgress = Ignoring the selected Resources...
+view_autoDiscoveryQ_ignoreSuccessful = You have successfully ignored the selected Resources.
view_autoDiscoveryQ_ignored = Ignored
view_autoDiscoveryQ_import = Import
-view_autoDiscoveryQ_importFailure = Failed to import resources
-view_autoDiscoveryQ_importSuccessful = You have successfully imported the selected resources.
+view_autoDiscoveryQ_importFailure = Failed to import Resources
+view_autoDiscoveryQ_importInProgress = Importing the selected Resources...
+view_autoDiscoveryQ_importSuccessful = You have successfully imported the selected Resources.
view_autoDiscoveryQ_loadFailure = Failed to load the inventory discovery queue
view_autoDiscoveryQ_new = New
view_autoDiscoveryQ_newAndIgnored = New and Ignored
view_autoDiscoveryQ_noItems = No items to show
view_autoDiscoveryQ_noperm = (You are not authorized to view the auto-discovery queue)
+view_autoDiscoveryQ_selectAll = Select All
view_autoDiscoveryQ_showStatus = Show
view_autoDiscoveryQ_title = Autodiscovery Queue
view_autoDiscoveryQ_unignore = Unignore
-view_autoDiscoveryQ_unignoreFailure = Failed to unignore resources
-view_autoDiscoveryQ_unignoreSuccessful = You have successfully unignored the selected resources.
+view_autoDiscoveryQ_unignoreFailure = Failed to unignore Resources
+view_autoDiscoveryQ_unignoreInProgress = Unignoring the selected Resources...
+view_autoDiscoveryQ_unignoreSuccessful = You have successfully unignored the selected Resources.
view_autoDiscoveryQ_uninventoried = Uninventoried
view_bundleVersion_loadFailure = Failed to load bundle version data
view_bundle_bundle = Bundle
commit 67e6127f6ec3fb8a2186f1a583bda88d76ef2696
Author: John Sanda <jsanda(a)redhat.com>
Date: Fri Jul 1 21:07:04 2011 -0400
Initial commit for CollectionMatchersChecker
Adding a new assert in AssertUtils that verifies whether two collections
match. assertCollectionMatchesNoOrder compares the elements of two
collections, doing a property-wise comparison similar to how
assertPropertiesMatch does.
diff --git a/modules/test-utils/src/main/java/org/rhq/test/AssertUtils.java b/modules/test-utils/src/main/java/org/rhq/test/AssertUtils.java
index c86114e..fc41623 100644
--- a/modules/test-utils/src/main/java/org/rhq/test/AssertUtils.java
+++ b/modules/test-utils/src/main/java/org/rhq/test/AssertUtils.java
@@ -101,4 +101,26 @@ public class AssertUtils {
assertTrue(result.isEqual(), msg + " -- " + result.getDetails());
}
+ /**
+ * Verifies that the two collections contain the same number of matching elements as is
+ * done in {@link #assertPropertiesMatch(String, Object, Object, String...)}. If the
+ * collections differ in size, an assertion error will be thrown; otherwise, elements
+ * are compared, ignoring order. Note that all element properties are are compared in
+ * this method.
+ *
+ * @param expected The expected collection to compare against
+ * @param actual The actual collection under test
+ * @param msg An error message
+ * @param <T> The type of the elements in the collections
+ */
+ public static <T> void assertCollectionMatchesNoOrder(Collection<T> expected, Collection<T> actual, String msg) {
+ CollectionMatchesChecker<T> checker = new CollectionMatchesChecker<T>();
+ checker.setExpected(expected);
+ checker.setActual(actual);
+
+ MatchResult result = checker.execute();
+
+ assertTrue(result.isMatch(), msg + " -- " + result.getDetails());
+ }
+
}
diff --git a/modules/test-utils/src/main/java/org/rhq/test/CollectionMatchesChecker.java b/modules/test-utils/src/main/java/org/rhq/test/CollectionMatchesChecker.java
new file mode 100644
index 0000000..b4b5fcc
--- /dev/null
+++ b/modules/test-utils/src/main/java/org/rhq/test/CollectionMatchesChecker.java
@@ -0,0 +1,82 @@
+package org.rhq.test;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+public class CollectionMatchesChecker<T> {
+
+ private Collection<T> expected;
+
+ private Collection<T> actual;
+
+ public void setExpected(Collection<T> expected) {
+ this.expected = expected;
+ }
+
+ public void setActual(Collection<T> actual) {
+ this.actual = actual;
+ }
+
+ public MatchResult execute() {
+ boolean isMatch = true;
+ StringBuilder details = new StringBuilder();
+
+ if (expected.size() != actual.size()) {
+ isMatch = false;
+ details.append("Expected " + expected.size() + " elements but found " + actual.size() + " elements\n");
+ }
+
+ List<T> elementsThatShouldBePresent = findMissingElements(expected, actual);
+ if (!elementsThatShouldBePresent.isEmpty()) {
+ isMatch = false;
+ details.append("Expected to find the following elements:\n\t" +
+ toString(elementsThatShouldBePresent) + "\n\n");
+ }
+
+ List<T> elementsThatShouldNotBePresent = findMissingElements(actual, expected);
+ if (!elementsThatShouldNotBePresent.isEmpty()) {
+ isMatch = false;
+ details.append("Did not expect to find the following elements:\n\t" +
+ toString(elementsThatShouldNotBePresent) + "\n\n");
+ }
+
+ return new MatchResult(isMatch, details.toString());
+ }
+
+ private List<T> findMissingElements(Collection<T> elementsToSearchFor, Collection<T> elementsToSearch) {
+ List<T> missingElements = new ArrayList<T>();
+ for (T element : elementsToSearchFor) {
+ if (!containsMatch(elementsToSearch, element)) {
+ missingElements.add(element);
+ }
+ }
+ return missingElements;
+ }
+
+ private boolean containsMatch(Collection<T> elementsToSearch, T elementToSearchFor) {
+ for (T actual : elementsToSearch) {
+ PropertyMatcher<T> matcher = new PropertyMatcher<T>();
+ matcher.setExpected(elementToSearchFor);
+ matcher.setActual(actual);
+ MatchResult result = matcher.execute();
+
+ if (result.isMatch()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private String toString(List<T> list) {
+ StringBuilder buffer = new StringBuilder("[");
+ for (T element : list) {
+ buffer.append(element.toString() + ", ");
+ }
+ buffer.delete(buffer.length() - 2, buffer.length());
+ buffer.append("]");
+
+ return buffer.toString();
+ }
+
+}
commit 0ef2b576b995d39ecc31d6b84d52c9d57d9fa498
Author: John Sanda <jsanda(a)redhat.com>
Date: Fri Jul 1 12:01:32 2011 -0400
[BZ 713744] Fixing database deadlock happeing during plugin install/update
A few of the XXXMetadataManagerBean update methods were lacking,
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
which is needed precisely to avoid deadlock situations.
Conflicts:
modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/plugin_v1.xml
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ContentMetadataManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ContentMetadataManagerBean.java
index e4f0ef5..1831a3e 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ContentMetadataManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ContentMetadataManagerBean.java
@@ -8,6 +8,8 @@ import java.util.Set;
import javax.ejb.EJB;
import javax.ejb.Stateless;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
@@ -41,6 +43,7 @@ public class ContentMetadataManagerBean implements ContentMetadataManagerLocal {
private BundleManagerLocal bundleMgr;
@Override
+ @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void updateMetadata(ResourceType existingType, ResourceType newType) {
log.debug("Updating bundle type and package types for " + existingType);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/EventMetadataManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/EventMetadataManagerBean.java
index 9bcd283..b592715 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/EventMetadataManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/EventMetadataManagerBean.java
@@ -4,6 +4,8 @@ import java.util.Set;
import javax.ejb.EJB;
import javax.ejb.Stateless;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
@@ -27,9 +29,12 @@ public class EventMetadataManagerBean implements EventMetdataManagerLocal {
private EventManagerLocal eventMgr;
@Override
+ @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void updateMetadata(ResourceType existingType, ResourceType newType) {
log.debug("Updating event definitions for " + existingType);
+ existingType = entityMgr.find(ResourceType.class, existingType.getId());
+
Set<EventDefinition> newEventDefs = newType.getEventDefinitions();
// Loop over the newEventDefs and set the resourceTypeId, so equals() will work
for (EventDefinition def : newEventDefs) {
diff --git a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/plugin_v1.xml b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/plugin_v1.xml
index 944bd20..36eb2b5 100644
--- a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/plugin_v1.xml
+++ b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/plugin_v1.xml
@@ -51,6 +51,21 @@
</configuration>
</content>
+ <drift-configuration name="drift1">
+ <basedir>
+ <value-context>pluginConfiguration</value-context>
+ <value-name>connectionPropertyX</value-name>
+ </basedir>
+ </drift-configuration>
+
+<!-- THIS CAUSES A DEADLOCK DURING PLUGIN REGISTRATION! -->
+ <bundle-target>
+ <destination-base-dir name="bundleTarget1">
+ <value-context>pluginConfiguration</value-context>
+ <value-name>connectionPropertyY</value-name>
+ </destination-base-dir>
+ </bundle-target>
+
<service name="Child1" description="Child 1 description"/>
<service name="Child2" description="Child 2 description"/>
</server>
commit 5e5721eeb0f8a251badb6c896ee26b1fdd488182
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Jul 1 10:57:23 2011 -0400
temporarily set the timeouts for discovery-related RPC very high (to 1000000 millis) to make sure they can complete in the perf env and see what the timeouts ultimately need to be set to
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/AutodiscoveryQueueDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/AutodiscoveryQueueDataSource.java
index fa7a0f8..6769b9c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/AutodiscoveryQueueDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/AutodiscoveryQueueDataSource.java
@@ -65,7 +65,7 @@ public class AutodiscoveryQueueDataSource extends DataSource {
private int unlimited = -1;
private int maximumPlatformsToDisplay = -1;
- private ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();
+ private ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService(1000000);
private PermissionsLoader permissionsLoader = new PermissionsLoader();
private TreeGrid dataContainerReference = null;
private static final Permission MANAGE_INVENTORY = Permission.MANAGE_INVENTORY;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
index 6dde533..da3768c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
@@ -74,7 +74,7 @@ public class ResourceAutodiscoveryView extends LocatableVLayout {
private ToolStrip footer;
private DataSource dataSource;
- private ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService(60000);
+ private ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService(1000000);
public ResourceAutodiscoveryView(String locatorId) {
super(locatorId);
commit 5ed2f29d30db493e579cd66e5a0c95c172357935
Merge: d6aa392 449b21b
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Jun 30 09:50:12 2011 +0200
Merge branch 'master' into as7plugin
commit 449b21b7bc705f458c6412f76ae02b06023e2c9e
Merge: f67bd01 26c6ae2
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Jun 30 09:34:48 2011 +0200
Merge branch 'dependent-values'
commit 26c6ae2e65c7493dd38d91e79eff20a32bffa0d4
Merge: 9687460 04f6861
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Jun 30 09:22:01 2011 +0200
Merge branch 'dependent-values' of ssh://git.fedorahosted.org/git/rhq/rhq into dependent-values
Conflicts:
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
commit 9687460e768d07c9ca16c28c950245cb3af84649
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Jun 30 09:15:02 2011 +0200
Use the name as value and not the id.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index 8463123..e872a80 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -2438,7 +2438,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
if (tt== PropertyOptionsSource.TargetType.RESOURCE) {
- PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(composite.getResource().getName(),""+composite.getResource().getId());
+ PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(composite.getResource().getName(),""+composite.getResource().getName());
// TODO filter -- or leave up to search expression??
pds.getEnumeratedValues().add(pde);
}
commit 4e9188a94bb4839bc58efb1be8c30ee64eb09005
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Jun 28 13:51:40 2011 +0200
First cut at handling target=configuration and using DV in the resource config editor.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
index 2df653a..8f1a058 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
@@ -30,6 +30,7 @@ import com.smartgwt.client.widgets.toolbar.ToolStrip;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.composite.ResourceComposite;
@@ -40,6 +41,7 @@ import org.rhq.enterprise.gui.coregui.client.RefreshableView;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeEvent;
import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeListener;
+import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceDetailView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
@@ -127,19 +129,31 @@ public class ResourceConfigurationEditView extends LocatableVLayout implements P
@Override
public void onTypesLoaded(ResourceType type) {
- editor = new ConfigurationEditor(extendLocatorId("Editor"), type
- .getResourceConfigurationDefinition(), result.getConfiguration());
- editor.setOverflow(Overflow.AUTO);
- editor.addPropertyValueChangeListener(ResourceConfigurationEditView.this);
- editor.setReadOnly(!resourcePermission.isConfigureWrite());
- addMember(editor);
-
- saveButton.disable();
- buttonbar.setVisible(true);
- markForRedraw();
- refreshing = false;
+ ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService();
+ configurationService.getOptionValuesForConfigDefinition(type.getResourceConfigurationDefinition(),new AsyncCallback<ConfigurationDefinition>(){
+ @Override
+ public void onFailure(Throwable throwable) {
+ refreshing = false;
+ CoreGUI.getErrorHandler().handleError("Failed to load configuration.", throwable);
+ }
+
+ @Override
+ public void onSuccess(ConfigurationDefinition configurationDefinition) {
+
+ editor = new ConfigurationEditor(extendLocatorId("Editor"), configurationDefinition, result.getConfiguration());
+ editor.setOverflow(Overflow.AUTO);
+ editor.addPropertyValueChangeListener(ResourceConfigurationEditView.this);
+ editor.setReadOnly(!resourcePermission.isConfigureWrite());
+ addMember(editor);
+
+ saveButton.disable();
+ buttonbar.setVisible(true);
+ markForRedraw();
+ refreshing = false;
+ }
+ });
}
- });
+ });
}
@Override
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index f810129..8463123 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -59,6 +59,9 @@ import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
import org.rhq.core.domain.configuration.PluginConfigurationUpdate;
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.RawConfiguration;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
import org.rhq.core.domain.configuration.composite.ConfigurationUpdateComposite;
@@ -77,6 +80,7 @@ import org.rhq.core.domain.criteria.GroupResourceConfigurationUpdateCriteria;
import org.rhq.core.domain.criteria.PluginConfigurationUpdateCriteria;
import org.rhq.core.domain.criteria.ResourceConfigurationUpdateCriteria;
import org.rhq.core.domain.criteria.ResourceCriteria;
+import org.rhq.core.domain.criteria.ResourceGroupCriteria;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.resource.Agent;
import org.rhq.core.domain.resource.Resource;
@@ -87,8 +91,6 @@ import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.resource.group.GroupCategory;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
-import org.rhq.core.domain.search.SearchSubsystem;
-import org.rhq.core.domain.search.SearchSuggestion;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
@@ -118,7 +120,6 @@ import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
import org.rhq.enterprise.server.resource.group.ResourceGroupNotFoundException;
import org.rhq.enterprise.server.resource.group.ResourceGroupUpdateException;
import org.rhq.enterprise.server.scheduler.SchedulerLocal;
-import org.rhq.enterprise.server.search.execution.SearchAssistManager;
import org.rhq.enterprise.server.system.ServerVersion;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
@@ -2412,21 +2413,136 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
if (pds.getOptionsSource()!=null) {
// evaluate the source parameters
PropertyOptionsSource pos = pds.getOptionsSource();
- ResourceCriteria criteria = new ResourceCriteria();
- criteria.setSearchExpression(pos.getExpression());
- // TODO for groups we need to talk to the group manager
- List<ResourceComposite> composites = resourceManager.findResourceCompositesByCriteria(subject,criteria);
- for (ResourceComposite composite : composites) {
+ PropertyOptionsSource.TargetType tt = pos.getTargetType();
+ String expression = pos.getExpression();
+ if (tt== PropertyOptionsSource.TargetType.RESOURCE || tt== PropertyOptionsSource.TargetType.CONFIGURATION) {
+ ResourceCriteria criteria = new ResourceCriteria();
+
+
+ if (tt==PropertyOptionsSource.TargetType.CONFIGURATION) {
+ // split out expression part for target=configuration
+ // return if no property specifier is given
+ String expr = expression;
+ if (!expr.contains(":")) {
+ log.warn("Option source expression for property " + pds.getName() + " and target configuration contains no ':'");
+ return;
+ }
+ }
+ else {
+ criteria.setSearchExpression(expression);
+ }
+
+
+ List<ResourceComposite> composites = resourceManager.findResourceCompositesByCriteria(subject,criteria);
+ for (ResourceComposite composite : composites) {
+
+ if (tt== PropertyOptionsSource.TargetType.RESOURCE) {
+
+ PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(composite.getResource().getName(),""+composite.getResource().getId());
+ // TODO filter -- or leave up to search expression??
+ pds.getEnumeratedValues().add(pde);
+ }
+ else if (tt== PropertyOptionsSource.TargetType.CONFIGURATION) {
+ // for configuration we need to drill down into the resource configuration
+ if (!handleConfigurationTarget(pds, expression, composite.getResource())) return;
+
+ }
+ }
+ }
+ else if (tt == PropertyOptionsSource.TargetType.GROUP) {
+ // for groups we need to talk to the group manager
+ ResourceGroupCriteria criteria = new ResourceGroupCriteria();
+ criteria.setSearchExpression(expression);
+
+ resourceGroupManager.findResourceGroupCompositesByCriteria(subject,criteria);
+ }
+ // TODO plugin and resourceType
+ }
- // TODO for configuration we need to drill down into the resource configuration
- PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(composite.getResource().getName(),""+composite.getResource().getId());
+ }
- // TODO filter -- or leave up to search expression??
+ /**
+ * Drill down in the case the user set up a target of "configuration". We need to check
+ * that the target property actually exiists and that it has a format we understand
+ * @param pds Propertydefinition to examine
+ * @param expression The whole expression starting with identifier: for the configuration
+ * identifier. This looks like <i>listname</i> for list of
+ * property simple or <i>mapname=mapkey</i> for a map with simple properties
+ * @param resource the
+ * @return false if the property can not be resolved, true otherwise
+ */
+ private boolean handleConfigurationTarget(PropertyDefinitionSimple pds, String expression,
+ Resource resource) {
+ Configuration configuration = resource.getResourceConfiguration();
+ Property p;
+ String propName = expression.substring(0, expression.indexOf(":"));
+ boolean isMap = expression.contains("=");
+
+ if (isMap) {
+ String mapPropName = propName.substring(0, propName.indexOf("="));
+ p = configuration.get(mapPropName);
+ } else
+ p = configuration.get(propName);
+
+ if (p == null) {
+ log.warn("Option source expression for property " + pds.getName() + " and target configuration not found");
+ return false;
+ }
+ if (!(p instanceof PropertyList)) {
+ log.warn("Option source expression for property " + pds.getName() + " and target configuration does not point to a list");
+ return false;
+ }
+ PropertyList pl = (PropertyList) p;
+ List<Property> propertyList = pl.getList();
+ if (propertyList.size()==0)
+ return false;
+
+ // Now List of simple or list of maps (of simple) ?
+
+ if (propertyList.get(0) instanceof PropertySimple) {
+ if (isMap) {
+ log.warn(" expected a List of Maps, but got a list of simple");
+ return false;
+ }
- pds.getEnumeratedValues().add(pde);
+ for (Property tmp : propertyList) {
+ PropertySimple ps= (PropertySimple) tmp;
+ String name = ps.getStringValue();
+ if (name!=null) {
+ PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(name, name);
+ pds.getEnumeratedValues().add(pde);
+ }
+ }
+ } else if (propertyList.get(0) instanceof PropertyMap) {
+ if (!isMap) {
+ log.warn(" expected a List of simple, but got a list of Maps");
+ return false;
+ }
+ String subPropName ;
+ subPropName = propName.substring(propName.indexOf("=") + 1);
+
+ for (Property tmp : propertyList) {
+ PropertyMap pm = (PropertyMap) tmp;
+ Property ps = pm.get(subPropName);
+ if (ps==null) {
+ log.warn("Option source expression for property " + pds.getName() + " and target configuration does not have a map element " + subPropName);
+ return false;
+ }
+ if (!(ps instanceof PropertySimple)) {
+ log.warn("ListOfMapOf!Simple are not supported");
+ return false;
+ }
+ PropertySimple propertySimple = (PropertySimple) ps;
+ String name = propertySimple.getStringValue();
+ if (name!=null) {
+ PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(name, name);
+ pds.getEnumeratedValues().add(pde);
+ }
}
}
+
+ return true;
}
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
commit 9a60502fbe010972f9becd9474a1aa5a9fb69cbb
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Mon Jun 27 21:53:06 2011 +0200
Prevent a possible NPE later on if value is null.
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ObjectUtil.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ObjectUtil.java
index a6f76b8..0592390 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ObjectUtil.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ObjectUtil.java
@@ -145,6 +145,10 @@ public class ObjectUtil {
* @return the value read from the object's property path
*/
public static Object lookupDeepAttributeProperty(Object value, String propertyPath) {
+
+ if (value==null)
+ return null;
+
String[] ps = propertyPath.split("\\.", 2);
String searchProperty = ps[0];
@@ -181,4 +185,4 @@ public class ObjectUtil {
// Prevent instantiation of this class.
private ObjectUtil() {
}
- }
\ No newline at end of file
+ }
commit d6aa39205a8b3cd0da96237d9b9dfbb54e1d5687
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Jun 29 22:36:14 2011 +0200
Fix detection of mod_cluster subsystem.
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 41c5c58..870ad38 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
@@ -177,28 +177,6 @@
<c:simple-property name="path" default="profile" readOnly="true"/>
</plugin-configuration>
- <service name="ModCluster"
- class="BaseComponent"
- discovery="SubsystemDiscovery"
- description="Mod_cluster support">
-
- <plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="subsystem=modcluster"/>
- </plugin-configuration>
-
- <operation name="list-proxies" description="Read the list of httpd contected to the nodes.">
- </operation>
-
- <operation name="validate-address" description="Read the list of httpd contected to the nodes.">
- </operation>
-
- <resource-configuration>
- <c:simple-property name="advertise-socket" displayName="Advertise Socket" type="string">
- <c:option-source target="configuration" expression="socket-binding=name:type=SocketBindingGroup"/>
- </c:simple-property>
- </resource-configuration>
- </service>
-
</server>
<server name="ServerGroup"
@@ -1376,6 +1354,36 @@ working area for individual server instances</li></ul>"/>
</service>
</server>
+ <server name="ModCluster"
+ class="BaseComponent"
+ discovery="SubsystemDiscovery"
+ description="Mod_cluster support"
+ singleton="true"
+ >
+
+ <runs-inside>
+ <parent-resource-type name="Profile" plugin="jboss-as-7"/>
+ <parent-resource-type name="JBossAS7-Standalone" plugin="jboss-as-7"/> <!-- FAKE as "runs inside Profile" only does not work -->
+ </runs-inside>
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="subsystem=modcluster"/>
+ </plugin-configuration>
+
+ <operation name="list-proxies" description="Read the list of httpd connected to the nodes.">
+ </operation>
+
+ <operation name="validate-address" >
+ </operation>
+
+ <resource-configuration>
+ <c:simple-property name="advertise-socket" displayName="Advertise Socket" type="string">
+ <c:option-source target="configuration" expression="socket-binding=name:type=SocketBindingGroup"/>
+ </c:simple-property>
+ </resource-configuration>
+ </server>
+
+
<service name="NetworkInterface"
discovery="SubsystemDiscovery"
class="BaseComponent"
commit 403973e67dae1cfd79a6591c815f7715a38c4537
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Jun 29 22:01:09 2011 +0200
Change upload code because of a bug in the server (AS7-1145), add a property to enable json logging.
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
index f2bb47f..d89f4c4 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
@@ -43,21 +43,27 @@ import org.rhq.modules.plugins.jbossas7.json.Result;
*/
public class ASConnection {
+ public static final String MANAGEMENT = "/management";
+// public static final String MANAGEMENT = "/domain-api"; // Old one - leave it here for the moment for tests.
private final Log log = LogFactory.getLog(ASConnection.class);
URL url;
String urlString;
private ObjectMapper mapper;
- boolean verbose = true; // This is a variable on purpose, so devs can switch it on in the debugger
+ public static boolean verbose = false; // This is a variable on purpose, so devs can switch it on in the debugger or in the agent
public ASConnection(String host, int port) {
try {
- url = new URL("http",host,port,"/management");
+ url = new URL("http",host,port, MANAGEMENT);
urlString = url.toString();
+
} catch (MalformedURLException e) {
throw new IllegalArgumentException(e.getMessage());
}
+ // read system property "as7plugin.verbose"
+ verbose = Boolean.getBoolean("as7plugin.verbose");
+
mapper = new ObjectMapper();
}
@@ -107,8 +113,7 @@ public class ASConnection {
String result = mapper.writeValueAsString(operation);
if (verbose) {
- System.out.println("Json to send: " + result);
- System.out.flush();
+ log.info("Json to send: " + result);
}
mapper.writeValue(out, operation);
@@ -141,8 +146,7 @@ public class ASConnection {
ObjectMapper om2 = new ObjectMapper();
om2.configure(SerializationConfig.Feature.INDENT_OUTPUT, true);
String tmp = om2.writeValueAsString(operationResult);
- System.out.println(tmp);
- System.out.flush();
+ log.info(tmp);
}
}
else {
@@ -156,8 +160,6 @@ public class ASConnection {
}
else {
log.error("IS was null and code was " + responseCode);
- if (verbose)
- System.err.println("IS was null and code was " + responseCode);
}
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java
index d876c80..3ab7c3c 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java
@@ -51,7 +51,7 @@ public class ASUploadConnection {
private static final String POST_REQUEST_METHOD = "POST";
- private static final String UPLOAD_URL_PATH = "/management/add-content";
+ private static final String UPLOAD_URL_PATH = ASConnection.MANAGEMENT + "/add-content";
private final Log log = LogFactory.getLog(ASUploadConnection.class);
@@ -96,7 +96,7 @@ public class ASUploadConnection {
os.flush();
int code = connection.getResponseCode();
- System.err.println("Response code " + code);
+ log.info("Response code for file upload: " + code);
if (code==500)
is = connection.getErrorStream();
else
@@ -116,10 +116,10 @@ public class ASUploadConnection {
if (s!=null)
tree = mapper.readTree(s);
else
- System.out.println("- no result received from InputStream -");
+ log.warn("- no result received from InputStream -");
}
else
- System.out.println("- no InputStream available -");
+ log.warn("- no InputStream available -");
} catch (IOException e) {
e.printStackTrace(); // TODO: Customise this generated block
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
index a51a96a..2ac49d0 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
@@ -80,6 +80,7 @@ public class BaseComponent implements ResourceComponent, MeasurementFacet, Confi
String key;
String host;
int port;
+ private boolean verbose = ASConnection.verbose;
/**
* Return availability of this resource
@@ -305,7 +306,9 @@ public class BaseComponent implements ResourceComponent, MeasurementFacet, Confi
contentServices.downloadPackageBitsForChildResource(cctx, resourceTypeName, details.getKey(), out);
JsonNode uploadResult = uploadConnection.finishUpload();
- System.out.println(uploadResult);
+ if (verbose)
+ log.info(uploadResult);
+
if (ASConnection.isErrorReply(uploadResult)) {
report.setStatus(CreateResourceStatus.FAILURE);
report.setErrorMessage(ASConnection.getFailureDescription(uploadResult));
@@ -319,7 +322,8 @@ public class BaseComponent implements ResourceComponent, MeasurementFacet, Confi
fileName=fileName.substring("C:\\fakepath\\".length());
}
- log.info("Deploying [" + fileName + "] ...");
+ boolean toServerGroup = context.getResourceKey().contains("server-group=");
+ log.info("Deploying [" + fileName + "] to domain only= " + !toServerGroup + " ...");
String tmpName = fileName; // TODO figure out the tmp-name biz with the AS guys
@@ -338,15 +342,22 @@ public class BaseComponent implements ResourceComponent, MeasurementFacet, Confi
step1.addAdditionalProperty("name", tmpName);
step1.addAdditionalProperty("runtime-name", fileName);
- CompositeOperation cop = new CompositeOperation();
- cop.addStep(step1);
String resourceKey;
-
+ JsonNode result ;
/*
* We need to check here if this is an upload to /deployment only
* or if this should be deployed to a server group too
*/
- if (context.getResourceKey().contains("server-group=")) {
+
+ if (!toServerGroup) {
+
+ result = connection.executeRaw(step1);
+ resourceKey = addressToPath(step1.getAddress());
+
+ }
+ else {
+ CompositeOperation cop = new CompositeOperation();
+ cop.addStep(step1);
List<PROPERTY_VALUE> serverGroupAddress = new ArrayList<PROPERTY_VALUE>();
serverGroupAddress.addAll(pathToAddress(context.getResourceKey()));
@@ -359,19 +370,13 @@ public class BaseComponent implements ResourceComponent, MeasurementFacet, Confi
cop.addStep(step3);
resourceKey = addressToPath(serverGroupAddress);
- }
- else {
-/*
- List<PROPERTY_VALUE> address = step1.getAddress();
- Operation step3 = new Operation("deploy",address);
- cop.addStep(step3);
-*/
+ if (verbose)
+ log.info("Deploy operation: " + cop);
- resourceKey = addressToPath(step1.getAddress());
+ result = connection.executeRaw(cop);
}
- JsonNode result = connection.executeRaw(cop);
if (ASConnection.isErrorReply(result)) {
String failureDescription = ASConnection.getFailureDescription(result);
report.setErrorMessage(failureDescription);
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASDiscovery.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASDiscovery.java
index 3f57a06..3946dbe 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASDiscovery.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASDiscovery.java
@@ -98,6 +98,9 @@ public class ManagedASDiscovery extends AbstractBaseDiscovery
}
config.put(new PropertySimple("socket-binding-port-offset",serverInfo.portOffset));
+ String path = "host=" + hostName + ",server-config=" + serverInfo.name;
+ config.put(new PropertySimple("path",path));
+
// TODO this fails for the downed servers.
@@ -241,6 +244,14 @@ public class ManagedASDiscovery extends AbstractBaseDiscovery
boolean autoStart;
int portOffset;
String bindingGroup;
+
+ @Override
+ public String toString() {
+ return "ServerInfo{" +
+ "name='" + name + '\'' +
+ ", group='" + group + '\'' +
+ '}';
+ }
}
}
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SubsystemDiscovery.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SubsystemDiscovery.java
index a3ab676..60fc615 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SubsystemDiscovery.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/SubsystemDiscovery.java
@@ -101,7 +101,8 @@ public class SubsystemDiscovery implements ResourceDiscoveryComponent<BaseCompon
if (cpath.contains("="))
path += "," + cpath;
- System.out.println("total path: [" + path + "]");
+ if (Boolean.getBoolean("as7plugin.verbose"))
+ log.info("total path: [" + path + "]");
JsonNode json ;
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 76d1bcf..41c5c58 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
@@ -169,14 +169,38 @@
<server name="Profile"
- description="One profile in a domain"
+ description="One profile in a domain. Profiles are assigned to server groups."
discovery="SubsystemDiscovery"
class="BaseComponent">
<plugin-configuration>
<c:simple-property name="path" default="profile" readOnly="true"/>
</plugin-configuration>
+
+ <service name="ModCluster"
+ class="BaseComponent"
+ discovery="SubsystemDiscovery"
+ description="Mod_cluster support">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="subsystem=modcluster"/>
+ </plugin-configuration>
+
+ <operation name="list-proxies" description="Read the list of httpd contected to the nodes.">
+ </operation>
+
+ <operation name="validate-address" description="Read the list of httpd contected to the nodes.">
+ </operation>
+
+ <resource-configuration>
+ <c:simple-property name="advertise-socket" displayName="Advertise Socket" type="string">
+ <c:option-source target="configuration" expression="socket-binding=name:type=SocketBindingGroup"/>
+ </c:simple-property>
+ </resource-configuration>
+ </service>
+
</server>
+
<server name="ServerGroup"
description="Server groups on this domain"
discovery="SubsystemDiscovery"
@@ -190,8 +214,12 @@
<resource-configuration>
- <c:simple-property name="profile" />
- <c:simple-property name="socket-binding-group"/>
+ <c:simple-property name="profile" description="The profile name" required="true"/>
+ <c:simple-property name="socket-binding-group" readOnly="false" required="true">
+ <c:option-source target="resource" expression="type=SocketBindingGroup"/>
+ </c:simple-property>
+ <c:simple-property name="socket-binding-port-offset" required="false" defaultValue="0" type="integer"
+ description="The default offset to be added to the port values given by the socket binding group."/>
<c:simple-property name="jvm" required="false"/>
</resource-configuration>
@@ -236,7 +264,9 @@
<operation name="domain-deployment:promote" displayName="Deploy to Server-Group" description="Deploy this deployment to a server group">
<parameters>
- <c:simple-property name="server-group" required="true" description="Server group to deploy to" type="string"/>
+ <c:simple-property name="server-group" required="true" description="Server group to deploy to" type="string">
+ <c:option-source target="resource" expression="type=ServerGroup" />
+ </c:simple-property>
<c:simple-property name="enabled" required="true" default="true" description="Should the deployment be enabled on the server group?" type="boolean"/>
</parameters>
<results>
@@ -327,6 +357,7 @@
<c:simple-property name="group" readOnly="true" displayName="Server Group" description="Server Group this instance belongs to."/>
<c:simple-property name="socket-binding-group" readOnly="true" displayName="Socket binding group" description="Socket bindngs to use"/>
<c:simple-property name="socket-binding-port-offset" readOnly="true" displayName="Port Offset" type="integer" default="0" description="Offset to the base ports"/>
+ <c:simple-property name="path" readOnly="true" />
&logSources;
</plugin-configuration>
@@ -351,7 +382,8 @@
</results>
</operation>
-
+ <metric property="status" dataType="trait" displayName="Server state" description="Detailed server state"
+ displayType="summary"/>
</server>
@@ -1387,8 +1419,8 @@ working area for individual server instances</li></ul>"/>
<c:simple-property name="interface" description="Name of the interface to which the socket should be bound, or, for multicast sockets, the interface on which it should listen. This should be one of the declared interfaces." required="false"/>
<c:simple-property name="port" description="Number of the port to which the socket should be bound." type="integer"/>
<c:simple-property name="fixed-port" description="Whether the port value should remain fixed even if numeric offsets are applied to the other sockets in the socket group." type="boolean"/>
- <c:simple-property name="multicast-address" description="Multicast address on which the socket should receive multicast traffic. If unspecified, the socket will not be configured to receive multicast." />
- <c:simple-property name="multicast-port" description="Port on which the socket should receive multicast traffic. Must be configured if 'multicast-address' is configured." type="integer"/>
+ <c:simple-property name="multicast-address" description="Multicast address on which the socket should receive multicast traffic. If unspecified, the socket will not be configured to receive multicast." required="false"/>
+ <c:simple-property name="multicast-port" description="Port on which the socket should receive multicast traffic. Must be configured if 'multicast-address' is configured." type="integer" required="false"/>
</c:map-property>
</c:list-property>
</resource-configuration>
@@ -1420,5 +1452,4 @@ working area for individual server instances</li></ul>"/>
</service>
-
</plugin>
diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java
index b0d68ee..e18193d 100644
--- a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java
+++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java
@@ -41,7 +41,7 @@ import org.rhq.modules.plugins.jbossas7.json.Result;
* the UPLOAD_FILE must point to a valid archive in the resources directory.
* @author Heiko W. Rupp
*/
-@Test(enabled = true) // TODO add an "integration test profile" that is able to fire the server before running the test
+@Test(enabled = UploadAndDeployTest.isEnabled) // TODO add an "integration test profile" that is able to fire the server before running the test
public class UploadAndDeployTest {
static final String TEST_WAR = "test.war";
@@ -49,8 +49,10 @@ public class UploadAndDeployTest {
private static final String DC_HOST = "localhost";
private static final int DC_HTTP_PORT = 9990;
+ protected static final boolean isEnabled = false;
- @Test(timeOut = 60*1000L, enabled=true)
+
+ @Test(timeOut = 60*1000L, enabled=isEnabled)
public void testUploadOnly() throws Exception {
String bytes_value = prepare();
@@ -62,7 +64,7 @@ public class UploadAndDeployTest {
}
- @Test(timeOut = 60*1000L, enabled=true)
+ @Test(timeOut = 60*1000L, enabled=isEnabled)
public void testDoubleUploadOnly() throws Exception {
String bytes_value = prepare();
@@ -75,7 +77,7 @@ public class UploadAndDeployTest {
assert bytes_value.equals("7jgpMVmynfxpqp8UDleKLmtgbrA=");
}
- @Test(timeOut = 60*1000L,enabled=true)
+ @Test(timeOut = 60*1000L,enabled=isEnabled)
public void testUploadIndividualSteps() throws Exception {
String bytes_value = prepare();
@@ -155,7 +157,7 @@ public class UploadAndDeployTest {
}
// Test for AS7-853
- @Test(timeOut = 60*1000L,enabled = true)
+ @Test(timeOut = 60*1000L,enabled = isEnabled)
public void testUploadIndividualSteps2() throws Exception {
String bytes_value = prepare();
@@ -229,7 +231,7 @@ public class UploadAndDeployTest {
}
- @Test(timeOut = 60*1000L,enabled = true)
+ @Test(timeOut = 60*1000L,enabled = isEnabled)
public void testUploadComposite() throws Exception {
String bytes_value = prepare();
@@ -295,7 +297,7 @@ public class UploadAndDeployTest {
* Test uploading to domain only, but not to a server group
* @throws Exception
*/
- @Test(timeOut = 60*1000L,enabled = true)
+ @Test(timeOut = 60*1000L,enabled = isEnabled)
public void testUploadComposite2() throws Exception {
String bytes_value = prepare();
commit ee7349dd14ba42c4364b2264d7a8da1e6dfed9d9
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Jun 29 15:18:52 2011 +0200
Add a test for a composite operation with only one member operation (i.e. deploy to domain only)
diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java
index dfa9fd9..b0d68ee 100644
--- a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java
+++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/UploadAndDeployTest.java
@@ -41,7 +41,7 @@ import org.rhq.modules.plugins.jbossas7.json.Result;
* the UPLOAD_FILE must point to a valid archive in the resources directory.
* @author Heiko W. Rupp
*/
-@Test(enabled = false) // TODO add an "integration test profile" that is able to fire the server before running the test
+@Test(enabled = true) // TODO add an "integration test profile" that is able to fire the server before running the test
public class UploadAndDeployTest {
static final String TEST_WAR = "test.war";
@@ -49,7 +49,8 @@ public class UploadAndDeployTest {
private static final String DC_HOST = "localhost";
private static final int DC_HTTP_PORT = 9990;
- @Test(timeOut = 60*1000L, enabled=false)
+
+ @Test(timeOut = 60*1000L, enabled=true)
public void testUploadOnly() throws Exception {
String bytes_value = prepare();
@@ -61,7 +62,7 @@ public class UploadAndDeployTest {
}
- @Test(timeOut = 60*1000L, enabled=false)
+ @Test(timeOut = 60*1000L, enabled=true)
public void testDoubleUploadOnly() throws Exception {
String bytes_value = prepare();
@@ -74,7 +75,7 @@ public class UploadAndDeployTest {
assert bytes_value.equals("7jgpMVmynfxpqp8UDleKLmtgbrA=");
}
- @Test(timeOut = 60*1000L,enabled=false)
+ @Test(timeOut = 60*1000L,enabled=true)
public void testUploadIndividualSteps() throws Exception {
String bytes_value = prepare();
@@ -154,7 +155,7 @@ public class UploadAndDeployTest {
}
// Test for AS7-853
- @Test(timeOut = 60*1000L,enabled = false)
+ @Test(timeOut = 60*1000L,enabled = true)
public void testUploadIndividualSteps2() throws Exception {
String bytes_value = prepare();
@@ -228,7 +229,7 @@ public class UploadAndDeployTest {
}
- @Test(timeOut = 60*1000L,enabled = false)
+ @Test(timeOut = 60*1000L,enabled = true)
public void testUploadComposite() throws Exception {
String bytes_value = prepare();
@@ -290,6 +291,62 @@ public class UploadAndDeployTest {
}
+ /**
+ * Test uploading to domain only, but not to a server group
+ * @throws Exception
+ */
+ @Test(timeOut = 60*1000L,enabled = true)
+ public void testUploadComposite2() throws Exception {
+
+ String bytes_value = prepare();
+
+ System.out.println("Prepare done");
+ System.out.flush();
+
+ List<PROPERTY_VALUE> deploymentsAddress = new ArrayList<PROPERTY_VALUE>(1);
+ deploymentsAddress.add(new PROPERTY_VALUE("deployment", TEST_WAR));
+ Operation step1 = new Operation("add",deploymentsAddress);
+ List<Object> content = new ArrayList<Object>(1);
+ Map<String,Object> contentValues = new HashMap<String,Object>();
+ contentValues.put("hash",new PROPERTY_VALUE("BYTES_VALUE",bytes_value));
+ content.add(contentValues);
+ step1.addAdditionalProperty("content", content);
+ step1.addAdditionalProperty("name", TEST_WAR); // this needs to be unique per upload
+
+
+ CompositeOperation cop = new CompositeOperation();
+ cop.addStep(step1);
+
+
+ ASConnection connection = new ASConnection(DC_HOST, DC_HTTP_PORT);
+ JsonNode ret = connection.executeRaw(cop);
+ System.out.println(ret);
+ System.out.flush();
+
+ assert ret.has("outcome") : "Ret not valid " + ret.toString();
+ assert ret.get("outcome").getTextValue().equals("success") : "Composite deploy was no success " + ret.getTextValue();
+
+ // Wait for AS to settle
+ Thread.sleep(1000);
+
+
+ // Now undeploy again to clean up
+
+ cop = new CompositeOperation();
+ Operation step4 = new Operation("remove",deploymentsAddress);
+
+ cop.addStep(step4);
+ ret = connection.executeRaw(cop);
+
+ System.out.println(ret);
+ System.out.flush();
+
+ assert ret.has("outcome") : "Ret not valid " + ret.toString();
+ assert ret.get("outcome").getTextValue().equals("success") : "Composite remove was no success " + ret.getTextValue();
+
+
+ }
+
private String prepare() throws IOException {
ASUploadConnection conn = new ASUploadConnection(DC_HOST, DC_HTTP_PORT);
OutputStream os = conn.getOutputStream("test.war");
commit f67bd011101a1b463108fb8a79348eafc118b474
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Tue Jun 28 17:40:42 2011 -0400
make sure the Build-Number and Build-Time Manifest attributes always get set
to valid values, even for SNAPSHOT builds; however, if the project dir is not a
git working dir or the git executable is not available on the PATH, the
Build-Number attribute will not get set to a valid value, but the build should
not fail
diff --git a/pom.xml b/pom.xml
index 719a827..3c8cc4c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -607,7 +607,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
- <version>1.0-beta-4</version>
+ <version>1.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
@@ -842,6 +842,113 @@
</configuration>
</plugin>
+ <!-- As of v1.0 of the buildnumber plugin, the create goal doesn't work,
+ and the create-timestamp goal doesn't provide a way to specify
+ a locale or a timezone, so comment this out for now and instead use
+ our own homemade mix of antrun and properties-file plugin executions
+ (just below this commented out block). (ips, 06/28/11)
+ -->
+ <!--
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>buildnumber-maven-plugin</artifactId>
+ <executions>
+
+ <execution>
+ <id>setBuildNumber</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>create</goal>
+ </goals>
+ <configuration>
+ <useLastCommittedRevision>true</useLastCommittedRevision>
+ <getRevisionOnlyOnce>true</getRevisionOnlyOnce>
+ <revisionOnScmFailure></revisionOnScmFailure>
+ <doCheck>false</doCheck>
+ <doUpdate>false</doUpdate>
+ </configuration>
+ </execution>
+
+ <execution>
+ <id>setBuildTime</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>create-timestamp</goal>
+ </goals>
+ <configuration>
+ <timestampFormat>MM/dd/yy hh:mm aa z</timestampFormat>
+ <timestampPropertyName>buildTime</timestampPropertyName>
+ </configuration>
+ </execution>
+
+ </executions>
+ </plugin>
+ -->
+
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>write-build-properties-file</id>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <phase>generate-sources</phase>
+ <configuration>
+ <tasks>
+ <mkdir dir="target" />
+
+ <tstamp>
+ <format property="buildTime" pattern="MM/dd/yy hh:mm aa z" locale="en,US" timezone="GMT" />
+ </tstamp>
+ <echo file="target/build.properties">buildTime = ${buildTime}${line.separator}</echo>
+
+ <exec executable="git" outputproperty="buildNumber" failonerror="false" failifexecutionfails="false">
+ <arg value="log"/>
+ <arg value="--pretty=format:%h"/>
+ <arg value="-n1"/>
+ </exec>
+ <echo file="target/build.properties" append="true">buildNumber = ${buildNumber}${line.separator}</echo>
+ </tasks>
+ </configuration>
+ </execution>
+
+ <execution>
+ <id>echo-build-properties</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <echo level="debug">buildTime = ${buildTime}</echo>
+ <echo level="debug">buildNumber = ${buildNumber}</echo>
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>properties-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>read-build-properties-file</id>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>read-project-properties</goal>
+ </goals>
+ <configuration>
+ <files>
+ <file>${project.build.directory}/build.properties</file>
+ </files>
+ <quiet>true</quiet>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
</plugins>
</build>
@@ -990,7 +1097,9 @@
</properties>
</profile>
- <!-- Set the java6.home prop to a Java6 JRE dir to enforce that only Java6 APIs are used. -->
+ <!-- Set the java6.home prop to a Java6 JRE dir to enforce that only Java6 APIs are used.
+ If using Java7 to run the build, this will ensure no APIs introduced in Java7 are
+ used. -->
<profile>
<id>check-java-api</id>
<activation>
@@ -1031,133 +1140,6 @@
</build>
</profile>
- <!-- Use buildnumber plugin only if SVN metadata is present. -->
- <profile>
- <id>build-number-generation</id>
- <activation>
- <file>
- <exists>.svn</exists>
- </file>
- </activation>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>buildnumber-maven-plugin</artifactId>
- <executions>
- <execution>
- <phase>validate</phase>
- <goals>
- <goal>create</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <getRevisionOnlyOnce>true</getRevisionOnlyOnce>
- <revisionOnScmFailure>0</revisionOnScmFailure>
- <doCheck>false</doCheck>
- <doUpdate>false</doUpdate>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <profile>
- <id>build-properties</id>
- <activation>
- <file>
- <exists>.git</exists>
- </file>
- </activation>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>write-build-time-properties-file</id>
- <goals>
- <goal>run</goal>
- </goals>
- <phase>generate-sources</phase>
- <configuration>
- <tasks>
- <tstamp>
- <format property="buildTime" pattern="MM/dd/yy hh:mm aa z" locale="en,US" timezone="GMT" />
- </tstamp>
- <mkdir dir="target" />
- <echo file="target/build-time.properties" level="error">buildTime = ${buildTime}
- </echo>
- </tasks>
- </configuration>
- </execution>
-
- <execution>
- <id>echo-build-properties</id>
- <phase>compile</phase>
- <inherited>false</inherited>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <echo level="debug">buildTime = ${buildTime}</echo>
- <echo level="debug">buildNumber = ${buildNumber}</echo>
- </tasks>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>exec-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>generate-build-number-properties</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>exec</goal>
- </goals>
- <configuration>
- <executable>git</executable>
- <arguments>
- <argument>log</argument>
- <argument>--pretty=format:buildNumber = %h</argument>
- <argument>-n1</argument>
- </arguments>
- <outputFile>${project.build.directory}/build-number.properties</outputFile>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>properties-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>read-build-properties</id>
- <phase>process-sources</phase>
- <goals>
- <goal>read-project-properties</goal>
- </goals>
- <configuration>
- <files>
- <file>${project.build.directory}/build-time.properties</file>
- <file>${project.build.directory}/build-number.properties</file>
- </files>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
-
<!-- This profile should be enabled when a release is being published.
It will ensure that sources and javadoc jars are built and published
for each source module. -->
@@ -1262,7 +1244,7 @@
<licenses>
<license>
<name>GPL</name>
- <url>http://gnu.org</url>
+ <url>http://www.gnu.org/licenses/gpl.html</url>
</license>
</licenses>
commit b8b1edbac9e407404be7a7bf88d0738df175bd5b
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Jun 22 13:30:29 2011 +0200
Add a dependent value for the web connector
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 0ccacf6..76d1bcf 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
@@ -548,6 +548,7 @@
<service name="Connector"
discovery="SubsystemDiscovery"
class="BaseComponent"
+ createDeletePolicy="both"
>
<plugin-configuration>
<c:simple-property name="path" readOnly="true" default="connector"/>
@@ -563,8 +564,10 @@
<resource-configuration>
<c:simple-property name="protocol" required="true" type="string" readOnly="true" description="The web connector protocol."/>
- <c:simple-property name="socket-binding" required="true" type="string" readOnly="true"
- description="The web connector socket-binding reference, this connector should be bound to."/>
+ <c:simple-property name="socket-binding" required="true" type="string" readOnly="false"
+ description="The web connector socket-binding reference, this connector should be bound to.">
+ <c:option-source target="configuration" expression="socket-binding=name:type=SocketBindingGroup"/>
+ </c:simple-property>
<c:simple-property name="scheme" type="string" readOnly="true" default="http" description="The web connector scheme."/>
<c:simple-property name="executor" type="string" readOnly="true" required="false"
description="The name of the executor that should be used for the processing threads of this connector. Defaults to using an internal pool."/>
commit aed0881f6c23e7015c7c8665074d2c444acad189
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Jun 28 21:59:52 2011 +0200
Support the new "rolled-back" element in the JSON response from the AS.
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Result.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Result.java
index a5583b7..63c5262 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Result.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Result.java
@@ -40,6 +40,8 @@ public class Result {
private /*List<Map<String, String>>*/Object failureDescription;
@JsonIgnore
private boolean success = false;
+ @JsonProperty("rolled-back")
+ private boolean rolledBack = false;
public Result() {
@@ -83,4 +85,11 @@ public class Result {
this.failureDescription = failureDescription;
}
+ public boolean isRolledBack() {
+ return rolledBack;
+ }
+
+ public void setRolledBack(boolean rolledBack) {
+ this.rolledBack = rolledBack;
+ }
}
diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/OperationJsonTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/OperationJsonTest.java
index 53ac89e..b36a03b 100644
--- a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/OperationJsonTest.java
+++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/OperationJsonTest.java
@@ -185,7 +185,7 @@ public class OperationJsonTest {
public void arrayResult1() throws Exception {
- String resultString = "{\"outcome\":\"success\",\"result\":[\"standard-sockets\",\"messaging-sockets\"],\"compensating-operation\":null}";
+ String resultString = "{\"outcome\":\"success\",\"result\":[\"standard-sockets\",\"messaging-sockets\"],\"compensating-operation\":null, \"rolled-back\" : false}";
ObjectMapper mapper = new ObjectMapper();
Result result = mapper.readValue(resultString,Result.class);
@@ -197,6 +197,21 @@ public class OperationJsonTest {
assert stringList.size()==2;
assert stringList.get(0).equals("standard-sockets");
assert stringList.get(1).equals("messaging-sockets");
+ assert !result.isRolledBack();
+
+ }
+
+ public void rolledBack() throws Exception {
+
+ String resultString = "{\"outcome\":\"failed\", \"rolled-back\" : true}";
+
+ ObjectMapper mapper = new ObjectMapper();
+ Result result = mapper.readValue(resultString,Result.class);
+
+ assert result != null;
+ assert result.getOutcome().equals("failed");
+ assert !result.isSuccess();
+ assert result.isRolledBack();
}
commit f3a39fd7c84e203b90c3a0b6e35bc0e0fc8c4c9b
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Tue Jun 28 13:43:36 2011 -0500
Fix dbunit setup failures after a new table was added to the schema.
diff --git a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/discovery/DiscoveryBossBeanTest.xml b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/discovery/DiscoveryBossBeanTest.xml
index 290ad18..51e689e 100644
--- a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/discovery/DiscoveryBossBeanTest.xml
+++ b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/discovery/DiscoveryBossBeanTest.xml
@@ -10,8 +10,8 @@
mtime="123456"/>
<rhq_config_def/>
- <rhq_config_pd_osrc/>
<rhq_config_prop_def/>
+ <rhq_config_pd_osrc/>
<rhq_conf_prop_def_enum/>
<rhq_config_prop_constr/>
diff --git a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/inventory/InventoryManagerBeanTest.xml b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/inventory/InventoryManagerBeanTest.xml
index 306297c..0cfe2f1 100644
--- a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/inventory/InventoryManagerBeanTest.xml
+++ b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/inventory/InventoryManagerBeanTest.xml
@@ -1,7 +1,7 @@
<dataset>
<rhq_config_def/>
- <rhq_config_pd_osrc/>
<rhq_config_prop_def/>
+ <rhq_config_pd_osrc/>
<rhq_conf_prop_def_enum/>
<rhq_config_prop_constr/>
diff --git a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/MetadataTest.xml b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/MetadataTest.xml
index d584809..29351c4 100644
--- a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/MetadataTest.xml
+++ b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/MetadataTest.xml
@@ -2,6 +2,7 @@
<rhq_config_def/>
<rhq_config_prop_grp_def/>
<rhq_config_prop_def/>
+ <rhq_config_pd_osrc/>
<rhq_conf_prop_def_enum/>
<rhq_config_prop_constr/>
<rhq_config/>
commit 50fb5956ca8b06cc826766bd2a9d84806d79cda2
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Jun 28 17:30:10 2011 +0200
/domain-api got renamed to /management.
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
index c51f275..f2bb47f 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
@@ -52,7 +52,7 @@ public class ASConnection {
public ASConnection(String host, int port) {
try {
- url = new URL("http",host,port,"/domain-api");
+ url = new URL("http",host,port,"/management");
urlString = url.toString();
} catch (MalformedURLException e) {
throw new IllegalArgumentException(e.getMessage());
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java
index 80e8ea4..d876c80 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java
@@ -51,7 +51,7 @@ public class ASUploadConnection {
private static final String POST_REQUEST_METHOD = "POST";
- private static final String UPLOAD_URL_PATH = "/domain-api/add-content";
+ private static final String UPLOAD_URL_PATH = "/management/add-content";
private final Log log = LogFactory.getLog(ASUploadConnection.class);
commit c4bc8030a89861799fc79ff1611fa7cfc0009168
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Tue Jun 28 09:58:25 2011 -0500
Attempt to correct the dbunit setup failures after a new table was added to the schema.
diff --git a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/discovery/DiscoveryBossBeanTest.xml b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/discovery/DiscoveryBossBeanTest.xml
index 79ba415..290ad18 100644
--- a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/discovery/DiscoveryBossBeanTest.xml
+++ b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/discovery/DiscoveryBossBeanTest.xml
@@ -10,6 +10,7 @@
mtime="123456"/>
<rhq_config_def/>
+ <rhq_config_pd_osrc/>
<rhq_config_prop_def/>
<rhq_conf_prop_def_enum/>
<rhq_config_prop_constr/>
diff --git a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/inventory/InventoryManagerBeanTest.xml b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/inventory/InventoryManagerBeanTest.xml
index 7e6ae2a..306297c 100644
--- a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/inventory/InventoryManagerBeanTest.xml
+++ b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/inventory/InventoryManagerBeanTest.xml
@@ -1,5 +1,6 @@
<dataset>
<rhq_config_def/>
+ <rhq_config_pd_osrc/>
<rhq_config_prop_def/>
<rhq_conf_prop_def_enum/>
<rhq_config_prop_constr/>
commit 04f686144727920a5a25954962d84edf225efc9a
Merge: 2e85dca 1553673
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Jun 28 13:51:58 2011 +0200
Merge branch 'master' into dependent-values
commit 2e85dca3f15e8702a073d1f0e06105042e126781
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Jun 28 13:51:40 2011 +0200
First cut at handling target=configuration and using DV in the resource config editor.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
index 2df653a..8f1a058 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
@@ -30,6 +30,7 @@ import com.smartgwt.client.widgets.toolbar.ToolStrip;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.composite.ResourceComposite;
@@ -40,6 +41,7 @@ import org.rhq.enterprise.gui.coregui.client.RefreshableView;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeEvent;
import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeListener;
+import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceDetailView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
@@ -127,19 +129,31 @@ public class ResourceConfigurationEditView extends LocatableVLayout implements P
@Override
public void onTypesLoaded(ResourceType type) {
- editor = new ConfigurationEditor(extendLocatorId("Editor"), type
- .getResourceConfigurationDefinition(), result.getConfiguration());
- editor.setOverflow(Overflow.AUTO);
- editor.addPropertyValueChangeListener(ResourceConfigurationEditView.this);
- editor.setReadOnly(!resourcePermission.isConfigureWrite());
- addMember(editor);
-
- saveButton.disable();
- buttonbar.setVisible(true);
- markForRedraw();
- refreshing = false;
+ ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService();
+ configurationService.getOptionValuesForConfigDefinition(type.getResourceConfigurationDefinition(),new AsyncCallback<ConfigurationDefinition>(){
+ @Override
+ public void onFailure(Throwable throwable) {
+ refreshing = false;
+ CoreGUI.getErrorHandler().handleError("Failed to load configuration.", throwable);
+ }
+
+ @Override
+ public void onSuccess(ConfigurationDefinition configurationDefinition) {
+
+ editor = new ConfigurationEditor(extendLocatorId("Editor"), configurationDefinition, result.getConfiguration());
+ editor.setOverflow(Overflow.AUTO);
+ editor.addPropertyValueChangeListener(ResourceConfigurationEditView.this);
+ editor.setReadOnly(!resourcePermission.isConfigureWrite());
+ addMember(editor);
+
+ saveButton.disable();
+ buttonbar.setVisible(true);
+ markForRedraw();
+ refreshing = false;
+ }
+ });
}
- });
+ });
}
@Override
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index f810129..8463123 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -59,6 +59,9 @@ import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
import org.rhq.core.domain.configuration.PluginConfigurationUpdate;
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.RawConfiguration;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
import org.rhq.core.domain.configuration.composite.ConfigurationUpdateComposite;
@@ -77,6 +80,7 @@ import org.rhq.core.domain.criteria.GroupResourceConfigurationUpdateCriteria;
import org.rhq.core.domain.criteria.PluginConfigurationUpdateCriteria;
import org.rhq.core.domain.criteria.ResourceConfigurationUpdateCriteria;
import org.rhq.core.domain.criteria.ResourceCriteria;
+import org.rhq.core.domain.criteria.ResourceGroupCriteria;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.resource.Agent;
import org.rhq.core.domain.resource.Resource;
@@ -87,8 +91,6 @@ import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.resource.group.GroupCategory;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
-import org.rhq.core.domain.search.SearchSubsystem;
-import org.rhq.core.domain.search.SearchSuggestion;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
@@ -118,7 +120,6 @@ import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
import org.rhq.enterprise.server.resource.group.ResourceGroupNotFoundException;
import org.rhq.enterprise.server.resource.group.ResourceGroupUpdateException;
import org.rhq.enterprise.server.scheduler.SchedulerLocal;
-import org.rhq.enterprise.server.search.execution.SearchAssistManager;
import org.rhq.enterprise.server.system.ServerVersion;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
@@ -2412,21 +2413,136 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
if (pds.getOptionsSource()!=null) {
// evaluate the source parameters
PropertyOptionsSource pos = pds.getOptionsSource();
- ResourceCriteria criteria = new ResourceCriteria();
- criteria.setSearchExpression(pos.getExpression());
- // TODO for groups we need to talk to the group manager
- List<ResourceComposite> composites = resourceManager.findResourceCompositesByCriteria(subject,criteria);
- for (ResourceComposite composite : composites) {
+ PropertyOptionsSource.TargetType tt = pos.getTargetType();
+ String expression = pos.getExpression();
+ if (tt== PropertyOptionsSource.TargetType.RESOURCE || tt== PropertyOptionsSource.TargetType.CONFIGURATION) {
+ ResourceCriteria criteria = new ResourceCriteria();
+
+
+ if (tt==PropertyOptionsSource.TargetType.CONFIGURATION) {
+ // split out expression part for target=configuration
+ // return if no property specifier is given
+ String expr = expression;
+ if (!expr.contains(":")) {
+ log.warn("Option source expression for property " + pds.getName() + " and target configuration contains no ':'");
+ return;
+ }
+ }
+ else {
+ criteria.setSearchExpression(expression);
+ }
+
+
+ List<ResourceComposite> composites = resourceManager.findResourceCompositesByCriteria(subject,criteria);
+ for (ResourceComposite composite : composites) {
+
+ if (tt== PropertyOptionsSource.TargetType.RESOURCE) {
+
+ PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(composite.getResource().getName(),""+composite.getResource().getId());
+ // TODO filter -- or leave up to search expression??
+ pds.getEnumeratedValues().add(pde);
+ }
+ else if (tt== PropertyOptionsSource.TargetType.CONFIGURATION) {
+ // for configuration we need to drill down into the resource configuration
+ if (!handleConfigurationTarget(pds, expression, composite.getResource())) return;
+
+ }
+ }
+ }
+ else if (tt == PropertyOptionsSource.TargetType.GROUP) {
+ // for groups we need to talk to the group manager
+ ResourceGroupCriteria criteria = new ResourceGroupCriteria();
+ criteria.setSearchExpression(expression);
+
+ resourceGroupManager.findResourceGroupCompositesByCriteria(subject,criteria);
+ }
+ // TODO plugin and resourceType
+ }
- // TODO for configuration we need to drill down into the resource configuration
- PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(composite.getResource().getName(),""+composite.getResource().getId());
+ }
- // TODO filter -- or leave up to search expression??
+ /**
+ * Drill down in the case the user set up a target of "configuration". We need to check
+ * that the target property actually exiists and that it has a format we understand
+ * @param pds Propertydefinition to examine
+ * @param expression The whole expression starting with identifier: for the configuration
+ * identifier. This looks like <i>listname</i> for list of
+ * property simple or <i>mapname=mapkey</i> for a map with simple properties
+ * @param resource the
+ * @return false if the property can not be resolved, true otherwise
+ */
+ private boolean handleConfigurationTarget(PropertyDefinitionSimple pds, String expression,
+ Resource resource) {
+ Configuration configuration = resource.getResourceConfiguration();
+ Property p;
+ String propName = expression.substring(0, expression.indexOf(":"));
+ boolean isMap = expression.contains("=");
+
+ if (isMap) {
+ String mapPropName = propName.substring(0, propName.indexOf("="));
+ p = configuration.get(mapPropName);
+ } else
+ p = configuration.get(propName);
+
+ if (p == null) {
+ log.warn("Option source expression for property " + pds.getName() + " and target configuration not found");
+ return false;
+ }
+ if (!(p instanceof PropertyList)) {
+ log.warn("Option source expression for property " + pds.getName() + " and target configuration does not point to a list");
+ return false;
+ }
+ PropertyList pl = (PropertyList) p;
+ List<Property> propertyList = pl.getList();
+ if (propertyList.size()==0)
+ return false;
+
+ // Now List of simple or list of maps (of simple) ?
+
+ if (propertyList.get(0) instanceof PropertySimple) {
+ if (isMap) {
+ log.warn(" expected a List of Maps, but got a list of simple");
+ return false;
+ }
- pds.getEnumeratedValues().add(pde);
+ for (Property tmp : propertyList) {
+ PropertySimple ps= (PropertySimple) tmp;
+ String name = ps.getStringValue();
+ if (name!=null) {
+ PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(name, name);
+ pds.getEnumeratedValues().add(pde);
+ }
+ }
+ } else if (propertyList.get(0) instanceof PropertyMap) {
+ if (!isMap) {
+ log.warn(" expected a List of simple, but got a list of Maps");
+ return false;
+ }
+ String subPropName ;
+ subPropName = propName.substring(propName.indexOf("=") + 1);
+
+ for (Property tmp : propertyList) {
+ PropertyMap pm = (PropertyMap) tmp;
+ Property ps = pm.get(subPropName);
+ if (ps==null) {
+ log.warn("Option source expression for property " + pds.getName() + " and target configuration does not have a map element " + subPropName);
+ return false;
+ }
+ if (!(ps instanceof PropertySimple)) {
+ log.warn("ListOfMapOf!Simple are not supported");
+ return false;
+ }
+ PropertySimple propertySimple = (PropertySimple) ps;
+ String name = propertySimple.getStringValue();
+ if (name!=null) {
+ PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(name, name);
+ pds.getEnumeratedValues().add(pde);
+ }
}
}
+
+ return true;
}
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
commit 2c40f40c0e5c7d7fc37bab92cf71f2929d479db6
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Mon Jun 27 21:53:06 2011 +0200
Prevent a possible NPE later on if value is null.
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ObjectUtil.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ObjectUtil.java
index a6f76b8..0592390 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ObjectUtil.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/util/ObjectUtil.java
@@ -145,6 +145,10 @@ public class ObjectUtil {
* @return the value read from the object's property path
*/
public static Object lookupDeepAttributeProperty(Object value, String propertyPath) {
+
+ if (value==null)
+ return null;
+
String[] ps = propertyPath.split("\\.", 2);
String searchProperty = ps[0];
@@ -181,4 +185,4 @@ public class ObjectUtil {
// Prevent instantiation of this class.
private ObjectUtil() {
}
- }
\ No newline at end of file
+ }
12 years, 10 months
[rhq] Branch 'drift' - modules/core modules/enterprise
by mazz
modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java | 1 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java | 9 ++++++++-
2 files changed, 9 insertions(+), 1 deletion(-)
New commits:
commit 87ad74d339012649263450c3084e8220e995006d
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Jul 7 17:51:47 2011 -0400
our unidirectional one-to-many mapping of drift config makes it not possible
to easily bulk delete drift config.
so remove them here and let cascading of delete_orphan do the work
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
index 6067474..bfd2bfa 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
@@ -1076,6 +1076,7 @@ public class Resource implements Comparable<Resource>, Serializable {
@JoinTable(name = "RHQ_DRIFT_CONFIG_MAP", joinColumns = { @JoinColumn(name = "RESOURCE_ID") }, inverseJoinColumns = { @JoinColumn(name = "CONFIG_ID") })
@OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.ALL })
+ @org.hibernate.annotations.Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
private Set<Configuration> driftConfigurations = null;
public Resource() {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
index a598d2b..9792fad 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
@@ -415,6 +415,12 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
log.debug("Overlord is asynchronously deleting resource [" + attachedResource + "]");
}
+ // our unidirectional one-to-many mapping of drift config makes it not possible to easily bulk delete drift config
+ // so remove them here and let cascading of delete_orphan do the work
+ if (attachedResource.getDriftConfigurations() != null) {
+ attachedResource.getDriftConfigurations().clear();
+ }
+
// one more thing, delete any autogroup backing groups
if (attachedResource != null) {
List<ResourceGroup> backingGroups = attachedResource.getAutoGroupBackingGroups();
@@ -518,8 +524,9 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
continue;
}
- if (debugEnabled)
+ if (debugEnabled) {
log.debug("uninv, running query: " + namedQueryToExecute);
+ }
hasErrors |= resourceManager.bulkNamedQueryDeleteInNewTransaction(overlord, namedQueryToExecute,
resourceIds);
}
12 years, 10 months
[rhq] Branch 'mod_cluster_plugin' - 5 commits - modules/plugins
by snegrea
modules/plugins/mod-cluster/src/main/java/org/rhq/plugins/modcluster/ProxyInfo.java | 83 ++++++----
modules/plugins/mod-cluster/src/main/resources/META-INF/rhq-plugin.xml | 75 +++++++--
modules/plugins/mod-cluster/src/test/java/org/rhq/plugins/modcluster/test/ModclusterPluginTest.java | 28 ---
modules/plugins/mod-cluster/src/test/java/org/rhq/plugins/modcluster/test/ProxyInfoTest.java | 66 +++++++
modules/plugins/mod-cluster/src/test/resources/proxy_config/proxy_config_1.txt | 13 +
5 files changed, 197 insertions(+), 68 deletions(-)
New commits:
commit 1ea6e2e37dd183c05072cbbc48e664deaa88da68
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Thu Jul 7 16:37:41 2011 -0500
Created separate unit test suite for proxy info parser. Also, the code now parses the vhost from the actual config property.
diff --git a/modules/plugins/mod-cluster/src/main/java/org/rhq/plugins/modcluster/ProxyInfo.java b/modules/plugins/mod-cluster/src/main/java/org/rhq/plugins/modcluster/ProxyInfo.java
index f2af2bc..40b24f9 100644
--- a/modules/plugins/mod-cluster/src/main/java/org/rhq/plugins/modcluster/ProxyInfo.java
+++ b/modules/plugins/mod-cluster/src/main/java/org/rhq/plugins/modcluster/ProxyInfo.java
@@ -20,7 +20,9 @@ package org.rhq.plugins.modcluster;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -32,17 +34,40 @@ import java.util.regex.Pattern;
public class ProxyInfo {
private List<Context> availableContexts = new ArrayList<ProxyInfo.Context>();
+ private Map<String, Vhost> availableVHosts = new HashMap<String, Vhost>();
public ProxyInfo(String rawProxyInfo) {
+ Pattern vhostPattern = Pattern.compile("Vhost.*\n");
+ Matcher vhostMatcher = vhostPattern.matcher(rawProxyInfo);
+ while (vhostMatcher.find()) {
+ String rawVhost = vhostMatcher.group();
+ String[] vhostPieces = rawVhost.split(",");
- Pattern test = Pattern.compile("Context.*\n");
- Matcher m = test.matcher(rawProxyInfo);
- while (m.find()) {
- String rawContext = m.group();
+ String identifier = vhostPieces[0].trim();
+ identifier = identifier.substring(identifier.indexOf("[") + 1, identifier.indexOf("]"));
+ identifier = identifier.substring(0, identifier.lastIndexOf(":"));
+
+ String host = vhostPieces[1].trim();
+ host = host.substring(host.indexOf(":") + 1).trim();
+
+ System.out.println(identifier + "--" + host);
+ availableVHosts.put(identifier, new Vhost(identifier, host));
+
+ }
+
+ Pattern contextPattern = Pattern.compile("Context.*[\n|}]");
+ Matcher contextMatcher = contextPattern.matcher(rawProxyInfo);
+ while (contextMatcher.find()) {
+ String rawContext = contextMatcher.group();
String[] contextPieces = rawContext.split(",");
String actualContext = contextPieces[1].substring(contextPieces[1].indexOf("/")).trim();
- availableContexts.add(new Context("localhost", actualContext));
+ String identifier = contextPieces[0];
+ identifier = identifier.substring(identifier.indexOf("[") + 1, identifier.indexOf("]"));
+ identifier = identifier.substring(0, identifier.lastIndexOf(":"));
+ Vhost relatedVhost = availableVHosts.get(identifier);
+
+ availableContexts.add(new Context(relatedVhost.getHost(), actualContext));
}
}
@@ -50,6 +75,25 @@ public class ProxyInfo {
return Collections.unmodifiableList(availableContexts);
}
+ private static class Vhost {
+ private String identifier;
+ private String host;
+
+ public Vhost(String identifier, String host) {
+ this.identifier = identifier;
+ this.host = host;
+ }
+
+ public String getIdentifier() {
+ return identifier;
+ }
+
+ public String getHost() {
+ return host;
+ }
+
+ }
+
public static class Context {
String path;
String host;
@@ -63,18 +107,10 @@ public class ProxyInfo {
return path;
}
- public void setPath(String path) {
- this.path = path;
- }
-
public String getHost() {
return host;
}
- public void setHost(String host) {
- this.host = host;
- }
-
@Override
public String toString() {
return host + ":" + path;
diff --git a/modules/plugins/mod-cluster/src/test/java/org/rhq/plugins/modcluster/test/ModclusterPluginTest.java b/modules/plugins/mod-cluster/src/test/java/org/rhq/plugins/modcluster/test/ModclusterPluginTest.java
index 0d16e92..874011a 100644
--- a/modules/plugins/mod-cluster/src/test/java/org/rhq/plugins/modcluster/test/ModclusterPluginTest.java
+++ b/modules/plugins/mod-cluster/src/test/java/org/rhq/plugins/modcluster/test/ModclusterPluginTest.java
@@ -47,10 +47,9 @@ import org.rhq.core.pluginapi.inventory.ResourceComponent;
import org.rhq.core.pluginapi.measurement.MeasurementFacet;
import org.rhq.core.pluginapi.operation.OperationFacet;
import org.rhq.core.pluginapi.operation.OperationResult;
-import org.rhq.plugins.modcluster.ProxyInfo;
/**
- * @author Fady Matar
+ * @author Stefan Negrea
*/
@Test(groups = "modcluster-plugin")
public class ModclusterPluginTest {
@@ -83,31 +82,6 @@ public class ModclusterPluginTest {
}
@Test
- public void testProxyInfo() {
- String test = "{mobile-work/192.168.1.40:6666=Node: [1],Name: 4e6189af-0502-3305-8ff3-fad7fee8b516,Balancer: mycluster,LBGroup: ,Host: 127.0.0.1,Port: 8009,Type: ajp,Flushpackets: Off,Flushwait: 10,Ping: 10,Smax: 26,Ttl: 60,Elected: 3233,Read: 7355619,Transfered: 0,Connected: 0,Load: 100\n"
- + "Node: [2],Name: node2,Balancer: mycluster,LBGroup: ,Host: 127.0.0.1,Port: 8009,Type: ajp,Flushpackets: Off,Flushwait: 10,Ping: 10,Smax: 26,Ttl: 60,Elected: 0,Read: 0,Transfered: 0,Connected: 0,Load: 99\n"
- + "Vhost: [1:1:1], Alias: localhost\n"
- + "Vhost: [2:1:2], Alias: localhost\n"
- + "Context: [1:1:1], Context: /invoker, Status: DISABLED\n"
- + "Context: [1:1:2], Context: /loaddemo, Status: DISABLED\n"
- + "Context: [1:1:3], Context: /jbossws, Status: DISABLED\n"
- + "Context: [1:1:4], Context: /juddi, Status: DISABLED\n"
- + "Context: [1:1:5], Context: /jbossmq-httpil, Status: DISABLED\n"
- + "Context: [1:1:6], Context: /web-console, Status: DISABLED\n"
- + "Context: [1:1:7], Context: /jmx-console, Status: DISABLED\n"
- + "Context: [1:1:8], Context: /, Status: DISABLED\n"
- + "Context: [2:1:9], Context: /loaddemo, Status: ENABLED\n" + "}";
-
- ProxyInfo proxyInfo = new ProxyInfo(test);
-
- for (ProxyInfo.Context context : proxyInfo.getAvailableContexts()) {
- log.info(context.toString());
- }
-
- assert (proxyInfo.getAvailableContexts().size() != 0) : "Raw proxy info parsing failed!";
- }
-
- @Test
public void testPluginLoad() {
PluginManager pluginManager = PluginContainer.getInstance().getPluginManager();
PluginEnvironment pluginEnvironment = pluginManager.getPlugin(PLUGIN_NAME);
diff --git a/modules/plugins/mod-cluster/src/test/java/org/rhq/plugins/modcluster/test/ProxyInfoTest.java b/modules/plugins/mod-cluster/src/test/java/org/rhq/plugins/modcluster/test/ProxyInfoTest.java
new file mode 100644
index 0000000..be5e987
--- /dev/null
+++ b/modules/plugins/mod-cluster/src/test/java/org/rhq/plugins/modcluster/test/ProxyInfoTest.java
@@ -0,0 +1,66 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.plugins.modcluster.test;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.testng.annotations.Test;
+
+import org.rhq.plugins.modcluster.ProxyInfo;
+
+/**
+ * @author Stefan Negrea
+ */
+@Test(groups = "modcluster-plugin")
+public class ProxyInfoTest {
+ private Log log = LogFactory.getLog(this.getClass());
+
+ @Test
+ public void testProxyInfo() throws IOException {
+
+ String testConfiguration = readConfigFile("/proxy_config/proxy_config_1.txt");
+
+ ProxyInfo proxyInfo = new ProxyInfo(testConfiguration);
+
+ for (ProxyInfo.Context context : proxyInfo.getAvailableContexts()) {
+ log.info(context.toString());
+ }
+
+ assert (proxyInfo.getAvailableContexts().size() != 0) : "Raw proxy info parsing failed!";
+ }
+
+ private String readConfigFile(String filePath) throws IOException {
+ StringBuffer tempBuffer = new StringBuffer();
+ byte[] readBuffer = new byte[1024];
+ int bytesRead = 0;
+
+ InputStream resourceStream = getClass().getResourceAsStream(filePath);
+
+ while ((bytesRead = resourceStream.read(readBuffer)) != -1) {
+ tempBuffer.append(new String(readBuffer, 0, bytesRead));
+ }
+
+ resourceStream.close();
+
+ return tempBuffer.toString();
+ }
+}
\ No newline at end of file
diff --git a/modules/plugins/mod-cluster/src/test/resources/proxy_config/proxy_config_1.txt b/modules/plugins/mod-cluster/src/test/resources/proxy_config/proxy_config_1.txt
new file mode 100644
index 0000000..c99edd3
--- /dev/null
+++ b/modules/plugins/mod-cluster/src/test/resources/proxy_config/proxy_config_1.txt
@@ -0,0 +1,13 @@
+{mobile-work/192.168.1.40:6666=Node: [1],Name: 4e6189af-0502-3305-8ff3-fad7fee8b516,Balancer: mycluster,LBGroup: ,Host: 127.0.0.1,Port: 8009,Type: ajp,Flushpackets: Off,Flushwait: 10,Ping: 10,Smax: 26,Ttl: 60,Elected: 3233,Read: 7355619,Transfered: 0,Connected: 0,Load: 100
+Node: [2],Name: node2,Balancer: mycluster,LBGroup: ,Host: 127.0.0.1,Port: 8009,Type: ajp,Flushpackets: Off,Flushwait: 10,Ping: 10,Smax: 26,Ttl: 60,Elected: 0,Read: 0,Transfered: 0,Connected: 0,Load: 99
+Vhost: [1:1:1], Alias: localhost
+Vhost: [2:1:2], Alias: localhost
+Context: [1:1:1], Context: /invoker, Status: DISABLED
+Context: [1:1:2], Context: /loaddemo, Status: DISABLED
+Context: [1:1:3], Context: /jbossws, Status: DISABLED
+Context: [1:1:4], Context: /juddi, Status: DISABLED
+Context: [1:1:5], Context: /jbossmq-httpil, Status: DISABLED
+Context: [1:1:6], Context: /web-console, Status: DISABLED
+Context: [1:1:7], Context: /jmx-console, Status: DISABLED
+Context: [1:1:8], Context: /, Status: DISABLED
+Context: [2:1:9], Context: /loaddemo, Status: ENABLED}
\ No newline at end of file
commit 98d1af05eae3cd7013b6a2315c601a29b62ab641
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Thu Jul 7 13:27:01 2011 -0600
Fine tunning the plugin based on UI testing.
diff --git a/modules/plugins/mod-cluster/src/main/java/org/rhq/plugins/modcluster/ProxyInfo.java b/modules/plugins/mod-cluster/src/main/java/org/rhq/plugins/modcluster/ProxyInfo.java
index fb72b5f..f2af2bc 100644
--- a/modules/plugins/mod-cluster/src/main/java/org/rhq/plugins/modcluster/ProxyInfo.java
+++ b/modules/plugins/mod-cluster/src/main/java/org/rhq/plugins/modcluster/ProxyInfo.java
@@ -77,7 +77,7 @@ public class ProxyInfo {
@Override
public String toString() {
- return path + ":" + host;
+ return host + ":" + path;
}
public static Context fromString(String stringRepresentation) {
diff --git a/modules/plugins/mod-cluster/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/mod-cluster/src/main/resources/META-INF/rhq-plugin.xml
index 88357db..cf12b89 100644
--- a/modules/plugins/mod-cluster/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/mod-cluster/src/main/resources/META-INF/rhq-plugin.xml
@@ -80,15 +80,14 @@
<c:simple-property name="advertise" type="boolean" description="Enable autodiscovery of httpd servers."/>
<c:simple-property name="smax" type="integer" description="Maximum time on seconds for idle connections above smax."/>
<c:simple-property name="maxAttempts" type="integer" description="Maximum number of attempts to send the request to the backend server."/>
- <c:simple-property name="advertiseSecurityKey" type="integer" description="Security key for discovery."/>
+ <c:simple-property name="advertiseSecurityKey" type="string" required="false" description="Security key for discovery."/>
<c:simple-property name="stickySessionForce" type="boolean" description="Return an error when the request cannot be routed to the right node."/>
- <c:simple-property name="balancer" type="string" description="Name of the balancer."/>
+ <c:simple-property name="balancer" type="string" required="false" description="Name of the balancer."/>
<c:simple-property name="flushPackets" type="boolean" description="Allows controlling flusing of packets."/>
- <c:simple-property name="socketTimeout" type="integer" description="Connection timeout for communication with the proxy." />
- <c:simple-property name="containerName" type="string" description="Object name of the container."/>
- <c:simple-property name="domain" type="string" description="Domain parameter, which allows tying a jvmRoute to a particular domain."/>
- <c:simple-property name="advertisePort" type="integer" description="Multicast port for discovery" />
- <c:simple-property name="advertiseGroupAddress" type="string" description="Multicast address for discovery."/>
+ <c:simple-property name="socketTimeout" type="integer" description="Connection timeout for communication with the proxy." />
+ <c:simple-property name="domain" type="string" required="false" description="Domain parameter, which allows tying a jvmRoute to a particular domain."/>
+ <c:simple-property name="advertisePort" type="integer" required="false" description="Multicast port for discovery" />
+ <c:simple-property name="advertiseGroupAddress" type="string" required="false" description="Multicast address for discovery."/>
<c:simple-property name="flushWait" type="integer" description="Time in ms to wait before flushing packets."/>
<c:simple-property name="ping" type="integer" description="Time in s to wait for a pong answer to a ping."/>
</resource-configuration>
commit 96a80b66d1a918c012cc3825ef151df87c42a0ec
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Thu Jul 7 10:38:53 2011 -0600
Changed the name of context objects to the proposed short notation.
diff --git a/modules/plugins/mod-cluster/src/main/java/org/rhq/plugins/modcluster/ProxyInfo.java b/modules/plugins/mod-cluster/src/main/java/org/rhq/plugins/modcluster/ProxyInfo.java
index 9cb6b86..fb72b5f 100644
--- a/modules/plugins/mod-cluster/src/main/java/org/rhq/plugins/modcluster/ProxyInfo.java
+++ b/modules/plugins/mod-cluster/src/main/java/org/rhq/plugins/modcluster/ProxyInfo.java
@@ -42,7 +42,7 @@ public class ProxyInfo {
String[] contextPieces = rawContext.split(",");
String actualContext = contextPieces[1].substring(contextPieces[1].indexOf("/")).trim();
- availableContexts.add(new Context(actualContext, "localhost"));
+ availableContexts.add(new Context("localhost", actualContext));
}
}
@@ -54,7 +54,7 @@ public class ProxyInfo {
String path;
String host;
- public Context(String path, String host) {
+ public Context(String host, String path) {
this.path = path;
this.host = host;
}
@@ -77,25 +77,12 @@ public class ProxyInfo {
@Override
public String toString() {
- return "Context [path=" + path + ", host=" + host + "]";
+ return path + ":" + host;
}
public static Context fromString(String stringRepresentation) {
- stringRepresentation = stringRepresentation.substring(stringRepresentation.indexOf('[') + 1);
- stringRepresentation = stringRepresentation.substring(0, stringRepresentation.indexOf(']'));
- stringRepresentation = stringRepresentation.trim();
-
- String host = null;
- String path = null;
- for (String part : stringRepresentation.split(",")) {
- part = part.trim();
- if (part.startsWith("path=")) {
- path = part.substring(5).trim();
- } else if (part.startsWith("host=")) {
- host = part.substring(5).trim();
- }
- }
- return new Context(path, host);
+ String part[] = stringRepresentation.trim().split(":");
+ return new Context(part[0], part[1]);
}
}
}
\ No newline at end of file
diff --git a/modules/plugins/mod-cluster/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/mod-cluster/src/main/resources/META-INF/rhq-plugin.xml
index ad23d34..88357db 100644
--- a/modules/plugins/mod-cluster/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/mod-cluster/src/main/resources/META-INF/rhq-plugin.xml
@@ -74,7 +74,7 @@
<metric property="className" displayName="Fully qualified class name of the managed object" displayType="summary" dataType="trait" />
<resource-configuration>
- <c:simple-property name="workerTimeout" type="integer" description="Timeout to wait for an available worker (default is no wait)"
+ <c:simple-property name="workerTimeout" type="integer" description="Timeout to wait for an available worker (default is no wait)" />
<c:simple-property name="stickySession" type="boolean" description="Enables sticky session for the cluster."/>
<c:simple-property name="stickySessionRemove" type="boolean" description="Remove session when the request cannot be routed to the right node."/>
<c:simple-property name="advertise" type="boolean" description="Enable autodiscovery of httpd servers."/>
@@ -83,7 +83,7 @@
<c:simple-property name="advertiseSecurityKey" type="integer" description="Security key for discovery."/>
<c:simple-property name="stickySessionForce" type="boolean" description="Return an error when the request cannot be routed to the right node."/>
<c:simple-property name="balancer" type="string" description="Name of the balancer."/>
- <c:simple-property name="flushPackets" type="boolean" descritpion="Allows controlling flusing of packets."/>
+ <c:simple-property name="flushPackets" type="boolean" description="Allows controlling flusing of packets."/>
<c:simple-property name="socketTimeout" type="integer" description="Connection timeout for communication with the proxy." />
<c:simple-property name="containerName" type="string" description="Object name of the container."/>
<c:simple-property name="domain" type="string" description="Domain parameter, which allows tying a jvmRoute to a particular domain."/>
commit 109bdc7c6ce20c3b514679be08f1735955945aa3
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Thu Jul 7 10:23:06 2011 -0600
Added support for all the mod_cluster available operations.
diff --git a/modules/plugins/mod-cluster/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/mod-cluster/src/main/resources/META-INF/rhq-plugin.xml
index 17a4267..ad23d34 100644
--- a/modules/plugins/mod-cluster/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/mod-cluster/src/main/resources/META-INF/rhq-plugin.xml
@@ -27,41 +27,70 @@
<c:simple-property name="nameTemplate" default="mod_cluster"/>
</plugin-configuration>
- <operation name="reset" displayName="Reset the node" description="Move the node out of an error state" />
- <operation name="refresh" displayName="Refresh configuration" description="Refresh configuration" />
- <operation name="enable" displayName="Enable all webapps" description="Enable all webapps for all engines">
+ <operation name="stop" displayName="Stop all webapps" description="Gracefully stops all webapps for all engines.">
+ <parameters>
+ <c:simple-property required="true" name="timeout" type="string" displayName="Session draining timeout"/>
+ <c:simple-property required="true" name="unit" default="MILLISECONDS" displayName="Time unit of the timeout parameter">
+ <c:property-options allowCustomValue="false">
+ <c:option value="MICROSECONDS" name="MICROSECONDS"/>
+ <c:option value="MILLISECONDS" name="MILLISECONDS"/>
+ <c:option value="NANOSECONDS" name="NANOSECONDS"/>
+ <c:option value="SECONDS" name="SECONDS"/>
+ </c:property-options>
+ </c:simple-property>
+ </parameters>
+ <results>
+ <c:simple-property name="result" type="boolean" description="The result of the operation" />
+ </results>
+ </operation>
+ <operation name="addProxy" displayName="Add a proxy" description="Add a proxy.">
+ <parameters>
+ <c:simple-property required="true" name="host" type="string" displayName="Proxy address"/>
+ <c:simple-property required="true" name="port" type="string" displayName="Proxy port"/>
+ </parameters>
+ </operation>
+ <operation name="enable" displayName="Enable all webapps" description="Enable all webapps for all engines">
<results>
<c:simple-property name="result" type="boolean" description="The result of the operation" />
</results>
- </operation>
- <operation name="disable" displayName="Disable all webpapps" description="Disable all webapps for all engines">
+ </operation>
+ <operation name="reset" displayName="Reset the node" description="Move the node out of an error state." />
+ <operation name="disable" displayName="Disable all webpapps" description="Disable all webapps for all engines.">
<results>
<c:simple-property name="result" type="boolean" description="The result of the operation" />
</results>
</operation>
+ <operation name="refreshProxy" displayName="Remove a proxy" description="Remove a proxy.">
+ <parameters>
+ <c:simple-property required="true" name="host" type="string" displayName="Proxy address"/>
+ <c:simple-property required="true" name="port" type="string" displayName="Proxy port"/>
+ </parameters>
+ </operation>
+ <operation name="refresh" displayName="Refresh configuration" description="Refresh configuration" />
+
<metric property="proxyConfiguration" displayName="Proxy Configuration" displayType="summary" dataType="trait" />
<metric property="modelerType" displayName="Type of the modeled resource" displayType="summary" dataType="trait" />
<metric property="className" displayName="Fully qualified class name of the managed object" displayType="summary" dataType="trait" />
<resource-configuration>
- <c:simple-property name="workerTimeout" type="int" description="Timeout to wait for an available worker (default is no wait)"
+ <c:simple-property name="workerTimeout" type="integer" description="Timeout to wait for an available worker (default is no wait)"
<c:simple-property name="stickySession" type="boolean" description="Enables sticky session for the cluster."/>
<c:simple-property name="stickySessionRemove" type="boolean" description="Remove session when the request cannot be routed to the right node."/>
<c:simple-property name="advertise" type="boolean" description="Enable autodiscovery of httpd servers."/>
- <c:simple-property name="smax" type="int" description="Maximum time on seconds for idle connections above smax."/>
- <c:simple-property name="maxAttempts" type="int" description="Maximum number of attempts to send the request to the backend server."/>
- <c:simple-property name="advertiseSecurityKey" type="int" description="Security key for discovery."/>
+ <c:simple-property name="smax" type="integer" description="Maximum time on seconds for idle connections above smax."/>
+ <c:simple-property name="maxAttempts" type="integer" description="Maximum number of attempts to send the request to the backend server."/>
+ <c:simple-property name="advertiseSecurityKey" type="integer" description="Security key for discovery."/>
<c:simple-property name="stickySessionForce" type="boolean" description="Return an error when the request cannot be routed to the right node."/>
<c:simple-property name="balancer" type="string" description="Name of the balancer."/>
<c:simple-property name="flushPackets" type="boolean" descritpion="Allows controlling flusing of packets."/>
- <c:simple-property name="socketTimeout" type="int" description="Connection timeout for communication with the proxy." />
+ <c:simple-property name="socketTimeout" type="integer" description="Connection timeout for communication with the proxy." />
<c:simple-property name="containerName" type="string" description="Object name of the container."/>
<c:simple-property name="domain" type="string" description="Domain parameter, which allows tying a jvmRoute to a particular domain."/>
- <c:simple-property name="advertisePort" type="int" description="Multicast port for discovery" />
+ <c:simple-property name="advertisePort" type="integer" description="Multicast port for discovery" />
<c:simple-property name="advertiseGroupAddress" type="string" description="Multicast address for discovery."/>
- <c:simple-property name="flushWait" type="int" description="Time in ms to wait before flushing packets."/>
- <c:simple-property name="ping" type="int" description="Time in s to wait for a pong answer to a ping"/>
+ <c:simple-property name="flushWait" type="integer" description="Time in ms to wait before flushing packets."/>
+ <c:simple-property name="ping" type="integer" description="Time in s to wait for a pong answer to a ping."/>
</resource-configuration>
<service name="mod_cluster Webapp Context"
@@ -69,19 +98,30 @@
class="ContextComponent"
description="A mod_cluster context">
- <operation name="enableContext" displayName="Enable webapp" description="Enable this webapp">
+ <operation name="disableContext" displayName="Disable webapp" description="Disable this webapp.">
<results>
- <c:simple-property name="result" type="boolean" description="The result of the operation" />
+ <c:simple-property name="result" type="boolean" description="The result of the operation."/>
</results>
</operation>
- <operation name="disableContext" displayName="Disable webapp" description="Disable this webapp">
+ <operation name="stopContext" displayName="Stop webapp" description="Gracefully stops this webapp.">
+ <parameters>
+ <c:simple-property required="true" name="timeout" type="integer" displayName="Session draining timeout"/>
+ <c:simple-property required="true" name="unit" default="MILLISECONDS" displayName="Time unit of the timeout parameter">
+ <c:property-options allowCustomValue="false">
+ <c:option value="MICROSECONDS" name="MICROSECONDS"/>
+ <c:option value="MILLISECONDS" name="MILLISECONDS"/>
+ <c:option value="NANOSECONDS" name="NANOSECONDS"/>
+ <c:option value="SECONDS" name="SECONDS"/>
+ </c:property-options>
+ </c:simple-property>
+ </parameters>
<results>
<c:simple-property name="result" type="boolean" description="The result of the operation" />
</results>
</operation>
- <operation name="stopContext" displayName="Stop webapp" description="Gracefully stops this webapp.">
+ <operation name="enableContext" displayName="Enable webapp" description="Enable this webapp.">
<results>
- <c:simple-property name="result" type="boolean" description="The result of the operation" />
+ <c:simple-property name="result" type="boolean" description="The result of the operation" />
</results>
</operation>
commit 9133ff50842297f30bed9fcb7553a66a38379d76
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Thu Jul 7 09:49:10 2011 -0600
Added all the properties available through the JMX interface to the plugin configuration.
diff --git a/modules/plugins/mod-cluster/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/mod-cluster/src/main/resources/META-INF/rhq-plugin.xml
index b2179c3..17a4267 100644
--- a/modules/plugins/mod-cluster/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/mod-cluster/src/main/resources/META-INF/rhq-plugin.xml
@@ -45,9 +45,23 @@
<metric property="className" displayName="Fully qualified class name of the managed object" displayType="summary" dataType="trait" />
<resource-configuration>
- <c:simple-property name="stickySessions" type="boolean" description="Enables sticky sessions."/>
+ <c:simple-property name="workerTimeout" type="int" description="Timeout to wait for an available worker (default is no wait)"
+ <c:simple-property name="stickySession" type="boolean" description="Enables sticky session for the cluster."/>
<c:simple-property name="stickySessionRemove" type="boolean" description="Remove session when the request cannot be routed to the right node."/>
<c:simple-property name="advertise" type="boolean" description="Enable autodiscovery of httpd servers."/>
+ <c:simple-property name="smax" type="int" description="Maximum time on seconds for idle connections above smax."/>
+ <c:simple-property name="maxAttempts" type="int" description="Maximum number of attempts to send the request to the backend server."/>
+ <c:simple-property name="advertiseSecurityKey" type="int" description="Security key for discovery."/>
+ <c:simple-property name="stickySessionForce" type="boolean" description="Return an error when the request cannot be routed to the right node."/>
+ <c:simple-property name="balancer" type="string" description="Name of the balancer."/>
+ <c:simple-property name="flushPackets" type="boolean" descritpion="Allows controlling flusing of packets."/>
+ <c:simple-property name="socketTimeout" type="int" description="Connection timeout for communication with the proxy." />
+ <c:simple-property name="containerName" type="string" description="Object name of the container."/>
+ <c:simple-property name="domain" type="string" description="Domain parameter, which allows tying a jvmRoute to a particular domain."/>
+ <c:simple-property name="advertisePort" type="int" description="Multicast port for discovery" />
+ <c:simple-property name="advertiseGroupAddress" type="string" description="Multicast address for discovery."/>
+ <c:simple-property name="flushWait" type="int" description="Time in ms to wait before flushing packets."/>
+ <c:simple-property name="ping" type="int" description="Time in s to wait for a pong answer to a ping"/>
</resource-configuration>
<service name="mod_cluster Webapp Context"
@@ -55,17 +69,17 @@
class="ContextComponent"
description="A mod_cluster context">
- <operation name="enableContext" displayName="Enable webapp" description="Enable the webapp">
+ <operation name="enableContext" displayName="Enable webapp" description="Enable this webapp">
<results>
<c:simple-property name="result" type="boolean" description="The result of the operation" />
</results>
</operation>
- <operation name="disableContext" displayName="Disable webpapp" description="Disable the webapp">
+ <operation name="disableContext" displayName="Disable webapp" description="Disable this webapp">
<results>
<c:simple-property name="result" type="boolean" description="The result of the operation" />
</results>
</operation>
- <operation name="stopContext" displayName="Stop webpapp" description="Gracefully stops the webapp">
+ <operation name="stopContext" displayName="Stop webapp" description="Gracefully stops this webapp.">
<results>
<c:simple-property name="result" type="boolean" description="The result of the operation" />
</results>
12 years, 10 months
[rhq] modules/enterprise
by ips
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java | 23 +++++++++-
1 file changed, 21 insertions(+), 2 deletions(-)
New commits:
commit 4fa820c8bfdea5f64b3bf34f109de218049c1083
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Thu Jul 7 15:18:05 2011 -0400
make sure TreeGrid and buttons refresh on data arrival
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
index 678bc74..4daa3c6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
@@ -40,6 +40,8 @@ import com.smartgwt.client.widgets.form.fields.SelectItem;
import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.grid.events.DataArrivedEvent;
+import com.smartgwt.client.widgets.grid.events.DataArrivedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionEvent;
import com.smartgwt.client.widgets.layout.HLayout;
@@ -260,6 +262,20 @@ public class ResourceAutodiscoveryView extends LocatableVLayout implements Refre
});
+ treeGrid.addDataArrivedHandler(new DataArrivedHandler() {
+ public void onDataArrived(DataArrivedEvent dataArrivedEvent) {
+ if (treeGrid != null) {
+ updateButtonEnablement(selectAllButton, deselectAllButton, importButton, ignoreButton,
+ unignoreButton);
+ // NOTE: Due to a SmartGWT bug, the TreeGrid is not automatically redrawn upon data arrival, and
+ // calling treeGrid.markForRedraw() doesn't redraw it either. The user can mouse over the grid
+ // to cause it to redraw, but it is obviously not reasonable to expect that. So we must
+ // explicitly call redraw() here.
+ treeGrid.redraw();
+ }
+ }
+ });
+
selectAllButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
SC.ask(MSG.view_autoDiscoveryQ_confirmSelectAll(), new BooleanCallback() {
@@ -371,6 +387,7 @@ public class ResourceAutodiscoveryView extends LocatableVLayout implements Refre
importButton.setDisabled(true);
ignoreButton.setDisabled(true);
unignoreButton.setDisabled(true);
+ markForRedraw();
return;
}
@@ -426,8 +443,10 @@ public class ResourceAutodiscoveryView extends LocatableVLayout implements Refre
* Custom refresh operation, as we cannot extend Table because we use a TreeGrid, not a ListGrid.
*/
public void refresh() {
- this.treeGrid.invalidateCache();
- this.treeGrid.markForRedraw();
+ if (this.treeGrid != null) {
+ this.treeGrid.invalidateCache();
+ this.treeGrid.markForRedraw();
+ }
}
public DataSource getDataSource() {
12 years, 10 months
[rhq] modules/enterprise
by John Sanda
modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/plugin_v1.xml | 8 --------
1 file changed, 8 deletions(-)
New commits:
commit 132864a0fdb6c0bcf6d7a9c948633c9bbff98c9e
Author: John Sanda <jsanda(a)redhat.com>
Date: Thu Jul 7 14:35:00 2011 -0400
Removing drift plugin descriptor elements that are not yet in master
diff --git a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/plugin_v1.xml b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/plugin_v1.xml
index 36eb2b5..ea8aaba 100644
--- a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/plugin_v1.xml
+++ b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest/plugin_v1.xml
@@ -51,14 +51,6 @@
</configuration>
</content>
- <drift-configuration name="drift1">
- <basedir>
- <value-context>pluginConfiguration</value-context>
- <value-name>connectionPropertyX</value-name>
- </basedir>
- </drift-configuration>
-
-<!-- THIS CAUSES A DEADLOCK DURING PLUGIN REGISTRATION! -->
<bundle-target>
<destination-base-dir name="bundleTarget1">
<value-context>pluginConfiguration</value-context>
12 years, 10 months
[rhq] 2 commits - etc/scripts modules/enterprise
by ips
etc/scripts/install-rhq-agent.sh | 32 +++++++++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java | 22 ++++--
2 files changed, 45 insertions(+), 9 deletions(-)
New commits:
commit 4aba34c876baca85751e3ed749efaf485574879c
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Thu Jul 7 13:13:11 2011 -0400
fix a couple bugs in the recently added selectAll/deselectAll functionality on the autodiscovery queue view
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
index e504f2a..678bc74 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
@@ -265,19 +265,24 @@ public class ResourceAutodiscoveryView extends LocatableVLayout implements Refre
SC.ask(MSG.view_autoDiscoveryQ_confirmSelectAll(), new BooleanCallback() {
public void execute(Boolean selectChildServers) {
selectionChangedHandlerDisabled = true;
+ TreeNode[] nodesToSelect;
if (selectChildServers) {
- treeGrid.selectAllRecords();
+ // NOTE: We do not use treeGrid.selectAllRecords() here, because it only selects nodes that
+ // are currently visible, and we want to select all nodes, including server nodes
+ // under a collapsed platform node.
+ nodesToSelect = treeGrid.getTree().getAllNodes();
} else {
- // Select only the platforms.
TreeNode rootNode = treeGrid.getTree().getRoot();
- TreeNode[] platformNodes = treeGrid.getTree().getChildren(rootNode);
- for (TreeNode platformNode : platformNodes) {
- treeGrid.selectRecord(platformNode);
- }
+ // The children of the root node are the platform nodes.
+ nodesToSelect = treeGrid.getTree().getChildren(rootNode);
}
- selectionChangedHandlerDisabled = false;
+ for (TreeNode nodeToSelect : nodesToSelect) {
+ treeGrid.selectRecord(nodeToSelect);
+ }
+ treeGrid.markForRedraw();
updateButtonEnablement(selectAllButton, deselectAllButton, importButton, ignoreButton,
unignoreButton);
+ selectionChangedHandlerDisabled = false;
}
});
}
@@ -287,8 +292,9 @@ public class ResourceAutodiscoveryView extends LocatableVLayout implements Refre
public void onClick(ClickEvent clickEvent) {
selectionChangedHandlerDisabled = true;
treeGrid.deselectAllRecords();
- selectionChangedHandlerDisabled = false;
+ treeGrid.markForRedraw();
updateButtonEnablement(selectAllButton, deselectAllButton, importButton, ignoreButton, unignoreButton);
+ selectionChangedHandlerDisabled = false;
}
});
commit 306e16a8d1812d7ce693887911922f3028c24486
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Thu Jul 7 13:12:17 2011 -0400
more work on automated install scripts
diff --git a/etc/scripts/install-rhq-agent.sh b/etc/scripts/install-rhq-agent.sh
index 0cc583f..46618c4 100644
--- a/etc/scripts/install-rhq-agent.sh
+++ b/etc/scripts/install-rhq-agent.sh
@@ -1,5 +1,24 @@
#!/bin/sh
+#
+# This script silently installs an RHQ Agent. It requires that the RHQ Server
+# that the Agent will register with be up and running. It is configured via the
+# following environment variables. For convenience, these variables can be
+# defined in a file named install-rhq-agent-env.sh located in the same directory
+# as this script.
+#
+# RHQ_AGENT_ENV_URL - the URL or path of the rhq-agent-env.sh to be used by the
+# Agent
+# RHQ_AGENT_CONFIGURATION_URL - the URL or path of the agent-configuration.xml
+# to be used by the Agent for its initial
+# configuration
+# RHQ_AGENT_INSTALL_PARENT_DIR - the path of the directory under which the Agent
+# install directory (rhq-agent) will be created
+# (e.g. $HOME/Applications)
+# RHQ_AGENT_NAME - the Agent name
+# RHQ_AGENT_SERVER_BIND_ADDRESS - the Server bind address
+#
+
# Define functions.
abort()
{
@@ -15,12 +34,23 @@ usage()
abort "$@" "Usage: $EXE RHQ_SERVER_URL RHQ_AGENT_ENV_URL RHQ_AGENT_CONFIGURATION_URL RHQ_AGENT_INSTALL_PARENT_DIR" "Example: $EXE http://localhost:7080/ rhq-agent-env.sh agent-configuration.xml ~/Applications"
}
+SCRIPT_PATH=`readlink -e "$0" 2>/dev/null || readlink "$0" 2>/dev/null || echo "$0"`
+SCRIPT_PARENT_DIR=`dirname "$SCRIPT_PATH"`
+
+SCRIPT_ENV_PATH="${SCRIPT_PARENT_DIR}/install-rhq-agent-env.sh"
+if [ -f "$SCRIPT_ENV_PATH" ]; then
+ . "$SCRIPT_ENV_PATH" $*
+else
+ echo "No environment script found at: $SCRIPT_ENV_PATH"
+fi
+
# Process command line args.
EXE=`basename $0`
if [ "$#" -ne 4 ]; then
usage "Invalid number of arguments."
fi
-RHQ_SERVER_URL="$1"
+
+RHQ_SERVER_URL="http://$RHQ_AGENT_SERVER_BIND_ADDRESS:7080/"
RHQ_AGENT_ENV_URL="$2"
RHQ_AGENT_CONFIGURATION_URL="$3"
RHQ_AGENT_INSTALL_PARENT_DIR="$4"
12 years, 10 months
[rhq] Branch 'drift' - modules/enterprise
by John Sanda
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java | 36 +++++++++-
1 file changed, 34 insertions(+), 2 deletions(-)
New commits:
commit dfb918f722cdc3606cba47b07d6f54129c3e4e27
Author: John Sanda <jsanda(a)redhat.com>
Date: Thu Jul 7 12:39:46 2011 -0400
Fixing IO error when streaming drift files to the database
No longer using ZipUtil.walkZipFile because an IOException was getting thrown
after reading the first entry, resulting in subsequent entries being skipped.
DriftFileVisitor passed the ZipInputStream to Hibernate.createBlob, and either
Hibernate, the JDBC driver, or something else is closing the stream which in
turn causes the exception.
Now we unzip the content file into a temp directory and pass a
FileInputStream to hibernate for each file in the directory. Once each
file has been successfully stored, we delete the directory.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
index ae13557..1bbae02 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
@@ -24,6 +24,7 @@ import static javax.ejb.TransactionAttributeType.REQUIRES_NEW;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.File;
+import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
@@ -262,9 +263,40 @@ public class DriftManagerBean implements DriftManagerLocal, DriftManagerRemote {
@Override
public void storeFiles(File filesZip) throws Exception {
+ // No longer using ZipUtil.walkZipFile because an IOException was getting thrown
+ // after reading the first entry, resulting in subsequent entries being skipped.
+ // DriftFileVisitor passed the ZipInputStream to Hibernate.createBlob, and either
+ // Hibernate, the JDBC driver, or something else is closing the stream which in
+ // turn causes the exception.
+ //
+ // jsanda
+
+ String zipFileName = filesZip.getName();
+ File tmpDir = new File(System.getProperty("java.io.tmpdir"));
+ File dir = new File(tmpDir, zipFileName.substring(0, zipFileName.indexOf(".")));
+ dir.mkdir();
+
+ ZipUtil.unzipFile(filesZip, dir);
+ for (File file : dir.listFiles()) {
+ DriftFile driftFile = new DriftFile(file.getName());
+ try {
+ driftManager.persistDriftFileData(driftFile, new FileInputStream(file));
+ } catch (Exception e) {
+ LogFactory.getLog(getClass()).info("Skipping bad drift file", e);
+ }
+ }
+
+ for (File file : dir.listFiles()) {
+ file.delete();
+ }
+ boolean deleted = dir.delete();
+ if (!deleted) {
+ LogFactory.getLog(getClass()).info("Unable to delete " + dir.getAbsolutePath() + ". This directory and " +
+ "its contents are no longer needed. It can be deleted.");
+ }
- DriftFileVisitor dfVisitor = new DriftFileVisitor(driftManager);
- ZipUtil.walkZipFile(filesZip, dfVisitor);
+// DriftFileVisitor dfVisitor = new DriftFileVisitor(driftManager);
+// ZipUtil.walkZipFile(filesZip, dfVisitor);
}
12 years, 10 months
[rhq] etc/scripts
by ips
etc/scripts/install-rhq-agent.sh | 81 ++++++++++++++++++++++++++++++++++++++
etc/scripts/install-rhq-server.sh | 69 ++++++++++++++++++++++++++++++++
2 files changed, 150 insertions(+)
New commits:
commit d977b4d7a60b1a71c28d33d4667e6ce4773bb8d2
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Wed Jul 6 17:29:13 2011 -0400
first cut of shell scripts for silently installing RHQ Server or RHQ Agents
diff --git a/etc/scripts/install-rhq-agent.sh b/etc/scripts/install-rhq-agent.sh
new file mode 100644
index 0000000..0cc583f
--- /dev/null
+++ b/etc/scripts/install-rhq-agent.sh
@@ -0,0 +1,81 @@
+#!/bin/sh
+
+# Define functions.
+abort()
+{
+ echo >&2
+ for ARG in "$@"; do
+ echo "$ARG" >&2
+ done
+ exit 1
+}
+
+usage()
+{
+ abort "$@" "Usage: $EXE RHQ_SERVER_URL RHQ_AGENT_ENV_URL RHQ_AGENT_CONFIGURATION_URL RHQ_AGENT_INSTALL_PARENT_DIR" "Example: $EXE http://localhost:7080/ rhq-agent-env.sh agent-configuration.xml ~/Applications"
+}
+
+# Process command line args.
+EXE=`basename $0`
+if [ "$#" -ne 4 ]; then
+ usage "Invalid number of arguments."
+fi
+RHQ_SERVER_URL="$1"
+RHQ_AGENT_ENV_URL="$2"
+RHQ_AGENT_CONFIGURATION_URL="$3"
+RHQ_AGENT_INSTALL_PARENT_DIR="$4"
+
+# Download the Agent installer jarfile.
+mkdir -p "$HOME/Downloads/tmp"
+cd "$HOME/Downloads/tmp"
+rm -rf *
+wget --content-disposition --timestamping "$RHQ_SERVER_URL/agentupdate/download"
+RHQ_AGENT_DIST_FILE_NAME=`echo *`
+mv $RHQ_AGENT_DIST_FILE_NAME ..
+
+# Download the Agent env file.
+if [ -f "$RHQ_AGENT_ENV_URL" ]; then
+ RHQ_AGENT_ENV_FILE="$RHQ_AGENT_ENV_URL"
+else
+ mkdir -p "$HOME/Downloads/tmp"
+ cd "$HOME/Downloads/tmp"
+ rm -rf *
+ wget --content-disposition --no-check-certificate --timestamping "$RHQ_AGENT_ENV_URL"
+ RHQ_AGENT_ENV_FILE_NAME=`echo *`
+ RHQ_AGENT_ENV_FILE="$HOME/Downloads/tmp/$RHQ_AGENT_ENV_FILE_NAME"
+fi
+
+# Download the Agent config file.
+if [ -f "$RHQ_AGENT_CONFIGURATION_URL" ]; then
+ RHQ_AGENT_CONFIGURATION_FILE="$RHQ_AGENT_CONFIGURATION_URL"
+else
+ mkdir -p "$HOME/Downloads/tmp"
+ cd "$HOME/Downloads/tmp"
+ rm -rf *
+ wget --content-disposition --no-check-certificate --timestamping "$RHQ_AGENT_CONFIGURATION_URL"
+ RHQ_AGENT_CONFIGURATION_FILE_NAME=`echo *`
+ RHQ_AGENT_CONFIGURATION_FILE="$HOME/Downloads/tmp/$RHQ_AGENT_CONFIGURATION_FILE_NAME"
+fi
+
+# Install the Agent.
+cd "$RHQ_AGENT_INSTALL_PARENT_DIR"
+# The Agent installer installs the Agent to ./rhq-agent.
+RHQ_AGENT_HOME="$RHQ_SERVER_INSTALL_PARENT_DIR/rhq-agent"
+if [ -f "$RHQ_AGENT_HOME" ]; then
+ # Backup existing Agent installation.
+ rm -rf "$RHQ_AGENT_HOME.bak"
+ mv "$RHQ_AGENT_HOME" "$RHQ_AGENT_HOME.bak"
+fi
+java -jar "$HOME/Downloads/$RHQ_AGENT_DIST_FILE_NAME" --install
+
+# Install the Agent env file.
+mv -f "$RHQ_AGENT_ENV_FILE" "$RHQ_AGENT_HOME/bin/rhq-agent-env.sh"
+sed -e "s/@@HOSTNAME@@/`hostname`/g" -e "s/@@SHORT_HOSTNAME@@/`hostname -s`/g" "$RHQ_AGENT_HOME/bin/rhq-agent-env.sh"
+
+# Install the Agent configuration file.
+mv -f "$RHQ_AGENT_CONFIGURATION_FILE" "$RHQ_AGENT_HOME/conf/agent-configuration.xml"
+sed -e "s/@@HOSTNAME@@/`hostname`/g" -e "s/@@SHORT_HOSTNAME@@/`hostname -s`/g" "$RHQ_AGENT_HOME/conf/agent-configuration.xml"
+
+# Start the Agent
+$RHQ_AGENT_HOME/bin/rhq-agent-wrapper.sh start
+
diff --git a/etc/scripts/install-rhq-server.sh b/etc/scripts/install-rhq-server.sh
new file mode 100644
index 0000000..e01f8f1
--- /dev/null
+++ b/etc/scripts/install-rhq-server.sh
@@ -0,0 +1,69 @@
+#!/bin/sh
+
+# Define functions.
+abort()
+{
+ echo >&2
+ for ARG in "$@"; do
+ echo "$ARG" >&2
+ done
+ exit 1
+}
+
+usage()
+{
+ abort "$@" "Usage: $EXE RHQ_SERVER_DIST_URL RHQ_SERVER_PROPERTIES_URL RHQ_SERVER_INSTALL_PARENT_DIR" "Example: $EXE http://sourceforge.net/projects/rhq/files/rhq/rhq-4.0.1/rhq-server-4.0.1.... rhq-server.properties /home/bob/Applications"
+}
+
+# Process command line args.
+EXE=`basename $0`
+if [ "$#" -ne 3 ]; then
+ usage "Invalid number of arguments."
+fi
+RHQ_SERVER_DIST_URL="$1"
+RHQ_SERVER_PROPERTIES_URL="$2"
+RHQ_SERVER_INSTALL_PARENT_DIR="$3"
+
+echo "If you are upgrading or replacing existing RHQ Servers, make sure all of those Servers are stopped, then hit Enter to continue."
+read
+
+# Download the Server zipfile.
+mkdir -p "$HOME/Downloads/tmp"
+cd "$HOME/Downloads/tmp"
+rm -rf *
+wget --content-disposition --no-check-certificate --timestamping "$RHQ_SERVER_DOWNLOAD_URL"
+RHQ_SERVER_DIST_FILE_NAME=`echo *`
+mv $RHQ_SERVER_DIST_FILE_NAME ..
+
+# Download the Server properties file.
+if [ -f "$RHQ_SERVER_PROPERTIES_URL" ]; then
+ RHQ_SERVER_PROPERTIES_FILE="$RHQ_SERVER_PROPERTIES_URL"
+else
+ mkdir -p "$HOME/Downloads/tmp"
+ cd "$HOME/Downloads/tmp"
+ rm -rf *
+ wget --content-disposition --no-check-certificate --timestamping "$RHQ_SERVER_PROPERTIES_URL"
+ RHQ_SERVER_PROPERTIES_FILE_NAME=`echo *`
+ RHQ_SERVER_PROPERTIES_FILE="/tmp/$RHQ_SERVER_PROPERTIES_FILE_NAME"
+fi
+
+# Unzip the Server zipfile.
+mkdir "$RHQ_SERVER_INSTALL_PARENT_DIR/tmp"
+cd "$RHQ_SERVER_INSTALL_PARENT_DIR/tmp"
+unzip -q "$HOME/Downloads/$RHQ_SERVER_DIST_FILE_NAME"
+RHQ_SERVER_HOME_BASE_NAME=`echo *`
+RHQ_SERVER_HOME="$RHQ_SERVER_INSTALL_PARENT_DIR/$RHQ_SERVER_HOME_BASE_NAME"
+if [ -f "$RHQ_SERVER_HOME" ]; then
+ # Backup existing Server installation.
+ rm -rf "$RHQ_SERVER_HOME.bak"
+ mv "$RHQ_SERVER_HOME" "$RHQ_SERVER_HOME.bak"
+fi
+mv $RHQ_SERVER_HOME_BASE_NAME ..
+
+# Install the Server properties file.
+mv -f "$RHQ_SERVER_PROPERTIES_FILE" "$RHQ_SERVER_HOME/bin/rhq-server.properties"
+sed -e "s/@@HOSTNAME@@/`hostname`/g" -e "s/@@SHORT_HOSTNAME@@/`hostname -s`/g" "$RHQ_SERVER_HOME/bin/rhq-server.properties"
+
+# Start the Server
+$RHQ_SERVER_HOME/bin/rhq-server.sh start
+
12 years, 10 months
[rhq] Branch 'drift' - modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/resources/org/rhq/core/RHQDomain.gwt.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit a3dffa4bcb267337a3b82483fac41a3d3555cb13
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Jul 6 16:48:39 2011 -0400
exclude the renamed class from gwt compiler
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/core/RHQDomain.gwt.xml b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/core/RHQDomain.gwt.xml
index 7eadf2a..19f5453 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/core/RHQDomain.gwt.xml
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/core/RHQDomain.gwt.xml
@@ -32,7 +32,7 @@
<source path="client"/>
<source path="domain">
<!-- Exclude any domain classes that can not be used client-side due to use of unsupported class use -->
- <exclude name="**/DriftFileContent.*"/>
+ <exclude name="**/DriftFileBits.*"/>
</source>
<!--<generate-with class="org.rhq.core.rebind.RecordBuilderGenerator">
12 years, 10 months
[rhq] Branch 'drift' - modules/core
by John Sanda
modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DirectoryAnalyzer.java | 8 +++++++-
modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftDetectionSchedule.java | 2 +-
2 files changed, 8 insertions(+), 2 deletions(-)
New commits:
commit e3ae4ca34a01dba6c4b3ef99d714ea2642be0657
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Jul 6 16:39:17 2011 -0400
Ignore subdirectories when analyzing a directory for drift
Updating DrifDetectionSchedule so that it sets the interval by seconds
and not minutes
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DirectoryAnalyzer.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DirectoryAnalyzer.java
index 5f20699..fa55085 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DirectoryAnalyzer.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DirectoryAnalyzer.java
@@ -1,6 +1,7 @@
package org.rhq.core.pc.drift;
import java.io.File;
+import java.io.FileFilter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -51,7 +52,12 @@ public class DirectoryAnalyzer {
public void run() throws IOException {
File dir = new File(basedir, dirEntry.getDirectory());
// TODO handle directories
- Set<String> files = fileNames(dir.listFiles());
+ Set<String> files = fileNames(dir.listFiles(new FileFilter() {
+ @Override
+ public boolean accept(File path) {
+ return path.isFile();
+ }
+ }));
Map<String, FileEntry> fileEntries = createFileEntriesMap();
List<String> processed = new ArrayList<String>();
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftDetectionSchedule.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftDetectionSchedule.java
index 0184782..a767b99 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftDetectionSchedule.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftDetectionSchedule.java
@@ -29,7 +29,7 @@ public class DriftDetectionSchedule implements Comparable<DriftDetectionSchedule
}
public void updateShedule() {
- nextScan = System.currentTimeMillis() + (driftConfig.getInterval() * 60 * 1000);
+ nextScan = System.currentTimeMillis() + (driftConfig.getInterval() * 1000);
}
@Override
12 years, 10 months