[rhq] Branch 'pc' - modules/enterprise
by mazz
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/ServerPluginsBean.java | 67 +++-------
1 file changed, 25 insertions(+), 42 deletions(-)
New commits:
commit dfd17347dd6d8c2707bfab6ced27bd44b66f9120
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Nov 25 16:42:23 2009 -0500
fix the update method so it can handle the config updates
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/ServerPluginsBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/ServerPluginsBean.java
index ff7d6ca..49d6e53 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/ServerPluginsBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/ServerPluginsBean.java
@@ -383,56 +383,39 @@ public class ServerPluginsBean implements ServerPluginsLocal {
if (plugin.getId() == 0) {
throw new IllegalArgumentException("Plugin must already exist to update it");
} else {
- // make sure the configs are in the DB properly and we have their refs
- // this is because we are using JPQL update, so we need to do some of this "manually"
- boolean needFlush = false;
+ // make sure we create (if necessary) and attach the configs
Configuration config = plugin.getPluginConfiguration();
if (config != null) {
- if (config.getId() > 0) {
- config = entityManager.getReference(Configuration.class, config.getId());
- plugin.setPluginConfiguration(config);
- } else {
- entityManager.persist(config);
- needFlush = true;
- }
+ config = entityManager.merge(config);
+ plugin.setPluginConfiguration(config);
}
config = plugin.getScheduledJobsConfiguration();
if (config != null) {
- if (config.getId() > 0) {
- config = entityManager.getReference(Configuration.class, config.getId());
- plugin.setScheduledJobsConfiguration(config);
- } else {
- entityManager.persist(config);
- needFlush = true;
- }
- }
- if (needFlush) {
- entityManager.flush(); // must be flushed to the DB so the JPQL update below works
+ config = entityManager.merge(config);
+ plugin.setScheduledJobsConfiguration(config);
}
- // now we can JPQL update the row - all but content is updated here.
- // we assured our configs are persisted/attached above
- Query q = entityManager.createNamedQuery(Plugin.UPDATE_ALL_BUT_CONTENT);
- q.setParameter("id", plugin.getId());
- q.setParameter("name", plugin.getName());
- q.setParameter("path", plugin.getPath());
- q.setParameter("displayName", plugin.getDisplayName());
- q.setParameter("enabled", plugin.isEnabled());
- q.setParameter("status", plugin.getStatus());
- q.setParameter("md5", plugin.getMD5());
- q.setParameter("version", plugin.getVersion());
- q.setParameter("ampsVersion", plugin.getAmpsVersion());
- q.setParameter("deployment", plugin.getDeployment());
- q.setParameter("pluginConfiguration", plugin.getPluginConfiguration());
- q.setParameter("scheduledJobsConfiguration", plugin.getScheduledJobsConfiguration());
- q.setParameter("description", plugin.getDescription());
- q.setParameter("help", plugin.getHelp());
- q.setParameter("mtime", plugin.getMtime());
- if (q.executeUpdate() != 1) {
- throw new Exception("Failed to update a plugin that matches [" + plugin + "]");
- }
+ Plugin pluginEntity = entityManager.getReference(Plugin.class, plugin.getId());
+ pluginEntity.setName(plugin.getName());
+ pluginEntity.setPath(plugin.getPath());
+ pluginEntity.setDisplayName(plugin.getDisplayName());
+ pluginEntity.setEnabled(plugin.isEnabled());
+ pluginEntity.setStatus(plugin.getStatus());
+ pluginEntity.setMd5(plugin.getMD5());
+ pluginEntity.setVersion(plugin.getVersion());
+ pluginEntity.setAmpsVersion(plugin.getAmpsVersion());
+ pluginEntity.setDeployment(plugin.getDeployment());
+ pluginEntity.setPluginConfiguration(plugin.getPluginConfiguration());
+ pluginEntity.setScheduledJobsConfiguration(plugin.getScheduledJobsConfiguration());
+ pluginEntity.setDescription(plugin.getDescription());
+ pluginEntity.setHelp(plugin.getHelp());
+ pluginEntity.setMtime(plugin.getMtime());
- entityManager.flush(); // make sure we push this out to the DB now
+ try {
+ entityManager.flush(); // make sure we push this out to the DB now
+ } catch (Exception e) {
+ throw new Exception("Failed to update a plugin that matches [" + plugin + "]", e);
+ }
}
return plugin;
}
14 years, 5 months
[rhq] Branch 'linux-config' - 2 commits - modules/enterprise
by Simeon Pinder
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/perspectives/ExtensionPoints.java | 449 ++++
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/perspectives/MenuItem.java | 78
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/perspectives/PerspectivesMenuUIBean.java | 744 +++----
modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/perspectives-beans.xml | 7
modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/menu/menu.xhtml | 1017 ++++------
5 files changed, 1276 insertions(+), 1019 deletions(-)
New commits:
commit c823eb53d8d4a52546fd628fd32cbee0ddd68321
Merge: d0ad9d3... 2ce39c2...
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Wed Nov 25 15:45:13 2009 -0500
Merge branch 'linux-config' of ssh://spinder@git.fedorahosted.org/git/rhq/rhq into linux-config
commit d0ad9d3db7ef2e756bf7f4eda10b9f8bfc65ad31
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Wed Nov 25 15:19:39 2009 -0500
Modified menu.xhtml to pull most content dynamically
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/perspectives/ExtensionPoints.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/perspectives/ExtensionPoints.java
new file mode 100644
index 0000000..5670264
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/perspectives/ExtensionPoints.java
@@ -0,0 +1,449 @@
+package org.rhq.enterprise.gui.perspectives;
+
+public class ExtensionPoints {
+
+ //constants:begin Extension point map
+ //MENU:ExtensionPoints BEGIN
+ //root menu item container
+ public static final String menu = "menu";
+ //logo
+ public static final String logo = menu + ".logo";
+ public static final String logo_BEFORE = logo + "_BEFORE";
+ public static final String logo_AFTER = logo + "_AFTER";
+ //overview
+ public static final String overview_BEFORE = logo_AFTER;//same spot
+ public static final String overview = menu + ".overview";
+ public static final String subsystemViews = overview + ".subsystemViews";
+ public static final String configurationChanges = subsystemViews + ".configurationChanges";
+ public static final String suspectMetrics = subsystemViews + ".suspectMetrics";
+ public static final String operations = subsystemViews + ".operations";
+ public static final String alerts = subsystemViews + ".alerts";
+ public static final String alertDefinitions = subsystemViews + ".alertDefinitions";
+ public static final String autoDiscoveryQueue = overview + ".autoDiscoveryQueue";
+ public static final String dashboard = overview + ".dashboard";
+ public static final String overview_AFTER = overview + "_AFTER";
+ //resources
+ public static final String resources_BEFORE = overview_AFTER;//same spot
+ public static final String resources = menu + ".resources";
+ public static final String platforms = resources + ".platforms";
+ public static final String servers = resources + ".servers";
+ public static final String services = resources + ".services";
+ public static final String favoriteResources = resources + ".favoriteResources";
+ public static final String recentlyViewedResources = resources + ".recentlyViewedResources";
+ public static final String searchResources = resources + ".search";
+ public static final String resources_AFTER = resources + "_AFTER";
+ //groups
+ public static final String groups_BEFORE = resources_AFTER;//same spot
+ public static final String groups = menu + ".groups";
+ public static final String compatible = groups + ".compatibleGroups";
+ public static final String mixed = groups + ".mixedGroups";
+ public static final String definitions = groups + ".groupDefinitions";
+ public static final String newGroup = groups + ".newGroup";
+ public static final String newGroupDefinition = groups + ".newGroupDefinition";
+ public static final String favoriteGroups = groups + ".favoriteGroups";
+ public static final String recentlyViewedGroups = groups + ".recentlyViewedGroups";
+ public static final String searchGroups = groups + ".search";
+ public static final String groups_AFTER = groups + "_AFTER";
+ //administration
+ public static final String administration_BEFORE = groups_AFTER;//same spot
+ public static final String administration = menu + ".administration";
+ public static final String security = administration + ".security";
+ public static final String users = security + ".users";
+ public static final String roles = security + ".roles";
+ public static final String systemConfiguration = administration + ".systemConfiguration";
+ public static final String settings = systemConfiguration + ".settings";
+ public static final String plugins = systemConfiguration + ".plugins";
+ public static final String templates = systemConfiguration + ".templates";
+ public static final String content = administration + ".content";
+ public static final String contentProviders = content + ".contentProviders";
+ public static final String repositories = content + ".repositories";
+ public static final String highAvailability = administration + ".highAvailability";
+ public static final String haServers = highAvailability + ".servers";
+ public static final String agents = highAvailability + ".agents";
+ public static final String affinityGroups = highAvailability + ".affinityGroups";
+ public static final String partitionEvents = highAvailability + ".partitionEvents";
+ public static final String reports = administration + ".reports";
+ public static final String resourceVersionInventoryReport = reports + ".resourceVersionInventoryReport";
+ public static final String downloads = administration + ".downloads";
+ public static final String license = administration + ".license";
+ public static final String administration_AFTER = administration + "_AFTER";
+ //debug
+ public static final String debug_BEFORE = administration_AFTER;//same spot
+ public static final String debug = menu + ".debug";
+ public static final String sqlInterface = debug + ".sqlInterface";
+ public static final String jpqlHqlInterface = debug + ".jpqlHqlInterface";
+ public static final String hibernate = debug + ".hibernate";
+ public static final String administrativeControl = debug + ".administrativeControl";
+ public static final String testEmail = debug + ".testEmail";
+ public static final String testAgent = debug + ".testAgent";
+ public static final String debug_AFTER = debug + "_AFTER";
+ //help
+ public static final String help_BEFORE = debug_AFTER;//same spot
+ public static final String help = menu + ".help";
+ public static final String onlineDocumentation = help + ".onlineDocumentation";
+ public static final String openASupportCase = help + ".openASupportCase";
+ public static final String about = help + ".about";
+ public static final String help_AFTER = help + "_AFTER";
+ //refresh
+ public static final String refresh = menu + ".refresh";
+ public static final String refresh_BEFORE = refresh + "_BEFORE";
+ public static final String stop = refresh + ".stop";
+ public static final String refreshEvery1Minute = refresh + ".refreshEvery1Minute";
+ public static final String refreshEvery5Minutes = refresh + ".refreshEvery5Minutes";
+ public static final String refreshEvery10Minutes = refresh + ".refreshEvery10Minutes";
+ public static final String refresh_AFTER = refresh + "_AFTER";
+ //loggedInAs
+ public static final String loggedInAs_BEFORE = refresh_AFTER;//same spot
+ public static final String loggedInAs = menu + ".loggedInAs";
+ public static final String editDetails = loggedInAs + ".editDetails";
+ public static final String changePassword = loggedInAs + ".changePassword";
+ public static final String logout = loggedInAs + ".logout";
+ public static final String loggedInAs_AFTER = loggedInAs + "_AFTER";
+
+ public ExtensionPoints() {
+ }
+
+ public String getMenu() {
+ return menu;
+ }
+
+ public String getLogo() {
+ return logo;
+ }
+
+ public String getLogoBefore() {
+ return logo_BEFORE;
+ }
+
+ public String getLogoAfter() {
+ return logo_AFTER;
+ }
+
+ public String getOverviewBefore() {
+ return overview_BEFORE;
+ }
+
+ public String getOverview() {
+ return overview;
+ }
+
+ public String getSubsystemviews() {
+ return subsystemViews;
+ }
+
+ public String getConfigurationchanges() {
+ return configurationChanges;
+ }
+
+ public String getSuspectmetrics() {
+ return suspectMetrics;
+ }
+
+ public String getOperations() {
+ return operations;
+ }
+
+ public String getAlerts() {
+ return alerts;
+ }
+
+ public String getAlertdefinitions() {
+ return alertDefinitions;
+ }
+
+ public String getAutodiscoveryqueue() {
+ return autoDiscoveryQueue;
+ }
+
+ public String getDashboard() {
+ return dashboard;
+ }
+
+ public String getOverviewAfter() {
+ return overview_AFTER;
+ }
+
+ public String getDebugBefore() {
+ return debug_BEFORE;
+ }
+
+ public String getDebug() {
+ return debug;
+ }
+
+ public String getSqlinterface() {
+ return sqlInterface;
+ }
+
+ public String getJpqlhqlinterface() {
+ return jpqlHqlInterface;
+ }
+
+ public String getHibernate() {
+ return hibernate;
+ }
+
+ public String getAdministrativecontrol() {
+ return administrativeControl;
+ }
+
+ public String getTestemail() {
+ return testEmail;
+ }
+
+ public String getTestagent() {
+ return testAgent;
+ }
+
+ public String getDebugAfter() {
+ return debug_AFTER;
+ }
+
+ public String getResourcesBefore() {
+ return resources_BEFORE;
+ }
+
+ public String getResources() {
+ return resources;
+ }
+
+ public String getPlatforms() {
+ return platforms;
+ }
+
+ public String getServers() {
+ return servers;
+ }
+
+ public String getServices() {
+ return services;
+ }
+
+ public String getFavoriteresources() {
+ return favoriteResources;
+ }
+
+ public String getRecentlyviewedresources() {
+ return recentlyViewedResources;
+ }
+
+ public String getSearchresources() {
+ return searchResources;
+ }
+
+ public String getResourcesAfter() {
+ return resources_AFTER;
+ }
+
+ public String getGroupsBefore() {
+ return groups_BEFORE;
+ }
+
+ public String getGroups() {
+ return groups;
+ }
+
+ public String getCompatible() {
+ return compatible;
+ }
+
+ public String getMixed() {
+ return mixed;
+ }
+
+ public String getDefinitions() {
+ return definitions;
+ }
+
+ public String getNewgroup() {
+ return newGroup;
+ }
+
+ public String getNewgroupdefinition() {
+ return newGroupDefinition;
+ }
+
+ public String getFavoritegroups() {
+ return favoriteGroups;
+ }
+
+ public String getRecentlyviewedgroups() {
+ return recentlyViewedGroups;
+ }
+
+ public String getSearchgroups() {
+ return searchGroups;
+ }
+
+ public String getGroupsAfter() {
+ return groups_AFTER;
+ }
+
+ public String getAdministrationBefore() {
+ return administration_BEFORE;
+ }
+
+ public String getAdministration() {
+ return administration;
+ }
+
+ public String getSecurity() {
+ return security;
+ }
+
+ public String getUsers() {
+ return users;
+ }
+
+ public String getRoles() {
+ return roles;
+ }
+
+ public String getSystemconfiguration() {
+ return systemConfiguration;
+ }
+
+ public String getSettings() {
+ return settings;
+ }
+
+ public String getPlugins() {
+ return plugins;
+ }
+
+ public String getTemplates() {
+ return templates;
+ }
+
+ public String getContent() {
+ return content;
+ }
+
+ public String getContentproviders() {
+ return contentProviders;
+ }
+
+ public String getRepositories() {
+ return repositories;
+ }
+
+ public String getHighavailability() {
+ return highAvailability;
+ }
+
+ public String getHaservers() {
+ return haServers;
+ }
+
+ public String getAgents() {
+ return agents;
+ }
+
+ public String getAffinitygroups() {
+ return affinityGroups;
+ }
+
+ public String getPartitionevents() {
+ return partitionEvents;
+ }
+
+ public String getReports() {
+ return reports;
+ }
+
+ public String getResourceversioninventoryreport() {
+ return resourceVersionInventoryReport;
+ }
+
+ public String getDownloads() {
+ return downloads;
+ }
+
+ public String getLicense() {
+ return license;
+ }
+
+ public String getAdministrationAfter() {
+ return administration_AFTER;
+ }
+
+ public String getHelpBefore() {
+ return help_BEFORE;
+ }
+
+ public String getHelp() {
+ return help;
+ }
+
+ public String getOnlinedocumentation() {
+ return onlineDocumentation;
+ }
+
+ public String getOpenasupportcase() {
+ return openASupportCase;
+ }
+
+ public String getAbout() {
+ return about;
+ }
+
+ public String getHelpAfter() {
+ return help_AFTER;
+ }
+
+ public String getRefreshBefore() {
+ return refresh_BEFORE;
+ }
+
+ public String getRefresh() {
+ return refresh;
+ }
+
+ public String getStop() {
+ return stop;
+ }
+
+ public String getRefreshevery1minute() {
+ return refreshEvery1Minute;
+ }
+
+ public String getRefreshevery5minutes() {
+ return refreshEvery5Minutes;
+ }
+
+ public String getRefreshevery10minutes() {
+ return refreshEvery10Minutes;
+ }
+
+ public String getRefreshAfter() {
+ return refresh_AFTER;
+ }
+
+ public String getLoggedinasBefore() {
+ return loggedInAs_BEFORE;
+ }
+
+ public String getLoggedinas() {
+ return loggedInAs;
+ }
+
+ public String getEditdetails() {
+ return editDetails;
+ }
+
+ public String getChangepassword() {
+ return changePassword;
+ }
+
+ public String getLogout() {
+ return logout;
+ }
+
+ public String getLoggedinasAfter() {
+ return loggedInAs_AFTER;
+ }
+
+ //MENU:ExtensionPoints END
+
+ //constants:end
+}
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/perspectives/MenuItem.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/perspectives/MenuItem.java
index ee7cffe..2ba210e 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/perspectives/MenuItem.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/perspectives/MenuItem.java
@@ -18,32 +18,43 @@
*/
package org.rhq.enterprise.gui.perspectives;
-/** Features for each menu item.
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+/** Features for each menu item. A menu item can be as simple as a logo,
+ * menu separator bar or as complicated as a root menu item with an arbitrary
+ * amount of child menuitems.
*
* @author Simeon Pinder
*
*/
public class MenuItem {
- //constants:begin Extension point map
- public static String menu = "menu";
- public static String menu_BEGIN = "menu.BEGIN";
- public static String logo = "menu.logo";
-
- public static String overview_BEFORE = "menu.overview_BEFORE";
- public static String overview = "menu.overview";
-
- public static String resources_BEFORE = "menu.resources_BEFORE";
- public static String resources = "menu.resources";
-
- //constants:end
-
+ //url to icon image
private String iconUrl = "";
+ //width of icon
private int iconWidth = 0;
+ //height of icon
private int iconHeight = 0;
+ //url to direct user to onclick
private String url = "";
+ //The label to be displayed for this menu item
private String name = "";
+ //whether this menu item is to be enabled/visible
private boolean rendered = true;
+ //whether this menuItem represent a menu separator
+ private boolean isMenuSeparator = false;
+ //includes N child MenuItem instances
+ private List<MenuItem> childMenuItems = new ArrayList<MenuItem>();
+ //Stores a unique reference to the ExtensionPoint key for this item.
+ private String extensionKey = "";
+ //whether this menuItem(relevant to top menu items only) is aligned from far left
+ private boolean alignLeft = true;
+
+ //default no args. To satisfy basic bean functionality.
+ MenuItem() {
+ }
MenuItem(String iconUrl, String url, String name) {
this.iconUrl = iconUrl;
@@ -51,6 +62,13 @@ public class MenuItem {
this.name = name;
}
+ MenuItem(String iconUrl, String url, String name, List<MenuItem> children, String key, HashMap<String, MenuItem> map) {
+ this(iconUrl, url, name);
+ children.add(this);
+ map.put(key, this);
+ this.extensionKey = key;
+ }
+
public String getIconUrl() {
return iconUrl;
}
@@ -98,4 +116,36 @@ public class MenuItem {
public void setIconWidth(int iconWidth) {
this.iconWidth = iconWidth;
}
+
+ public boolean isMenuSeparator() {
+ return isMenuSeparator;
+ }
+
+ public void setMenuSeparator(boolean isMenuSeparator) {
+ this.isMenuSeparator = isMenuSeparator;
+ }
+
+ public void setChildMenuItems(List<MenuItem> childMenuItems) {
+ this.childMenuItems = childMenuItems;
+ }
+
+ public List<MenuItem> getChildMenuItems() {
+ return childMenuItems;
+ }
+
+ public String getExtensionKey() {
+ return extensionKey;
+ }
+
+ public void setExtensionKey(String extensionKey) {
+ this.extensionKey = extensionKey;
+ }
+
+ public boolean isAlignLeft() {
+ return alignLeft;
+ }
+
+ public void setAlignLeft(boolean alignLeft) {
+ this.alignLeft = alignLeft;
+ }
}
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/perspectives/PerspectivesMenuUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/perspectives/PerspectivesMenuUIBean.java
index 66560a0..308ad2b 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/perspectives/PerspectivesMenuUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/perspectives/PerspectivesMenuUIBean.java
@@ -19,8 +19,10 @@
package org.rhq.enterprise.gui.perspectives;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
+import java.util.Set;
/**
* Bean dynamically provides menu information used by menu.xhtml. This bean should be viewed
@@ -31,435 +33,293 @@ import java.util.List;
*
*/
public class PerspectivesMenuUIBean {
+
+ //Stores reference to the root menu item
+ private MenuItem CoreMenuBar = null;
+
/* Stores all mapped MenuItem information */
private HashMap<String, MenuItem> menuDefinition = new HashMap<String, MenuItem>();
- /*===== LOGO TO HOME PAGE =====*/
- private MenuItem logo = new MenuItem("/images/JBossLogo_small.png", "", "");
- {
- logo.setIconHeight(21);
- logo.setIconWidth(37);
- menuDefinition.put(MenuItem.logo, logo);
- }
+ // provides MenuItem mapping lookup via bean accessor
+ private MenuItem extensionPoint = null;
- /*===== OVERVIEW =====*/
- private MenuItem overview = new MenuItem("", "", "Overview");
- {
- menuDefinition.put(MenuItem.overview, overview);
- }
- /*===== Overview.BEFORE extension pt. ============= */
- private MenuItem overviewBefore = new MenuItem("", "", "");
- {
- overviewBefore.setRendered(false);//disable to start
- menuDefinition.put(MenuItem.overview_BEFORE, overviewBefore);
- }
+ {//initialization block
+ //Root of core menu
+ MenuItem menu = new MenuItem();
+ menu.setExtensionKey(ExtensionPoints.menu);
+ CoreMenuBar = menu;
+ menuDefinition.put(ExtensionPoints.menu, menu);
- private List<MenuItem> overviewBeforeItems = new ArrayList<MenuItem>();
+ List<MenuItem> attachPoints = menu.getChildMenuItems();
- /****** Overview > SYSTEM VIEWS ******/
- private MenuItem subsystemViews = new MenuItem("", "", "Subsystem Views");
- private List<MenuItem> subsystemMenuItems = new ArrayList<MenuItem>();
- {//initialization block
- //SubsystemView menu items
- String[] subsystemCategories = { "Configure", "Monitor_failed", "Operation", "Flag_blue", "Flag_grey" };
- String[] subsystemPages = { "configurationUpdate", "oobHistory", "operationHistory", "alertHistory",
- "alertDefinitions" };
- String[] subsystemNames = { "Configuration Changes", "Suspect Metrics", "Operations", "Alerts",
- "Alert Definitions" };
- for (int i = 0; i < subsystemPages.length; i++) {
- subsystemMenuItems.add(new MenuItem("/images/icons/" + subsystemCategories[i] + "_16.png",//icon url
- "/rhq/subsystem/" + subsystemPages[i] + ".xhtml", // menu item url
- subsystemNames[i])); //menu item name
+ /*===== LOGO TO HOME PAGE =====*/
+ MenuItem logoBefore = new MenuItem("", "", "", menu.getChildMenuItems(), ExtensionPoints.logo_BEFORE,
+ menuDefinition);
+ logoBefore.setRendered(false);
+ MenuItem logo = new MenuItem("/images/JBossLogo_small.png", "", "", menu.getChildMenuItems(),
+ ExtensionPoints.logo, menuDefinition);
+ logo.setIconHeight(21);
+ logo.setIconWidth(37);
+ MenuItem logoAfter = new MenuItem("", "", "", menu.getChildMenuItems(), ExtensionPoints.logo_AFTER,
+ menuDefinition);
+ logoAfter.setRendered(false);
+ /*===== OVERVIEW =====*/
+ MenuItem overview = new MenuItem("", "", "Overview", menu.getChildMenuItems(), ExtensionPoints.overview,
+ menuDefinition);
+ /*===== Overview.BEFORE extension pt. Ignore same as Logo.after ============= */
+ /*===== OVERVIEW.AFTER =====*/
+ MenuItem overviewAfter = new MenuItem("", "", "", menu.getChildMenuItems(), ExtensionPoints.overview_AFTER,
+ menuDefinition);
+ overviewAfter.setRendered(false);
+
+ /****** Overview > SYSTEM VIEWS ******/
+ MenuItem subsystemViews = new MenuItem("", "", "Subsystem Views", overview.getChildMenuItems(),
+ ExtensionPoints.subsystemViews, menuDefinition);
+ List<MenuItem> subsystemMenuItems = new ArrayList<MenuItem>();
+ {
+ //SubsystemView menu items
+ String[] imageNames = { "Configure", "Monitor_failed", "Operation", "Flag_blue", "Flag_grey" };
+ String[] pageNames = { "configurationUpdate", "oobHistory", "operationHistory", "alertHistory",
+ "alertDefinitions" };
+ String[] menuNames = { "Configuration Changes", "Suspect Metrics", "Operations", "Alerts",
+ "Alert Definitions" };
+ for (int i = 0; i < imageNames.length; i++) {
+ String extKey = null;
+ String name = menuNames[i];
+ if (name.indexOf("Configuration") > -1) {
+ extKey = ExtensionPoints.configurationChanges;
+ }
+ if (name.indexOf("Suspect") > -1) {
+ extKey = ExtensionPoints.suspectMetrics;
+ }
+ if (name.indexOf("Operations") > -1) {
+ extKey = ExtensionPoints.operations;
+ }
+ if (name.indexOf("Alerts") > -1) {
+ extKey = ExtensionPoints.alerts;
+ }
+ if (name.indexOf("Alert") > -1) {
+ extKey = ExtensionPoints.alertDefinitions;
+ }
+ MenuItem m = new MenuItem("/images/icons/" + imageNames[i] + "_16.png",//icon url
+ "/rhq/subsystem/" + pageNames[i] + ".xhtml", // menu item url
+ menuNames[i], subsystemViews.getChildMenuItems(), extKey, menuDefinition); //menu item name
+ }
}
- }
- /* ***** Overview > AUTO-DISCOVERY QUEUE ***** */
- private MenuItem autoDiscoveryQueue = new MenuItem("", "/rhq/discovery/queue.xhtml", "Auto Discovery Queue");;
-
- /* ***** Overview > DASHBOARD ***** */
- private MenuItem dashboard = new MenuItem("", "/Dashboard.do", "Dashboard");
-
- /* ===== RESOURCES ===== */
- private MenuItem resources = new MenuItem("", "", "Resources");
-
- /* Resources: Platform */
- private MenuItem resourcesPlatform = null;
- {
- resourcesPlatform = new MenuItem("/images/icons/Platform_up_16.png",
- "/ResourceHub.do?resourceCategory=PLATFORM", "");
- }
- /* Resources: Server */
- private MenuItem resourcesServer = null;
- {
- resourcesServer = new MenuItem("/images/icons/Server_up_16.png", "/ResourceHub.do?resourceCategory=SERVER", "");
- }
-
- /* Resources: Service */
- private MenuItem resourcesService = null;
- {
- resourcesService = new MenuItem("/images/icons/Service_up_16.png", "/ResourceHub.do?resourceCategory=SERVICE",
- "");
- }
-
- private MenuItem resourcesFavorite = new MenuItem("/images/icons/Favorite_16.png", "", "Favorite Resources");
- private MenuItem resourcesRecentlyViewed = new MenuItem("/images/icons/History_16.png", "",
- "Recently Viewed Resources");
- //TODO: enable?
- private MenuItem resourcesSearch = new MenuItem("/images/icons/History_16.png", "", "Search: ");
-
- /* ===== GROUPS ===== */
- private MenuItem groups = new MenuItem("", "", "Groups");
- private MenuItem groupsCompatible = new MenuItem("/images/icons/Cluster_up_16.png",
- "/GroupHub.do?groupCategory=COMPATIBLE", "");
- private MenuItem groupsMixed = new MenuItem("/images/icons/Group_up_16.png", "/GroupHub.do?groupCategory=MIXED", "");
- private MenuItem groupsDefinitions = new MenuItem("/images/GroupDefinition_16.png",
- "/rhq/definition/group/list.xhtml", "");
- private MenuItem groupsNewResource = new MenuItem("", "/resource/group/Inventory.do?mode=new", "");
- private MenuItem groupsNewDefinition = new MenuItem("", "/rhq/definition/group/new.xhtml", "");
- private MenuItem groupsFavorite = new MenuItem("/images/icons/Favorite_16.png", "", "Favorite Groups");
- private MenuItem groupsRecentlyViewed = new MenuItem("/images/icons/History_16.png", "", "Recently Viewed Groups");
-
- /* ===== ADMINISTRATION ===== */
- private MenuItem security = new MenuItem("", "", "Security");
- private MenuItem securityUsers = new MenuItem("", "/admin/user/UserAdmin.do?mode=list", "Users");
- private MenuItem securityRoles = new MenuItem("", "/admin/role/RoleAdmin.do?mode=list", "Roles");
- private MenuItem sysconfig = new MenuItem("", "", "System Configuration");
- private MenuItem sysconfigSettings = new MenuItem("", "/admin/config/Config.do?mode=edit", "Settings");
- private MenuItem sysconfigPlugins = new MenuItem("", "/rhq/admin/plugin/plugin-list.xhtml", "Plugins");
- private MenuItem sysconfigTemplates = new MenuItem("",
- "/admin/config/EditDefaults.do?mode=monitor&viewMode=all", "Templates");
- private MenuItem content = new MenuItem("", "", "Content");
- private MenuItem contentContentProviders = new MenuItem("", "/rhq/content/listContentProviders.xhtml",
- "Content Providers");
- private MenuItem contentRepositories = new MenuItem("", "/rhq/content/listRepos.xhtml", "Repositories");
- private MenuItem ha = new MenuItem("", "", "High Availability");
- private MenuItem haServers = new MenuItem("", "/rhq/ha/listServers.xhtml", "Servers");
- private MenuItem haAgents = new MenuItem("", "/rhq/ha/listAgents.xhtml", "Agents");
- private MenuItem haAffinityGroups = new MenuItem("", "/rhq/ha/listAffinityGroups.xhtml", "Affinity Groups");
- private MenuItem haPartitionEvents = new MenuItem("", "/rhq/ha/listPartitionEvents.xhtml", "Partition Events");
- private MenuItem reports = new MenuItem("", "", "Reports");
- private MenuItem reportsResourceVersion = new MenuItem("", "/rhq/admin/report/resourceInstallReport.xhtml",
- "Resource Version Inventory Report");
- private MenuItem downloads = new MenuItem("/images/icons/Save_16.png", "/rhq/admin/downloads.xhtml", "Downloads");
- private MenuItem license = new MenuItem("", "/admin/license/LicenseAdmin.do?mode=view", "License");
-
- public List<MenuItem> getSubsystemMenuItems() {
- return subsystemMenuItems;
- }
-
- public void setSubsystemMenuItems(List<MenuItem> subsystemMenuItems) {
- this.subsystemMenuItems = subsystemMenuItems;
- }
-
- public MenuItem getAutoDiscoveryQueue() {
- return autoDiscoveryQueue;
- }
-
- public void setAutoDiscoveryQueue(MenuItem autoDiscoveryQueue) {
- this.autoDiscoveryQueue = autoDiscoveryQueue;
- }
-
- public MenuItem getDashboard() {
- return dashboard;
- }
-
- public void setDashboard(MenuItem dashboard) {
- this.dashboard = dashboard;
- }
-
- public MenuItem getResourcesPlatform() {
- return resourcesPlatform;
- }
-
- public void setResourcesPlatform(MenuItem resourcesPlatform) {
- this.resourcesPlatform = resourcesPlatform;
- }
-
- public MenuItem getResourcesServer() {
- return resourcesServer;
- }
-
- public void setResourcesServer(MenuItem resourcesServer) {
- this.resourcesServer = resourcesServer;
- }
-
- public MenuItem getResourcesService() {
- return resourcesService;
- }
-
- public void setResourcesService(MenuItem resourcesService) {
- this.resourcesService = resourcesService;
- }
-
- public MenuItem getGroups() {
- return groups;
- }
-
- public void setGroups(MenuItem groups) {
- this.groups = groups;
- }
-
- public MenuItem getGroupsCompatible() {
- return groupsCompatible;
- }
-
- public void setGroupsCompatible(MenuItem groupsCompatible) {
- this.groupsCompatible = groupsCompatible;
- }
-
- public MenuItem getGroupsMixed() {
- return groupsMixed;
- }
-
- public void setGroupsMixed(MenuItem groupsMixed) {
- this.groupsMixed = groupsMixed;
- }
-
- public MenuItem getGroupsDefinitions() {
- return groupsDefinitions;
- }
-
- public void setGroupsDefinitions(MenuItem groupsDefinitions) {
- this.groupsDefinitions = groupsDefinitions;
- }
-
- public MenuItem getGroupsNewResource() {
- return groupsNewResource;
- }
-
- public void setGroupsNewResource(MenuItem groupsNewResource) {
- this.groupsNewResource = groupsNewResource;
- }
-
- public MenuItem getGroupsNewDefinition() {
- return groupsNewDefinition;
- }
-
- public void setGroupsNewDefinition(MenuItem groupsNewDefinition) {
- this.groupsNewDefinition = groupsNewDefinition;
- }
-
- public MenuItem getLogo() {
- return logo;
- }
-
- public void setLogo(MenuItem logo) {
- this.logo = logo;
- }
-
- public MenuItem getOverview() {
- return overview;
- }
-
- public void setOverview(MenuItem overview) {
- this.overview = overview;
- }
-
- public MenuItem getSubsystemViews() {
- return subsystemViews;
- }
-
- public void setSubsystemViews(MenuItem subsystemViews) {
- this.subsystemViews = subsystemViews;
- }
-
- public MenuItem getResources() {
- return resources;
- }
-
- public void setResources(MenuItem resources) {
- this.resources = resources;
- }
-
- public MenuItem getResourcesFavorite() {
- return resourcesFavorite;
- }
-
- public void setResourcesFavorite(MenuItem resourcesFavorite) {
- this.resourcesFavorite = resourcesFavorite;
- }
-
- public MenuItem getResourcesRecentlyViewed() {
- return resourcesRecentlyViewed;
- }
-
- public void setResourcesRecentlyViewed(MenuItem resourcesRecentlyViewed) {
- this.resourcesRecentlyViewed = resourcesRecentlyViewed;
- }
-
- public MenuItem getGroupsFavorite() {
- return groupsFavorite;
- }
-
- public void setGroupsFavorite(MenuItem groupsFavorite) {
- this.groupsFavorite = groupsFavorite;
- }
-
- public MenuItem getGroupsRecentlyViewed() {
- return groupsRecentlyViewed;
- }
-
- public void setGroupsRecentlyViewed(MenuItem groupsRecentlyViewed) {
- this.groupsRecentlyViewed = groupsRecentlyViewed;
- }
-
- public MenuItem getResourcesSearch() {
- return resourcesSearch;
- }
-
- public void setResourcesSearch(MenuItem resourcesSearch) {
- this.resourcesSearch = resourcesSearch;
- }
-
- public MenuItem getSecurity() {
- return security;
- }
-
- public void setSecurity(MenuItem security) {
- this.security = security;
- }
-
- public MenuItem getSecurityUsers() {
- return securityUsers;
- }
-
- public void setSecurityUsers(MenuItem securityUsers) {
- this.securityUsers = securityUsers;
- }
-
- public MenuItem getSecurityRoles() {
- return securityRoles;
- }
-
- public void setSecurityRoles(MenuItem securityRoles) {
- this.securityRoles = securityRoles;
- }
-
- public MenuItem getSysconfig() {
- return sysconfig;
- }
-
- public void setSysconfig(MenuItem sysconfig) {
- this.sysconfig = sysconfig;
- }
-
- public MenuItem getSysconfigSettings() {
- return sysconfigSettings;
- }
-
- public void setSysconfigSettings(MenuItem sysconfigSettings) {
- this.sysconfigSettings = sysconfigSettings;
- }
-
- public MenuItem getSysconfigPlugins() {
- return sysconfigPlugins;
- }
-
- public void setSysconfigPlugins(MenuItem sysconfigPlugins) {
- this.sysconfigPlugins = sysconfigPlugins;
- }
-
- public MenuItem getSysconfigTemplates() {
- return sysconfigTemplates;
- }
-
- public void setSysconfigTemplates(MenuItem sysconfigTemplates) {
- this.sysconfigTemplates = sysconfigTemplates;
- }
-
- public MenuItem getContent() {
- return content;
- }
-
- public void setContent(MenuItem content) {
- this.content = content;
- }
-
- public MenuItem getContentContentProviders() {
- return contentContentProviders;
- }
-
- public void setContentContentProviders(MenuItem contentContentProviders) {
- this.contentContentProviders = contentContentProviders;
- }
-
- public MenuItem getContentRepositories() {
- return contentRepositories;
- }
-
- public void setContentRepositories(MenuItem contentRepositories) {
- this.contentRepositories = contentRepositories;
- }
-
- public MenuItem getHa() {
- return ha;
- }
-
- public void setHa(MenuItem ha) {
- this.ha = ha;
- }
-
- public MenuItem getHaServers() {
- return haServers;
- }
-
- public void setHaServers(MenuItem haServers) {
- this.haServers = haServers;
- }
-
- public MenuItem getHaAgents() {
- return haAgents;
- }
-
- public void setHaAgents(MenuItem haAgents) {
- this.haAgents = haAgents;
- }
-
- public MenuItem getHaAffinityGroups() {
- return haAffinityGroups;
- }
-
- public void setHaAffinityGroups(MenuItem haAffinityGroups) {
- this.haAffinityGroups = haAffinityGroups;
- }
-
- public MenuItem getHaPartitionEvents() {
- return haPartitionEvents;
- }
-
- public void setHaPartitionEvents(MenuItem haPartitionEvents) {
- this.haPartitionEvents = haPartitionEvents;
- }
-
- public MenuItem getReports() {
- return reports;
- }
-
- public void setReports(MenuItem reports) {
- this.reports = reports;
- }
-
- public MenuItem getReportsResourceVersion() {
- return reportsResourceVersion;
- }
-
- public void setReportsResourceVersion(MenuItem reportsResourceVersion) {
- this.reportsResourceVersion = reportsResourceVersion;
- }
-
- public MenuItem getDownloads() {
- return downloads;
- }
-
- public void setDownloads(MenuItem downloads) {
- this.downloads = downloads;
- }
-
- public MenuItem getLicense() {
- return license;
- }
-
- public void setLicense(MenuItem license) {
- this.license = license;
+ /* ***** Overview > AUTO-DISCOVERY QUEUE ***** */
+ MenuItem autoDiscoveryQueue = new MenuItem("", "/rhq/discovery/queue.xhtml", "Auto Discovery Queue", overview
+ .getChildMenuItems(), ExtensionPoints.autoDiscoveryQueue, menuDefinition);
+
+ /* ***** Overview > DASHBOARD ***** */
+ MenuItem dashboard = new MenuItem("", "/Dashboard.do", "Dashboard", overview.getChildMenuItems(),
+ ExtensionPoints.dashboard, menuDefinition);
+
+ /* ===== RESOURCES ===== */
+ MenuItem resources = new MenuItem("", "", "Resources", menu.getChildMenuItems(), ExtensionPoints.resources,
+ menuDefinition);
+ /*===== RESOURCES.BEFORE extension pt. Ignore same as Overvie.after ============= */
+ /*===== Resources.AFTER =====*/
+ MenuItem resourcesAfter = new MenuItem("", "", "", menu.getChildMenuItems(), ExtensionPoints.resources_AFTER,
+ menuDefinition);
+ resourcesAfter.setRendered(false);
+
+ /* Resources: Platform */
+ MenuItem resourcesPlatform = new MenuItem("/images/icons/Platform_up_16.png",
+ "/ResourceHub.do?resourceCategory=PLATFORM", "", resources.getChildMenuItems(), ExtensionPoints.platforms,
+ menuDefinition);
+ /* Resources: Server */
+ MenuItem resourcesServer = new MenuItem("/images/icons/Server_up_16.png",
+ "/ResourceHub.do?resourceCategory=SERVER", "", resources.getChildMenuItems(), ExtensionPoints.servers,
+ menuDefinition);
+ /* Resources: Service */
+ MenuItem resourcesService = new MenuItem("/images/icons/Service_up_16.png",
+ "/ResourceHub.do?resourceCategory=SERVICE", "", resources.getChildMenuItems(), ExtensionPoints.services,
+ menuDefinition);
+ // Menu bar separator
+ MenuItem separator = new MenuItem("", "", "");
+ separator.setMenuSeparator(true);
+ resources.getChildMenuItems().add(separator);
+ /* Resources: Favorites */
+ MenuItem resourcesFavorite = new MenuItem("/images/icons/Favorite_16.png", "", "Favorite Resources", resources
+ .getChildMenuItems(), ExtensionPoints.favoriteResources, menuDefinition);
+ /* Resources: Recently Viewed */
+ MenuItem resourcesRecentlyViewed = new MenuItem("/images/icons/History_16.png", "",
+ "Recently Viewed Resources", resources.getChildMenuItems(), ExtensionPoints.recentlyViewedResources,
+ menuDefinition);
+ //ADD Menu bar separator
+ resources.getChildMenuItems().add(separator);
+ /* Resources: Search */
+ MenuItem resourcesSearch = new MenuItem("", "", "Search: ", resources.getChildMenuItems(),
+ ExtensionPoints.searchResources, menuDefinition);
+
+ /* ===== GROUPS ===== */
+ MenuItem groups = new MenuItem("", "", "Groups", menu.getChildMenuItems(), ExtensionPoints.groups,
+ menuDefinition);
+ /*===== Groups.BEFORE extension pt. Ignore same as Overvie.after ============= */
+ /*===== Groups.AFTER =====*/
+ MenuItem groupsAfter = new MenuItem("", "", "", menu.getChildMenuItems(), ExtensionPoints.groups_AFTER,
+ menuDefinition);
+ groupsAfter.setRendered(false);
+ /* GROUPS: Compatible */
+ MenuItem groupsCompatible = new MenuItem("/images/icons/Cluster_up_16.png",
+ "/GroupHub.do?groupCategory=COMPATIBLE", "", groups.getChildMenuItems(), ExtensionPoints.compatible,
+ menuDefinition);
+ /* GROUPS: Mixed */
+ MenuItem groupsMixed = new MenuItem("/images/icons/Group_up_16.png", "/GroupHub.do?groupCategory=MIXED", "",
+ groups.getChildMenuItems(), ExtensionPoints.mixed, menuDefinition);
+ /* GROUPS: Group Definitions */
+ MenuItem groupsDefinitions = new MenuItem("/images/GroupDefinition_16.png", "/rhq/definition/group/list.xhtml",
+ "", groups.getChildMenuItems(), ExtensionPoints.definitions, menuDefinition);
+ /* GROUPS: New Group */
+ MenuItem groupsNewResource = new MenuItem("", "/resource/group/Inventory.do?mode=new", "", groups
+ .getChildMenuItems(), ExtensionPoints.newGroup, menuDefinition);
+ /* GROUPS: New Group Definition */
+ MenuItem groupsNewDefinition = new MenuItem("", "/rhq/definition/group/new.xhtml", "", groups
+ .getChildMenuItems(), ExtensionPoints.newGroupDefinition, menuDefinition);
+ // Menu bar separator
+ groups.getChildMenuItems().add(separator);
+
+ /* GROUPS: Favorites */
+ MenuItem groupsFavorite = new MenuItem("/images/icons/Favorite_16.png", "", "Favorite Groups", groups
+ .getChildMenuItems(), ExtensionPoints.favoriteGroups, menuDefinition);
+ /* GROUPS: Recently Viewed */
+ MenuItem groupsRecentlyViewed = new MenuItem("/images/icons/History_16.png", "", "Recently Viewed Groups",
+ groups.getChildMenuItems(), ExtensionPoints.recentlyViewedGroups, menuDefinition);
+ // Menu bar separator
+ groups.getChildMenuItems().add(separator);
+ /* GROUPS: Recently Viewed */
+ MenuItem groupsSearch = new MenuItem("", "", "Search", groups.getChildMenuItems(),
+ ExtensionPoints.searchGroups, menuDefinition);
+
+ /* ===== ADMINISTRATION ===== */
+ MenuItem administration = new MenuItem("", "", "Administration", menu.getChildMenuItems(),
+ ExtensionPoints.administration, menuDefinition);
+ /*===== ADMINISTRATION.BEFORE extension pt. Ignore same as Groups.after ============= */
+ /*===== ADMINISTRATION.AFTER =====*/
+ MenuItem administrationAfter = new MenuItem("", "", "", menu.getChildMenuItems(),
+ ExtensionPoints.administration_AFTER, menuDefinition);
+ administrationAfter.setRendered(false);
+ MenuItem security = new MenuItem("", "", "Security", administration.getChildMenuItems(),
+ ExtensionPoints.security, menuDefinition);
+ MenuItem securityUsers = new MenuItem("", "/admin/user/UserAdmin.do?mode=list", "Users", security
+ .getChildMenuItems(), ExtensionPoints.users, menuDefinition);
+ MenuItem securityRoles = new MenuItem("", "/admin/role/RoleAdmin.do?mode=list", "Roles", security
+ .getChildMenuItems(), ExtensionPoints.roles, menuDefinition);
+ MenuItem sysconfig = new MenuItem("", "", "System Configuration", administration.getChildMenuItems(),
+ ExtensionPoints.systemConfiguration, menuDefinition);
+ MenuItem sysconfigSettings = new MenuItem("", "/admin/config/Config.do?mode=edit", "Settings", sysconfig
+ .getChildMenuItems(), ExtensionPoints.settings, menuDefinition);
+ MenuItem sysconfigPlugins = new MenuItem("", "/rhq/admin/plugin/plugin-list.xhtml", "Plugins", sysconfig
+ .getChildMenuItems(), ExtensionPoints.plugins, menuDefinition);
+ MenuItem sysconfigTemplates = new MenuItem("", "/admin/config/EditDefaults.do?mode=monitor&viewMode=all",
+ "Templates", sysconfig.getChildMenuItems(), ExtensionPoints.templates, menuDefinition);
+ MenuItem content = new MenuItem("", "", "Content", administration.getChildMenuItems(), ExtensionPoints.content,
+ menuDefinition);
+ MenuItem contentContentProviders = new MenuItem("", "/rhq/content/listContentProviders.xhtml",
+ "Content Providers", content.getChildMenuItems(), ExtensionPoints.contentProviders, menuDefinition);
+ MenuItem contentRepositories = new MenuItem("", "/rhq/content/listRepos.xhtml", "Repositories", content
+ .getChildMenuItems(), ExtensionPoints.repositories, menuDefinition);
+ MenuItem ha = new MenuItem("", "", "High Availability", administration.getChildMenuItems(),
+ ExtensionPoints.highAvailability, menuDefinition);
+ MenuItem haServers = new MenuItem("", "/rhq/ha/listServers.xhtml", "Servers", ha.getChildMenuItems(),
+ ExtensionPoints.haServers, menuDefinition);
+ MenuItem haAgents = new MenuItem("", "/rhq/ha/listAgents.xhtml", "Agents", ha.getChildMenuItems(),
+ ExtensionPoints.agents, menuDefinition);
+ MenuItem haAffinityGroups = new MenuItem("", "/rhq/ha/listAffinityGroups.xhtml", "Affinity Groups", ha
+ .getChildMenuItems(), ExtensionPoints.affinityGroups, menuDefinition);
+ MenuItem haPartitionEvents = new MenuItem("", "/rhq/ha/listPartitionEvents.xhtml", "Partition Events", ha
+ .getChildMenuItems(), ExtensionPoints.partitionEvents, menuDefinition);
+ MenuItem reports = new MenuItem("", "", "Reports", administration.getChildMenuItems(), ExtensionPoints.reports,
+ menuDefinition);
+ MenuItem reportsResourceVersion = new MenuItem("", "/rhq/admin/report/resourceInstallReport.xhtml",
+ "Resource Version Inventory Report", reports.getChildMenuItems(),
+ ExtensionPoints.resourceVersionInventoryReport, menuDefinition);
+ MenuItem downloads = new MenuItem("/images/icons/Save_16.png", "/rhq/admin/downloads.xhtml", "Downloads",
+ administration.getChildMenuItems(), ExtensionPoints.downloads, menuDefinition);
+ MenuItem license = new MenuItem("", "/admin/license/LicenseAdmin.do?mode=view", "License", administration
+ .getChildMenuItems(), ExtensionPoints.license, menuDefinition);
+
+ //* ------------- DEBUG ------------------- *//
+ /*===== DEBUG.BEFORE extension pt. Ignore same as Administration.after ============= */
+ MenuItem debug = new MenuItem("", "", "Debug", menu.getChildMenuItems(), ExtensionPoints.debug, menuDefinition);
+ MenuItem sqlInterface = new MenuItem("", "/admin/test/sql.jsp", "SQL Interface", debug.getChildMenuItems(),
+ ExtensionPoints.sqlInterface, menuDefinition);
+ MenuItem jpqlHibernateInterface = new MenuItem("", "/admin/test/hibernate.jsp", "JPQL/HQL Interface", debug
+ .getChildMenuItems(), ExtensionPoints.jpqlHqlInterface, menuDefinition);
+ MenuItem hibernate = new MenuItem("", "/admin/test/browser.jsp", "Hibernate Entity Browser", debug
+ .getChildMenuItems(), ExtensionPoints.hibernate, menuDefinition);
+ MenuItem administrativeControl = new MenuItem("", "/admin/test/control.jsp", "Administrative Control", debug
+ .getChildMenuItems(), ExtensionPoints.administrativeControl, menuDefinition);
+ MenuItem testEmail = new MenuItem("", "/admin/test/email.jsp", "Test Email Configuration", debug
+ .getChildMenuItems(), ExtensionPoints.testEmail, menuDefinition);
+ MenuItem testAgent = new MenuItem("", "/admin/test/agent.jsp", "Test Agent Communications", debug
+ .getChildMenuItems(), ExtensionPoints.testAgent, menuDefinition);
+ /*===== DEBUG.AFTER =====*/
+ MenuItem debugAfter = new MenuItem("", "", "", menu.getChildMenuItems(), ExtensionPoints.debug_AFTER,
+ menuDefinition);
+ debugAfter.setRendered(false);
+
+ //* ------------- HELP ------------------- *//
+ /*===== HELP.BEFORE extension pt. Ignore same as Administration.after ============= */
+ MenuItem help = new MenuItem("", "", "Help", attachPoints, ExtensionPoints.help, menuDefinition);
+ /*===== HELP.AFTER =====*/
+ MenuItem helpAfter = new MenuItem("", "", "", attachPoints, ExtensionPoints.help_AFTER, menuDefinition);
+ helpAfter.setRendered(false);
+ MenuItem onlineDoc = new MenuItem("", "http://www.redhat.com/docs/en-US/JBoss_ON/", "Online Documentation",
+ help.getChildMenuItems(), ExtensionPoints.help, menuDefinition);
+ MenuItem support = new MenuItem("", "https://support.redhat.com/jbossnetwork/restricted/addCase.html",
+ "Open a Support Case", help.getChildMenuItems(), ExtensionPoints.openASupportCase, menuDefinition);
+ // Menu bar separator
+ help.getChildMenuItems().add(separator);
+ MenuItem about = new MenuItem("/images/icons/availability_grey_16.png", "", "", help.getChildMenuItems(),
+ ExtensionPoints.about, menuDefinition);
+
+ //* ------------- REFRESH ------------------- *//
+ /*===== REFRESH.BEFORE extension pt. ============= */
+ MenuItem refreshBefore = new MenuItem("", "", "", menu.getChildMenuItems(), ExtensionPoints.refresh_BEFORE,
+ menuDefinition);
+ refreshBefore.setRendered(false);
+ refreshBefore.setAlignLeft(false);
+ MenuItem refresh = new MenuItem("", "", "", attachPoints, ExtensionPoints.refresh, menuDefinition);
+ refresh.setAlignLeft(false);
+ /*===== HELP.AFTER =====*/
+ MenuItem refreshAfter = new MenuItem("", "", "", attachPoints, ExtensionPoints.refresh_AFTER, menuDefinition);
+ refreshAfter.setRendered(false);
+ refreshAfter.setAlignLeft(false);
+ MenuItem stop = new MenuItem("", "", "Stop", refresh.getChildMenuItems(), ExtensionPoints.stop, menuDefinition);
+ MenuItem refresh1 = new MenuItem("", "", "Refresh every 1 minute", refresh.getChildMenuItems(),
+ ExtensionPoints.refreshEvery1Minute, menuDefinition);
+ MenuItem refresh5 = new MenuItem("", "", "Refresh every 5 minutes", refresh.getChildMenuItems(),
+ ExtensionPoints.refreshEvery5Minutes, menuDefinition);
+ MenuItem refresh10 = new MenuItem("", "", "Refresh every 10 minutes", refresh.getChildMenuItems(),
+ ExtensionPoints.refreshEvery10Minutes, menuDefinition);
+
+ //* ------------- IS LOGGED IN ------------------- *//
+ /*===== IS LOGGED IN.BEFORE extension pt. Ignore same as refresh.after ============= */
+ MenuItem loggedIn = new MenuItem("", "", "", attachPoints, ExtensionPoints.loggedInAs, menuDefinition);
+ loggedIn.setAlignLeft(false);
+ /*===== IS LOGGED IN.AFTER =====*/
+ MenuItem loggedInAfter = new MenuItem("", "", "", attachPoints, ExtensionPoints.loggedInAs_AFTER,
+ menuDefinition);
+ loggedInAfter.setRendered(false);
+ loggedInAfter.setAlignLeft(false);
+ MenuItem edit = new MenuItem("", "", "Edit Details", loggedIn.getChildMenuItems(), ExtensionPoints.stop,
+ menuDefinition);
+ MenuItem change = new MenuItem("", "", "Change Password", loggedIn.getChildMenuItems(),
+ ExtensionPoints.refreshEvery1Minute, menuDefinition);
+ // Menu bar separator
+ loggedIn.getChildMenuItems().add(separator);
+ MenuItem logout = new MenuItem("", "/Logout.do", "Logout", loggedIn.getChildMenuItems(),
+ ExtensionPoints.refreshEvery5Minutes, menuDefinition);
+
+ }
+
+ public MenuItem getCoreMenuBar() {
+ return CoreMenuBar;
+ }
+
+ public void setCoreMenuBar(MenuItem coreMenuBar) {
+ CoreMenuBar = coreMenuBar;
}
public HashMap<String, MenuItem> getMenuDefinition() {
@@ -470,19 +330,35 @@ public class PerspectivesMenuUIBean {
this.menuDefinition = menuDefinition;
}
- public MenuItem getOverviewBefore() {
- return overviewBefore;
- }
-
- public void setOverviewBefore(MenuItem overviewBefore) {
- this.overviewBefore = overviewBefore;
- }
-
- public List<MenuItem> getOverviewBeforeItems() {
- return overviewBeforeItems;
+ public static void main(String[] args) {
+ PerspectivesMenuUIBean bean = new PerspectivesMenuUIBean();
+ // System.out.println("Bean:" + bean);
+ MenuItem coreMenu = bean.getCoreMenuBar();
+ HashMap<String, MenuItem> definition = bean.getMenuDefinition();
+ //iterate over the coreMenu recursively
+ recurse(coreMenu, "(TOP)");
+ //iterate over the map and display the values
+ Set<String> keys = definition.keySet();
+ ArrayList<String> list = new ArrayList<String>(keys);
+ Collections.sort(list);
+ System.out.println("\n Key listing [" + keys.size() + " item(s)] \n");
+ for (String key : list) {
+ System.out.println("KEY:" + key + "=" + definition.get(key));
+ }
}
- public void setOverviewBeforeItems(List<MenuItem> overviewBeforeItems) {
- this.overviewBeforeItems = overviewBeforeItems;
+ private static void recurse(MenuItem menu, String prefix) {
+ if ((menu != null)) {
+ //base case: leaf
+ if (menu.getChildMenuItems().size() == 0) {
+ System.out.println(prefix + "#" + menu.getName() + ":" + menu.getExtensionKey() + ":");
+ } else {
+ System.out.println(prefix + "[DIR-(" + menu.getChildMenuItems().size() + ")]" + menu.getName() + ":"
+ + menu.getExtensionKey() + ":");
+ for (MenuItem child : menu.getChildMenuItems()) {
+ recurse(child, prefix + "\t");
+ }
+ }
+ }
}
}
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/perspectives-beans.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/perspectives-beans.xml
index 53c0d31..a8ab990 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/perspectives-beans.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/perspectives-beans.xml
@@ -10,5 +10,10 @@
<managed-bean-class>org.rhq.enterprise.gui.perspectives.PerspectivesMenuUIBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
-
+ <managed-bean>
+ <managed-bean-name>ExtensionPoints</managed-bean-name>
+ <managed-bean-class>org.rhq.enterprise.gui.perspectives.ExtensionPoints</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
+
</faces-config>
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/menu/menu.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/menu/menu.xhtml
index 5a7e438..3beaf09 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/menu/menu.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/menu/menu.xhtml
@@ -14,579 +14,456 @@
<f:loadBundle basename="ApplicationResources" var="msg" />
-
- <rich:toolBar styleClass="topMenu">
- <rich:toolBarGroup location="left">
-
- <ui:remove>===== LOGO TO HOME PAGE =====</ui:remove>
-
- <h:outputLink value="/">
- <h:graphicImage value="#{PerspectivesMenuUIBean.logo.iconUrl}"
- width="#{PerspectivesMenuUIBean.logo.iconWidth}"
- height="#{PerspectivesMenuUIBean.logo.iconHeight}"
- rendered="#{PerspectivesMenuUIBean.logo.rendered}" />
- </h:outputLink>
-
- <ui:remove>===== OVERVIEW.BEFORE =====</ui:remove>
- <c:if test="#{PerspectivesMenuUIBean.overviewBefore.rendered}">
- <rich:dropDownMenu>
- <f:facet name="label">
- <h:panelGroup>
- <h:outputText
- value="#{PerspectivesMenuUIBean.overviewBefore.name}"
- rendered="#{PerspectivesMenuUIBean.overviewBefore.rendered}" />
- </h:panelGroup>
+ <rich:toolBar styleClass="topMenu">
+ <rich:toolBarGroup location="left">
+
+ <ui:remove>===== If the component is enabled i.e. rendered==true =====</ui:remove>
+ <c:if test="#{PerspectivesMenuUIBean.coreMenuBar.rendered}">
+ <ui:remove>===== If CoreMenu UI hasn't been disabled =====</ui:remove>
+ <ui:remove>===== Iterate through children[Top Menu Items] =====</ui:remove>
+ <c:forEach var="top"
+ items="#{PerspectivesMenuUIBean.coreMenuBar.childMenuItems}">
+ <c:if test="#{top.rendered and top.alignLeft}">
+ <ui:remove>===== LOGO TO HOME PAGE or other top-level-image menu item =====</ui:remove>
+ <c:if test="#{ExtensionPoints.logo == top.extensionKey or 'top-level-image' == top.extensionKey}">
+ <h:outputLink value="/">
+ <h:graphicImage value="#{top.iconUrl}"
+ width="#{top.iconWidth}"
+ height="#{top.iconHeight}"
+ rendered="#{top.rendered}" />
+ </h:outputLink>
+ </c:if>
+ <ui:remove>===== DEBUG top-level menu item =====</ui:remove>
+ <c:if test="#{ExtensionPoints.debug == top.extensionKey}">
+ <rich:dropDownMenu rendered="#{GlobalPermissionsUIBean.superuser and
+ GlobalPermissionsUIBean.debugMode}">
+ <f:facet name="label">
+ <h:panelGroup>
+ <h:outputText value="#{top.name}"/>
+ </h:panelGroup>
+ </f:facet>
+ <c:forEach var="child"
+ items="#{top.childMenuItems}">
+ <rich:menuItem submitMode="none"
+ icon="#{child.iconUrl}"
+ width="#{child.iconWidth}" height="#{child.iconHeight}"
+ onclick="window.open('#{child.url}')"
+ target="blank_">
+ <h:outputText value="#{child.name}"/>
+ </rich:menuItem>
+ </c:forEach>
+ </rich:dropDownMenu>
+ </c:if>
+ <c:if test="#{ExtensionPoints.logo != top.extensionKey and ExtensionPoints.debug != top.extensionKey}">
+ <rich:dropDownMenu>
+ <f:facet name="label">
+ <h:panelGroup>
+ <c:choose>
+ <ui:remove>= logic for administration =</ui:remove>
+ <c:when test="${ExtensionPoints.administration == top.extensionKey}">
+ <h:outputText value="#{msg['admin.admin.AdministrationTitle']}"/>
+ </c:when>
+ <ui:remove>= logic for help =</ui:remove>
+ <c:when test="${ExtensionPoints.help == top.extensionKey}">
+ <h:outputText value="#{msg['header.help.link']}"/>
+ </c:when>
+ <c:otherwise>
+ <h:outputText value="#{top.name}"/>
+ </c:otherwise>
+ </c:choose>
+ </h:panelGroup>
</f:facet>
- <c:forEach var="item"
- items="#{PerspectivesMenuUIBean.overviewBeforeItems}">
- <rich:menuItem submitMode="none" icon="#{item.iconUrl}"
- width="#{item.iconWidth}" height="#{item.iconHeight}"
- rendered="#{item.rendered}"
- onclick="window.location = '#{item.url}'">
- <h:outputText value="#{item.name}" />
- </rich:menuItem>
+ <ui:remove> Now process the children MenuItems if they exist </ui:remove>
+
+ <c:forEach var="child"
+ items="#{top.childMenuItems}">
+ <c:if test="#{child.rendered}">
+ <c:choose>
+ <c:when test="${child.childMenuItems.size > 0}">
+ <rich:menuGroup value="#{child.name}">
+ <c:forEach var="grandchild"
+ items="#{child.childMenuItems}">
+ <rich:menuItem submitMode="none" icon="#{grandchild.iconUrl}"
+ width="#{grandchild.iconWidth}" height="#{grandchild.iconHeight}"
+ onclick="window.location = '#{grandchild.url}'">
+ <h:outputText value="#{grandchild.name}" />
+ </rich:menuItem>
+ </c:forEach>
+ </rich:menuGroup>
+ </c:when>
+ <c:otherwise>
+ <c:choose>
+ <ui:remove>= logic for platforms =</ui:remove>
+ <c:when test="${ExtensionPoints.platforms == child.extensionKey}">
+ <rich:menuItem submitMode="none" icon="#{child.iconUrl}"
+ width="#{child.iconWidth}" height="#{child.iconHeight}"
+ onclick="window.location = '#{child.url}'">
+ <h:outputText value="#{msg['resource.hub.filter.platform']}"/>
+ </rich:menuItem>
+ </c:when>
+ <ui:remove>= logic for servers =</ui:remove>
+ <c:when test="${ExtensionPoints.servers == child.extensionKey}">
+ <rich:menuItem submitMode="none" icon="#{child.iconUrl}"
+ width="#{child.iconWidth}" height="#{child.iconHeight}"
+ onclick="window.location = '#{child.url}'">
+ <h:outputText value="#{msg['resource.hub.filter.server']}"/>
+ </rich:menuItem>
+ </c:when>
+ <ui:remove>= logic for services =</ui:remove>
+ <c:when test="${ExtensionPoints.services == child.extensionKey}">
+ <rich:menuItem submitMode="none" icon="#{child.iconUrl}"
+ width="#{child.iconWidth}" height="#{child.iconHeight}"
+ onclick="window.location = '#{child.url}'">
+ <h:outputText value="#{msg['resource.hub.filter.service']}"/>
+ </rich:menuItem>
+ </c:when>
+ <c:when test="#{child.menuSeparator}">
+ <rich:menuSeparator/>
+ </c:when>
+ <c:when test="${ExtensionPoints.favoriteresources == child.extensionKey}">
+ <rich:menuGroup value="#{child.name}" icon="#{child.iconUrl}"
+ width="#{child.iconWidth}" height="#{child.iconHeight}">
+ <c:forEach var="resource" items="#{UserPreferencesUIBean.resourceFavorites}">
+ <rich:menuItem submitMode="none"
+ icon="/images/icons/#{resource.resourceType.category}_up_16.png"
+ onclick="window.location = '#{onf:getDefaultResourceTabURL()}?id=#{resource.id}'">
+ <h:outputText value="#{resource.name}"/>
+ </rich:menuItem>
+ </c:forEach>
+ </rich:menuGroup>
+ </c:when>
+ <c:when test="${ExtensionPoints.recentlyviewedresources == child.extensionKey}">
+ <ui:remove>***** Resources > Recently Viewed *****</ui:remove>
+ <rich:menuGroup value="#{child.name}" icon="#{child.iconUrl}"
+ width="#{child.iconWidth}" height="#{child.iconHeight}">
+ <c:forEach var="visit" items="#{UserPreferencesUIBean.recentVisits}">
+ <c:if test="#{visit.kind == 'PLATFORM' or visit.kind == 'SERVER' or visit.kind == 'SERVICE'}">
+ <rich:menuItem submitMode="none"
+ icon="/images/icons/#{visit.kind.displayName}_up_16.png"
+ onclick="window.location = '#{onf:getDefaultResourceTabURL()}?id=#{visit.id}'">
+ <h:outputText value="#{visit.name}"/>
+ </rich:menuItem>
+ </c:if>
+ </c:forEach>
+ </rich:menuGroup>
+ </c:when>
+ <c:when test="${ExtensionPoints.searchresources == child.extensionKey}">
+ <ui:remove>***** Resources > SEARCH *****</ui:remove>
+ <rich:menuItem submitMode="none" disabled="true" iconDisabled="/images/icons/Search_16.png">
+ <h:outputText value="Search: " style="color: black;"/>
+ <h:panelGroup>
+ <h:inputText id="selectedResource" style="width: 250px;" immediate="true"
+ onkeypress="return ignoreEnterKey(event);" />
+ <rich:suggestionbox id="resourceSelectBox" for="selectedResource" tokens=",[]"
+ ajaxSingle="true" immediate="true"
+ suggestionAction="#{ResourceSelectUIBean.autocomplete}"
+ var="result" data="foo" fetchValue="#{result.resource.id}"
+ nothingLabel="No matching resources found"
+ style="background-color: #cccccc;"
+ onselect="document.location.href='#{onf:getDefaultResourceTabURL()}?id=' + #{rich:element('selectedResource')}.value"
+ usingSuggestObjects="false" width="700" height="400">
+ <h:column>
+ <f:facet name="header">Avail</f:facet>
+ <h:graphicImage
+ value="/images/icons/availability_#{result.availability == 'UP' ? 'green' : 'red'}_16.png"/>
+ </h:column>
+ <h:column>
+ <f:facet name="header">Resource</f:facet>
+ <h:outputText value="#{result.resource.name}"/>
+ </h:column>
+ <h:column>
+ <f:facet name="header">Parent</f:facet>
+ <h:outputText value="#{result.parent.name}"/>
+ </h:column>
+ </rich:suggestionbox>
+ </h:panelGroup>
+ </rich:menuItem>
+ </c:when>
+ <c:when test="${ExtensionPoints.mixed == child.extensionKey or
+ ExtensionPoints.compatible == child.extensionKey or
+ ExtensionPoints.definitions == child.extensionKey}">
+ <ui:remove>***** Groups > COMPATIBLE GROUPS *****</ui:remove>
+ <ui:remove>***** Groups > MIXED GROUPS *****</ui:remove>
+ <ui:remove>***** Groups > GROUP DEFINITIONS *****</ui:remove>
+ <rich:menuItem submitMode="none" icon="#{child.iconUrl}"
+ width="#{child.iconWidth}" height="#{child.iconHeight}"
+ onclick="window.location = '#{child.url}'">
+ <c:choose>
+ <c:when test="#{ExtensionPoints.compatible == child.extensionKey}">
+ <h:outputText value="#{msg['resource.hub.filter.compatibleGroups']}"/>
+ </c:when>
+ <c:when test="#{ExtensionPoints.mixed == child.extensionKey}">
+ <h:outputText value="#{msg['resource.hub.filter.mixedGroups']}"/>
+ </c:when>
+ <c:when test="#{ExtensionPoints.definitions == child.extensionKey}">
+ <h:outputText value="#{msg['resource.hub.filter.groupDefinitions']}"/>
+ </c:when>
+ </c:choose>
+ </rich:menuItem>
+ </c:when>
+ <c:when test="#{ExtensionPoints.newgroup == child.extensionKey}">
+ <ui:remove>***** Groups > NEW RESOURCE GROUP *****</ui:remove>
+ <rich:menuSeparator rendered="#{GlobalPermissionsUIBean.inventory}"/>
+ <rich:menuItem submitMode="none" onclick="window.location = '#{child.url}'"
+ rendered="#{GlobalPermissionsUIBean.inventory}">
+ <h:outputText value="#{msg['resource.hub.NewGroupLink']}"/>
+ </rich:menuItem>
+ </c:when>
+ <c:when test="#{ExtensionPoints.newgroupdefinition == child.extensionKey}">
+ <ui:remove>***** Groups > NEW GROUP DEFINITIONS *****</ui:remove>
+ <rich:menuItem submitMode="none" onclick="window.location = '#{child.url}'"
+ rendered="#{GlobalPermissionsUIBean.inventory}">
+ <h:outputText value="#{msg['resource.hub.NewGroupDefinitionLink']}"/>
+ </rich:menuItem>
+ </c:when>
+ <c:when test="#{ExtensionPoints.favoritegroups == child.extensionKey}">
+ <ui:remove>***** Groups > FAVORITE GROUPS *****</ui:remove>
+ <rich:menuGroup value="#{child.name}" icon="#{child.iconUrl}">
+ <c:forEach var="group" items="#{UserPreferencesUIBean.groupFavorites}">
+ <rich:menuItem submitMode="none"
+ icon="/images/icons/#{group.groupCategory == 'MIXED' ? 'Group' : 'Cluster'}_up_16.png"
+ onclick="window.location = '/rhq/group/inventory/view.xhtml?groupId=#{group.id}'">
+ <h:outputText value="#{group.name}"/>
+ </rich:menuItem>
+ </c:forEach>
+ </rich:menuGroup>
+ </c:when>
+ <c:when test="${ExtensionPoints.recentlyviewedgroups == child.extensionKey}">
+ <ui:remove>***** Groups > RECENTLY VIEWED *****</ui:remove>
+ <rich:menuGroup value="#{child.name}" icon="#{child.iconUrl}">
+ <c:forEach var="visit" items="#{UserPreferencesUIBean.recentVisits}">
+ <c:if test="#{visit.kind == 'COMPATIBLE_GROUP' or visit.kind == 'MIXED_GROUP'}">
+ <rich:menuItem submitMode="none"
+ icon="/images/icons/#{visit.kind == 'COMPATIBLE_GROUP' ? 'Cluster' : 'Group'}_up_16.png"
+ onclick="window.location = '/rhq/group/inventory/view.xhtml?groupId=#{visit.id}'">
+ <h:outputText value="#{visit.name}"/>
+ </rich:menuItem>
+ </c:if>
+ </c:forEach>
+ </rich:menuGroup>
+ </c:when>
+ <c:when test="${ExtensionPoints.searchgroups == child.extensionKey}">
+ <ui:remove>***** Groups > SEARCH *****</ui:remove>
+ <rich:menuItem submitMode="none" disabled="true" iconDisabled="/images/icons/Search_16.png">
+ <h:outputText value="Search: " style="color: black;"/>
+ <h:panelGroup>
+ <h:inputText id="selectedGroup" style="width: 250px;" immediate="true"
+ onkeypress="return ignoreEnterKey(event);" />
+ <rich:suggestionbox id="groupSelectBox" for="selectedGroup" tokens=",[]"
+ ajaxSingle="true" immediate="true"
+ suggestionAction="#{ResourceGroupSelectUIBean.autocomplete}"
+ var="result" data="foo" fetchValue="#{result.groupQueryString}"
+ nothingLabel="No matching groups found"
+ style="background-color: #cccccc;"
+ onselect="document.location.href='/rhq/group/inventory/view.xhtml?' + #{rich:element('selectedGroup')}.value"
+ usingSuggestObjects="false" width="700" height="400">
+ <h:column>
+ <f:facet name="header">Avail</f:facet>
+ <h:graphicImage value="/images/icons/availability_green_16.png" rendered="#{result.implicitUp > 0 and result.implicitDown == 0}"/>
+ <h:graphicImage value="/images/icons/availability_red_16.png" rendered="#{result.implicitUp == 0 and result.implicitDown > 0}"/>
+ <h:graphicImage value="/images/icons/availability_yellow_16.png" rendered="#{result.implicitUp > 0 and result.implicitDown > 0}"/>
+ <h:graphicImage value="/images/icons/availability_grey_16.png" rendered="#{result.implicitUp == 0 and result.implicitDown == 0}"/>
+ </h:column>
+ <h:column>
+ <f:facet name="header">Group</f:facet>
+ <h:outputText value="#{result.resourceGroup.name}"/>
+ </h:column>
+ <h:column>
+ <f:facet name="header">Category</f:facet>
+ <h:outputText value="#{result.category.name}" rendered="#{result.category.name == 'MIXED'}"/>
+ <h:outputText value="#{result.resourceGroup.resourceType.name}" rendered="#{result.category.name == 'COMPATIBLE'}"/>
+ </h:column>
+ </rich:suggestionbox>
+ </h:panelGroup>
+ </rich:menuItem>
+ </c:when>
+ <c:when test="#{ExtensionPoints.about == child.extensionKey}">
+ <ui:remove>***** Help > ABOUT *****</ui:remove>
+ <rich:menuItem submitMode="none" id="aboutLink" icon="#{child.iconUrl}"
+ width="#{child.iconWidth}" height="#{child.iconHeight}">
+ <h:outputText value="#{msg['header.about.link']}"/>
+ <rich:componentControl for="aboutPanel" attachTo="aboutLink" operation="show" event="onclick"/>
+ </rich:menuItem>
+ </c:when>
+ <c:otherwise>
+ <rich:menuItem submitMode="none" icon="#{child.iconUrl}"
+ width="#{child.iconWidth}" height="#{child.iconHeight}"
+ onclick="window.location = '#{child.url}'">
+ <h:outputText value="#{child.name}" />
+ </rich:menuItem>
+ </c:otherwise>
+ </c:choose>
+ </c:otherwise>
+ </c:choose>
+ </c:if>
</c:forEach>
- </rich:dropDownMenu>
- </c:if>
- <ui:remove>===== OVERVIEW =====</ui:remove>
-
- <rich:dropDownMenu>
- <f:facet name="label">
- <h:panelGroup>
- <h:outputText value="#{PerspectivesMenuUIBean.overview.name}"
- rendered="#{PerspectivesMenuUIBean.overview.rendered}" />
- </h:panelGroup>
- </f:facet>
-
- <ui:remove>***** Overview > SYSTEM VIEWS *****</ui:remove>
- <rich:menuGroup
- value="#{PerspectivesMenuUIBean.subsystemViews.name}">
- <c:forEach var="menu"
- items="#{PerspectivesMenuUIBean.subsystemMenuItems}">
- <rich:menuItem submitMode="none" icon="#{menu.iconUrl}"
- onclick="window.location = '#{menu.url}'">
- <h:outputText value="#{menu.name}" />
- </rich:menuItem>
- </c:forEach>
- </rich:menuGroup>
-
- <ui:remove>***** Overview > AUTO-DISCOVERY QUEUE *****</ui:remove>
- <rich:menuItem submitMode="none"
- onclick="window.location = '#{PerspectivesMenuUIBean.autoDiscoveryQueue.url}'">
- <h:outputText
- value="#{PerspectivesMenuUIBean.autoDiscoveryQueue.name}" />
- </rich:menuItem>
-
- <ui:remove>***** Overview > DASHBOARD *****</ui:remove>
- <rich:menuItem submitMode="none"
- onclick="window.location = '#{PerspectivesMenuUIBean.dashboard.url}'">
- <h:outputText value="#{PerspectivesMenuUIBean.dashboard.name}" />
- </rich:menuItem>
- </rich:dropDownMenu>
-
- <ui:remove>===== RESOURCES =====</ui:remove>
-
- <rich:dropDownMenu id="resourcesMenu">
- <f:facet name="label">
- <h:panelGroup>
- <h:outputText value="#{PerspectivesMenuUIBean.resources.name}" />
- </h:panelGroup>
- </f:facet>
-
- <ui:remove>***** Resources > PLATFORMS *****</ui:remove>
- <rich:menuItem submitMode="none"
- icon="#{PerspectivesMenuUIBean.resourcesPlatform.iconUrl}"
- onclick="window.location = '#{PerspectivesMenuUIBean.resourcesPlatform.url}'">
- <h:outputText value="#{msg['resource.hub.filter.platform']}" />
- </rich:menuItem>
-
- <ui:remove>***** Resources > SERVERS *****</ui:remove>
- <rich:menuItem submitMode="none"
- icon="#{PerspectivesMenuUIBean.resourcesServer.iconUrl}"
- onclick="window.location = '#{PerspectivesMenuUIBean.resourcesServer.url}'">
- <h:outputText value="#{msg['resource.hub.filter.server']}" />
- </rich:menuItem>
-
- <ui:remove>***** Resources > SERVICES *****</ui:remove>
- <rich:menuItem submitMode="none"
- icon="#{PerspectivesMenuUIBean.resourcesService.iconUrl}"
- onclick="window.location = '#{PerspectivesMenuUIBean.resourcesService.url}'">
- <h:outputText value="#{msg['resource.hub.filter.service']}" />
- </rich:menuItem>
-
- <ui:remove>***** Resources > FAVORITE RESOURCES *****</ui:remove>
- <rich:menuGroup
- value="#{PerspectivesMenuUIBean.resourcesFavorite.name}"
- icon="#{PerspectivesMenuUIBean.resourcesFavorite.iconUrl}">
- <c:forEach var="resource"
- items="#{UserPreferencesUIBean.resourceFavorites}">
- <rich:menuItem submitMode="none"
- icon="/images/icons/#{resource.resourceType.category}_up_16.png"
- onclick="window.location = '#{onf:getDefaultResourceTabURL()}?id=#{resource.id}'">
- <h:outputText value="#{resource.name}" />
- </rich:menuItem>
- </c:forEach>
- </rich:menuGroup>
-
- <ui:remove>***** Resources > RECENTLY VIEWED *****</ui:remove>
- <rich:menuGroup
- value="#{PerspectivesMenuUIBean.resourcesRecentlyViewed.name}"
- icon="#{PerspectivesMenuUIBean.resourcesRecentlyViewed.iconUrl}">
- <c:forEach var="visit"
- items="#{UserPreferencesUIBean.recentVisits}">
- <c:if
- test="#{visit.kind == 'PLATFORM' or visit.kind == 'SERVER' or visit.kind == 'SERVICE'}">
- <rich:menuItem submitMode="none"
- icon="/images/icons/#{visit.kind.displayName}_up_16.png"
- onclick="window.location = '#{onf:getDefaultResourceTabURL()}?id=#{visit.id}'">
- <h:outputText value="#{visit.name}" />
- </rich:menuItem>
- </c:if>
- </c:forEach>
- </rich:menuGroup>
-
- <rich:menuSeparator />
-
- <ui:remove>***** Resources > SEARCH *****</ui:remove>
- <rich:menuItem submitMode="none" disabled="true"
- iconDisabled="/images/icons/Search_16.png">
- <h:outputText value="Search: " style="color: black;" />
- <h:panelGroup>
- <h:inputText id="selectedResource" style="width: 250px;"
- immediate="true" onkeypress="return ignoreEnterKey(event);" />
- <rich:suggestionbox id="resourceSelectBox" for="selectedResource"
- tokens=",[]" ajaxSingle="true" immediate="true"
- suggestionAction="#{ResourceSelectUIBean.autocomplete}"
- var="result" data="foo" fetchValue="#{result.resource.id}"
- nothingLabel="No matching resources found"
- style="background-color: #cccccc;"
- onselect="document.location.href='#{onf:getDefaultResourceTabURL()}?id=' + #{rich:element('selectedResource')}.value"
- usingSuggestObjects="false" width="700" height="400">
- <h:column>
- <f:facet name="header">Avail</f:facet>
- <h:graphicImage
- value="/images/icons/availability_#{result.availability == 'UP' ? 'green' : 'red'}_16.png" />
- </h:column>
- <h:column>
- <f:facet name="header">Resource</f:facet>
- <h:outputText value="#{result.resource.name}" />
- </h:column>
- <h:column>
- <f:facet name="header">Parent</f:facet>
- <h:outputText value="#{result.parent.name}" />
- </h:column>
- </rich:suggestionbox>
- </h:panelGroup>
- </rich:menuItem>
-
</rich:dropDownMenu>
-
- <ui:remove>===== GROUPS =====</ui:remove>
-
- <rich:dropDownMenu id="groupsMenu">
- <f:facet name="label">
- <h:panelGroup>
- <h:outputText value="#{PerspectivesMenuUIBean.groups.name}"/>
- </h:panelGroup>
- </f:facet>
-
- <ui:remove>***** Groups > COMPATIBLE GROUPS *****</ui:remove>
- <rich:menuItem submitMode="none"
- icon="#{PerspectivesMenuUIBean.groupsCompatible.iconUrl}"
- onclick="window.location = '#{PerspectivesMenuUIBean.groupsCompatible.url}'">
- <h:outputText
- value="#{msg['resource.hub.filter.compatibleGroups']}" />
- </rich:menuItem>
-
- <ui:remove>***** Groups > MIXED GROUPS *****</ui:remove>
- <rich:menuItem submitMode="none"
- icon="#{PerspectivesMenuUIBean.groupsMixed.iconUrl}"
- onclick="window.location = '#{PerspectivesMenuUIBean.groupsMixed.url}'">
- <h:outputText value="#{msg['resource.hub.filter.mixedGroups']}" />
- </rich:menuItem>
-
- <ui:remove>***** Groups > GROUP DEFINITIONS *****</ui:remove>
- <rich:menuItem submitMode="none"
- icon="#{PerspectivesMenuUIBean.groupsDefinitions.iconUrl}"
- onclick="window.location = '#{PerspectivesMenuUIBean.groupsDefinitions.url}'">
- <h:outputText
- value="#{msg['resource.hub.filter.groupDefinitions']}" />
- </rich:menuItem>
-
- <rich:menuSeparator rendered="#{GlobalPermissionsUIBean.inventory}" />
-
- <ui:remove>***** Groups > NEW RESOURCE GROUP *****</ui:remove>
- <rich:menuItem submitMode="none"
- onclick="window.location = '#{PerspectivesMenuUIBean.groupsNewResource.url}'"
- rendered="#{GlobalPermissionsUIBean.inventory}">
- <h:outputText value="#{msg['resource.hub.NewGroupLink']}" />
- </rich:menuItem>
-
- <ui:remove>***** Groups > NEW GROUP DEFINITIONS *****</ui:remove>
- <rich:menuItem submitMode="none"
- onclick="window.location = '#{PerspectivesMenuUIBean.groupsNewDefinition.url}'"
- rendered="#{GlobalPermissionsUIBean.inventory}">
- <h:outputText
- value="#{msg['resource.hub.NewGroupDefinitionLink']}" />
- </rich:menuItem>
-
- <rich:menuSeparator />
-
- <ui:remove>***** Groups > FAVORITE GROUPS *****</ui:remove>
- <rich:menuGroup
- value="#{PerspectivesMenuUIBean.groupsFavorite.name}"
- icon="#{PerspectivesMenuUIBean.groupsFavorite.iconUrl}">
- <c:forEach var="group"
- items="#{UserPreferencesUIBean.groupFavorites}">
- <rich:menuItem submitMode="none"
- icon="/images/icons/#{group.groupCategory == 'MIXED' ? 'Group' : 'Cluster'}_up_16.png"
- onclick="window.location = '/rhq/group/inventory/view.xhtml?groupId=#{group.id}'">
- <h:outputText value="#{group.name}" />
- </rich:menuItem>
- </c:forEach>
- </rich:menuGroup>
-
- <ui:remove>***** Groups > RECENTLY VIEWED *****</ui:remove>
- <rich:menuGroup
- value="#{PerspectivesMenuUIBean.groupsRecentlyViewed.name}"
- icon="#{PerspectivesMenuUIBean.groupsRecentlyViewed.iconUrl}">
- <c:forEach var="visit"
- items="#{UserPreferencesUIBean.recentVisits}">
- <c:if
- test="#{visit.kind == 'COMPATIBLE_GROUP' or visit.kind == 'MIXED_GROUP'}">
- <rich:menuItem submitMode="none"
- icon="/images/icons/#{visit.kind == 'COMPATIBLE_GROUP' ? 'Cluster' : 'Group'}_up_16.png"
- onclick="window.location = '/rhq/group/inventory/view.xhtml?groupId=#{visit.id}'">
- <h:outputText value="#{visit.name}" />
- </rich:menuItem>
- </c:if>
- </c:forEach>
- </rich:menuGroup>
-
- <rich:menuSeparator />
-
- <ui:remove>***** Groups > SEARCH *****</ui:remove>
- <rich:menuItem submitMode="none" disabled="true"
- iconDisabled="/images/icons/Search_16.png">
- <h:outputText value="Search: " style="color: black;" />
- <h:panelGroup>
- <h:inputText id="selectedGroup" style="width: 250px;"
- immediate="true" onkeypress="return ignoreEnterKey(event);" />
- <rich:suggestionbox id="groupSelectBox" for="selectedGroup"
- tokens=",[]" ajaxSingle="true" immediate="true"
- suggestionAction="#{ResourceGroupSelectUIBean.autocomplete}"
- var="result" data="foo" fetchValue="#{result.groupQueryString}"
- nothingLabel="No matching groups found"
- style="background-color: #cccccc;"
- onselect="document.location.href='/rhq/group/inventory/view.xhtml?' + #{rich:element('selectedGroup')}.value"
- usingSuggestObjects="false" width="700" height="400">
- <h:column>
- <f:facet name="header">Avail</f:facet>
- <h:graphicImage value="/images/icons/availability_green_16.png"
- rendered="#{result.implicitUp > 0 and result.implicitDown == 0}" />
- <h:graphicImage value="/images/icons/availability_red_16.png"
- rendered="#{result.implicitUp == 0 and result.implicitDown > 0}" />
- <h:graphicImage
- value="/images/icons/availability_yellow_16.png"
- rendered="#{result.implicitUp > 0 and result.implicitDown > 0}" />
- <h:graphicImage value="/images/icons/availability_grey_16.png"
- rendered="#{result.implicitUp == 0 and result.implicitDown == 0}" />
- </h:column>
- <h:column>
- <f:facet name="header">Group</f:facet>
- <h:outputText value="#{result.resourceGroup.name}" />
- </h:column>
- <h:column>
- <f:facet name="header">Category</f:facet>
- <h:outputText value="#{result.category.name}"
- rendered="#{result.category.name == 'MIXED'}" />
- <h:outputText value="#{result.resourceGroup.resourceType.name}"
- rendered="#{result.category.name == 'COMPATIBLE'}" />
- </h:column>
- </rich:suggestionbox>
- </h:panelGroup>
- </rich:menuItem>
-
- </rich:dropDownMenu>
-
- <ui:remove>===== ADMINISTRATION =====</ui:remove>
-
- <rich:dropDownMenu>
- <f:facet name="label">
- <h:panelGroup>
- <h:outputText value="#{msg['admin.admin.AdministrationTitle']}" />
- </h:panelGroup>
- </f:facet>
-
- <ui:remove>***** Administration > SECURITY *****</ui:remove>
- <rich:menuGroup value="Security">
- <rich:menuItem submitMode="none"
- onclick="window.location = '/admin/user/UserAdmin.do?mode=list'">
- <h:outputText value="Users" />
- </rich:menuItem>
- <rich:menuItem submitMode="none"
- onclick="window.location = '/admin/role/RoleAdmin.do?mode=list'">
- <h:outputText value="Roles" />
- </rich:menuItem>
- </rich:menuGroup>
-
- <ui:remove>***** Administration > SYSTEM CONFIGURATION *****</ui:remove>
- <rich:menuGroup value="System Configuration"
- rendered="#{GlobalPermissionsUIBean.settings || GlobalPermissionsUIBean.inventory}">
- <rich:menuItem submitMode="none"
- onclick="window.location = '/admin/config/Config.do?mode=edit'"
- rendered="#{GlobalPermissionsUIBean.settings}">
- <h:outputText value="Settings" />
- </rich:menuItem>
- <rich:menuItem submitMode="none"
- onclick="window.location = '/rhq/admin/plugin/plugin-list.xhtml'"
- rendered="#{GlobalPermissionsUIBean.settings}">
- <h:outputText value="Plugins" />
- </rich:menuItem>
- <rich:menuItem submitMode="none"
- onclick="window.location = '/admin/config/EditDefaults.do?mode=monitor&viewMode=all'"
- rendered="#{GlobalPermissionsUIBean.inventory}">
- <h:outputText value="Templates" />
- </rich:menuItem>
- </rich:menuGroup>
-
- <ui:remove>***** Administration > CONTENT *****</ui:remove>
- <rich:menuGroup value="Content"
- rendered="#{GlobalPermissionsUIBean.inventory}">
- <rich:menuItem submitMode="none"
- onclick="window.location = '/rhq/content/listContentProviders.xhtml'">
- <h:outputText value="Content Providers" />
- </rich:menuItem>
- <rich:menuItem submitMode="none"
- onclick="window.location = '/rhq/content/listRepos.xhtml'">
- <h:outputText value="Repositories" />
- </rich:menuItem>
- </rich:menuGroup>
-
- <ui:remove>***** Administration > HIGH AVAILABILITY *****</ui:remove>
- <rich:menuGroup value="High Availability"
- rendered="#{GlobalPermissionsUIBean.inventory}">
- <rich:menuItem submitMode="none"
- onclick="window.location = '/rhq/ha/listServers.xhtml'">
- <h:outputText value="Servers" />
- </rich:menuItem>
- <rich:menuItem submitMode="none"
- onclick="window.location = '/rhq/ha/listAgents.xhtml'">
- <h:outputText value="Agents" />
- </rich:menuItem>
- <rich:menuItem submitMode="none"
- onclick="window.location = '/rhq/ha/listAffinityGroups.xhtml'">
- <h:outputText value="Affinity Groups" />
- </rich:menuItem>
- <rich:menuItem submitMode="none"
- onclick="window.location = '/rhq/ha/listPartitionEvents.xhtml'">
- <h:outputText value="Partition Events" />
- </rich:menuItem>
- </rich:menuGroup>
-
-
-
- <rich:menuGroup value="Reports">
- <rich:menuItem submitMode="none"
- onclick="window.location = '/rhq/admin/report/resourceInstallReport.xhtml'">
- <h:outputText value="Resource Version Inventory Report" />
- </rich:menuItem>
-
- </rich:menuGroup>
-
- <rich:menuItem submitMode="none" icon="/images/icons/Save_16.png"
- onclick="window.location = '/rhq/admin/downloads.xhtml'">
- <h:outputText value="Downloads" />
- </rich:menuItem>
-
-
- <rich:menuItem submitMode="none"
- onclick="window.location = '/admin/license/LicenseAdmin.do?mode=view'"
- rendered="#{GlobalPermissionsUIBean.settings}">
- <h:outputText value="License" />
- </rich:menuItem>
- </rich:dropDownMenu>
-
- <ui:remove>===== DEBUG =====</ui:remove>
-
- <rich:dropDownMenu
- rendered="#{GlobalPermissionsUIBean.superuser and
- GlobalPermissionsUIBean.debugMode}">
- <f:facet name="label">
- <h:panelGroup>
- <h:outputText value="Debug" />
- </h:panelGroup>
- </f:facet>
-
- <rich:menuItem submitMode="none"
- onclick="window.open('/admin/test/sql.jsp')" target="blank_">
- <h:outputText value="SQL Interface" />
- </rich:menuItem>
- <rich:menuItem submitMode="none"
- onclick="window.open('/admin/test/hibernate.jsp')" target="blank_">
- <h:outputText value="JPQL/HQL Interface" />
- </rich:menuItem>
- <rich:menuItem submitMode="none"
- onclick="window.open('/admin/test/browser.jsp')" target="blank_">
- <h:outputText value="Hibernate Entity Browser" />
- </rich:menuItem>
- <rich:menuItem submitMode="none"
- onclick="window.open('/admin/test/control.jsp')" target="blank_">
- <h:outputText value="Administrative Control" />
- </rich:menuItem>
- <rich:menuItem submitMode="none"
- onclick="window.open('/admin/test/email.jsp')" target="blank_">
- <h:outputText value="Test Email Configuration" />
- </rich:menuItem>
- <rich:menuItem submitMode="none"
- onclick="window.open('/admin/test/agent.jsp')" target="blank_">
- <h:outputText value="Test Agent Communications" />
- </rich:menuItem>
- </rich:dropDownMenu>
-
- <ui:remove>===== HELP =====</ui:remove>
-
- <rich:dropDownMenu>
- <f:facet name="label">
- <h:panelGroup>
- <h:outputText value="#{msg['header.help.link']}" />
- </h:panelGroup>
- </f:facet>
-
- <ui:remove>***** Help > DOCUMENTATION *****</ui:remove>
- <rich:menuItem submitMode="none"
- onclick="window.open('http://www.redhat.com/docs/en-US/JBoss_ON/')"
- target="blank_">
- <h:outputText value="Online Documentation" />
- </rich:menuItem>
-
- <ui:remove>***** Help > SUPPORT CASE *****</ui:remove>
- <rich:menuItem submitMode="none"
- onclick="window.open('https://support.redhat.com/jbossnetwork/restricted/addCase.html')"
- target="blank_">
- <h:outputText value="Open a Support Case" />
- </rich:menuItem>
-
- <rich:menuSeparator />
-
- <ui:remove>***** Help > ABOUT *****</ui:remove>
- <rich:menuItem submitMode="none" id="aboutLink"
- icon="/images/icons/availability_grey_16.png">
- <h:outputText value="#{msg['header.about.link']}" />
- <rich:componentControl for="aboutPanel" attachTo="aboutLink"
- operation="show" event="onclick" />
- </rich:menuItem>
- </rich:dropDownMenu>
- </rich:toolBarGroup>
-
-
- <rich:toolBarGroup location="right">
-
- <a4j:status id="commonStatus" layout="block"
- startStyle=" filter:alpha(opacity=85); -moz-opacity: 0.85; opacity: 0.85; vertical-align: middle;">
- <f:facet name="start">
- <img src="/images/ajax-loader.gif" alt=""
- style="vertical-align: middle;" />
- <span style="vertical-align: middle;">Loading...</span>
- </f:facet>
- </a4j:status>
-
-
-
-
-
- <rich:dropDownMenu rendered="#{request.method == 'GET'}">
- <f:facet name="label">
- <h:panelGroup>
- <h:graphicImage value="/images/refreshRunning.gif"
- rendered="#{UserPreferencesUIBean.pageRefresh != 0}" />
- <h:graphicImage value="/images/refreshStopped.gif"
- rendered="#{UserPreferencesUIBean.pageRefresh == 0}" />
- <span id="refreshTimeLeft" style="width: 0px;"><h:outputText
- value="#{UserPreferencesUIBean.pageRefresh}"
- rendered="#{UserPreferencesUIBean.pageRefresh != 0}" /></span>
-
- </h:panelGroup>
- </f:facet>
-
- <ui:remove>***** Logged in as > EDIT DETAILS *****</ui:remove>
-
-
-
- <rich:menuItem submitMode="none"
- onclick="updatePageRefresh('#{request.getAttribute('javax.servlet.forward.request_uri')}', 0)">
- <h:outputText value="Stop" />
- <f:facet name="icon">
- <h:graphicImage
- value="/images/#{UserPreferencesUIBean.pageRefresh == 0 ? 'check.png' : 'spacer.gif'}"
- width="16" height="16" />
- </f:facet>
- </rich:menuItem>
- <rich:menuItem submitMode="none"
- onclick="updatePageRefresh('#{request.getAttribute('javax.servlet.forward.request_uri')}',60)">
- <h:outputText value="Refresh every 1 minute" />
- <f:facet name="icon">
- <h:graphicImage
- value="/images/#{UserPreferencesUIBean.pageRefresh == 60 ? 'check.png' : 'spacer.gif'}"
- width="16" height="16" />
- </f:facet>
- </rich:menuItem>
- <rich:menuItem submitMode="none"
- onclick="updatePageRefresh('#{request.getAttribute('javax.servlet.forward.request_uri')}',300)">
- <h:outputText value="Refresh every 5 minutes" />
- <f:facet name="icon">
- <h:graphicImage
- value="/images/#{UserPreferencesUIBean.pageRefresh == 300 ? 'check.png' : 'spacer.gif'}"
- width="16" height="16" />
- </f:facet>
- </rich:menuItem>
- <rich:menuItem submitMode="none"
- onclick="updatePageRefresh('#{request.getAttribute('javax.servlet.forward.request_uri')}',600)">
- <h:outputText value="Refresh every 10 minutes" />
- <f:facet name="icon">
- <h:graphicImage
- value="/images/#{UserPreferencesUIBean.pageRefresh == 600 ? 'check.png' : 'spacer.gif'}"
- width="16" height="16" />
- </f:facet>
- </rich:menuItem>
-
- </rich:dropDownMenu>
-
- <ui:remove>===== LOGGED IN AS =====</ui:remove>
-
-
- <rich:dropDownMenu>
- <f:facet name="label">
- <h:panelGroup>
- <h:outputText
- value="Logged in as #{UserPreferencesUIBean.subject.name}" />
- </h:panelGroup>
- </f:facet>
-
- <ui:remove>***** Logged in as > EDIT DETAILS *****</ui:remove>
- <rich:menuItem submitMode="none"
- onclick="window.location = '/admin/user/UserAdmin.do?mode=edit&u=#{UserPreferencesUIBean.subject.id}'">
- <h:outputText value="Edit Details" />
- </rich:menuItem>
-
- <ui:remove>***** Logged in as > CHANGE PASSWORD *****</ui:remove>
- <rich:menuItem submitMode="none"
- onclick="window.location = '/admin/user/UserAdmin.do?mode=editPass&u=#{UserPreferencesUIBean.subject.id}'">
- <h:outputText value="Change Password" />
- </rich:menuItem>
-
- <rich:menuSeparator />
-
- <ui:remove>***** Logged in as > LOGOUT *****</ui:remove>
- <rich:menuItem submitMode="none"
- onclick="window.location = '/Logout.do'">
- <h:outputText value="Logout" />
- </rich:menuItem>
- </rich:dropDownMenu>
-
- </rich:toolBarGroup>
- </rich:toolBar>
-
+ </c:if>
+ </c:if>
+ </c:forEach>
+ </c:if>
+ </rich:toolBarGroup>
+
+ <ui:remove>===== Display CoreMenu right aligned components =====</ui:remove>
+ <rich:toolBarGroup location="right">
+ <a4j:status id="commonStatus" layout="block"
+ startStyle=" filter:alpha(opacity=85); -moz-opacity: 0.85; opacity: 0.85; vertical-align: middle;">
+ <f:facet name="start">
+ <img src="/images/ajax-loader.gif" alt="" style="vertical-align:middle;"/> <span
+ style="vertical-align: middle;">Loading...</span>
+ </f:facet>
+ </a4j:status>
+
+ <c:if test="#{PerspectivesMenuUIBean.coreMenuBar.rendered}">
+ <ui:remove>===== If CoreMenu UI hasn't been disabled =====</ui:remove>
+ <ui:remove>===== Iterate through children[Top Menu Items - RIGHT ALIGNED] =====</ui:remove>
+ <c:forEach var="top"
+ items="#{PerspectivesMenuUIBean.coreMenuBar.childMenuItems}">
+ <c:if test="#{top.rendered and top.alignLeft == false}">
+
+ <ui:remove>===== Refresh item =====</ui:remove>
+ <c:if test="#{ExtensionPoints.refresh == top.extensionKey}">
+ <rich:dropDownMenu rendered="#{request.method == 'GET'}">
+ <f:facet name="label">
+ <h:panelGroup>
+ <h:graphicImage value="/images/refreshRunning.gif" rendered="#{UserPreferencesUIBean.pageRefresh != 0}"/>
+ <h:graphicImage value="/images/refreshStopped.gif" rendered="#{UserPreferencesUIBean.pageRefresh == 0}"/>
+ <span id="refreshTimeLeft" style="width: 0px;"><h:outputText value="#{UserPreferencesUIBean.pageRefresh}" rendered="#{UserPreferencesUIBean.pageRefresh != 0}"/></span>
+ </h:panelGroup>
+ </f:facet>
+ <rich:menuItem submitMode="none" onclick="updatePageRefresh('#{request.getAttribute('javax.servlet.forward.request_uri')}', 0)">
+ <h:outputText value="Stop"/>
+ <f:facet name="icon">
+ <h:graphicImage value="/images/#{UserPreferencesUIBean.pageRefresh == 0 ? 'check.png' : 'spacer.gif'}" width="16" height="16"/>
+ </f:facet>
+ </rich:menuItem>
+ <rich:menuItem submitMode="none" onclick="updatePageRefresh('#{request.getAttribute('javax.servlet.forward.request_uri')}',60)">
+ <h:outputText value="Refresh every 1 minute"/>
+ <f:facet name="icon">
+ <h:graphicImage value="/images/#{UserPreferencesUIBean.pageRefresh == 60 ? 'check.png' : 'spacer.gif'}" width="16" height="16"/>
+ </f:facet>
+ </rich:menuItem>
+ <rich:menuItem submitMode="none" onclick="updatePageRefresh('#{request.getAttribute('javax.servlet.forward.request_uri')}',300)">
+ <h:outputText value="Refresh every 5 minutes"/>
+ <f:facet name="icon">
+ <h:graphicImage value="/images/#{UserPreferencesUIBean.pageRefresh == 300 ? 'check.png' : 'spacer.gif'}" width="16" height="16"/>
+ </f:facet>
+ </rich:menuItem>
+ <rich:menuItem submitMode="none" onclick="updatePageRefresh('#{request.getAttribute('javax.servlet.forward.request_uri')}',600)">
+ <h:outputText value="Refresh every 10 minutes"/>
+ <f:facet name="icon">
+ <h:graphicImage value="/images/#{UserPreferencesUIBean.pageRefresh == 600 ? 'check.png' : 'spacer.gif'}" width="16" height="16"/>
+ </f:facet>
+ </rich:menuItem>
+ </rich:dropDownMenu>
+ </c:if>
+ <ui:remove>===== LoggedInAs item =====</ui:remove>
+ <c:if test="#{ExtensionPoints.loggedinas == top.extensionKey}">
+ <rich:dropDownMenu>
+ <f:facet name="label">
+ <h:panelGroup>
+ <h:outputText value="Logged in as #{UserPreferencesUIBean.subject.name}"/>
+ </h:panelGroup>
+ </f:facet>
+ <ui:remove> Now process the children MenuItems if they exist </ui:remove>
+ <c:forEach var="child"
+ items="#{top.childMenuItems}">
+ <c:if test="#{child.rendered}">
+ <c:choose>
+ <c:when test="${child.childMenuItems.size > 0}">
+ <rich:menuGroup value="#{child.name}">
+ <c:forEach var="grandchild"
+ items="#{child.childMenuItems}">
+ <c:choose>
+ <c:when test="#{grandchild.menuSeparator}">
+ <rich:menuSeparator/>
+ </c:when>
+ <c:otherwise>
+ <rich:menuItem submitMode="none" icon="#{grandchild.iconUrl}"
+ width="#{grandchild.iconWidth}" height="#{grandchild.iconHeight}"
+ onclick="window.location = '#{grandchild.url}'">
+ <h:outputText value="#{grandchild.name}" />
+ </rich:menuItem>
+ </c:otherwise>
+ </c:choose>
+ </c:forEach>
+ </rich:menuGroup>
+ </c:when>
+ <c:otherwise>
+ <c:choose>
+ <c:when test="#{child.menuSeparator}">
+ <rich:menuSeparator/>
+ </c:when>
+ <c:otherwise>
+ <rich:menuItem submitMode="none" icon="#{child.iconUrl}"
+ width="#{child.iconWidth}" height="#{child.iconHeight}"
+ onclick="window.location = '#{child.url}'">
+ <h:outputText value="#{child.name}" />
+ </rich:menuItem>
+ </c:otherwise>
+ </c:choose>
+ </c:otherwise>
+ </c:choose>
+ </c:if>
+ </c:forEach>
+ </rich:dropDownMenu>
+ </c:if>
+ <c:if test="#{ExtensionPoints.loggedinas != top.extensionKey and ExtensionPoints.refresh != top.extensionKey}">
+ <rich:dropDownMenu>
+ <f:facet name="label">
+ <h:panelGroup>
+ <h:outputText value="#{top.name}"/>
+ </h:panelGroup>
+ </f:facet>
+ <ui:remove> Now process the children MenuItems if they exist </ui:remove>
+ <c:forEach var="child"
+ items="#{top.childMenuItems}">
+ <c:if test="#{child.rendered}">
+ <c:choose>
+ <c:when test="${child.childMenuItems.size > 0}">
+ <rich:menuGroup value="#{child.name}">
+ <c:forEach var="grandchild"
+ items="#{child.childMenuItems}">
+ <c:choose>
+ <c:when test="#{grandchild.menuSeparator}">
+ <rich:menuSeparator/>
+ </c:when>
+ <c:otherwise>
+ <rich:menuItem submitMode="none" icon="#{grandchild.iconUrl}"
+ width="#{grandchild.iconWidth}" height="#{grandchild.iconHeight}"
+ onclick="window.location = '#{grandchild.url}'">
+ <h:outputText value="#{grandchild.name}" />
+ </rich:menuItem>
+ </c:otherwise>
+ </c:choose>
+ </c:forEach>
+ </rich:menuGroup>
+ </c:when>
+ <c:otherwise>
+ <c:choose>
+ <c:when test="#{child.menuSeparator}">
+ <rich:menuSeparator/>
+ </c:when>
+ <c:otherwise>
+ <rich:menuItem submitMode="none" icon="#{child.iconUrl}"
+ width="#{child.iconWidth}" height="#{child.iconHeight}"
+ onclick="window.location = '#{child.url}'">
+ <h:outputText value="#{child.name}" />
+ </rich:menuItem>
+ </c:otherwise>
+ </c:choose>
+ </c:otherwise>
+ </c:choose>
+ </c:if>
+ </c:forEach>
+ </rich:dropDownMenu>
+ </c:if>
+ </c:if>
+ </c:forEach>
+ </c:if>
+ </rich:toolBarGroup>
+ </rich:toolBar>
+
<rich:modalPanel id="aboutPanel" resizeable="false" width="320"
height="250">
<f:facet name="header">
14 years, 5 months
[rhq] Branch 'raw-config' - 6 commits - .classpath modules/enterprise
by Adam Young
.classpath | 8 ++++----
modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/configuration-navigation.xml | 1 -
2 files changed, 4 insertions(+), 5 deletions(-)
New commits:
commit 6a2d6ad8f26ce5249c6a09320728a016e9b60935
Merge: a3a2d66... b470482...
Author: Adam Young <ayoung(a)redhat.com>
Date: Wed Nov 25 14:36:41 2009 -0500
Merge branch 'raw-config' of ssh://git.fedorahosted.org/git/rhq/rhq into raw-config
commit a3a2d66d3e662d330a79e75d7fe5b9393bfebd98
Merge: 1668456... 5479efd...
Author: Adam Young <ayoung(a)redhat.com>
Date: Wed Nov 25 12:51:43 2009 -0500
Merge branch 'raw-config' of ssh://git.fedorahosted.org/git/rhq/rhq into raw-config
commit 1668456fce3f4ed2568b863156f5160c98e7ca2f
Author: Adam Young <ayoung(a)redhat.com>
Date: Tue Nov 24 14:50:41 2009 -0500
updated .classpath sources
diff --git a/.classpath b/.classpath
index 4ae73a2..158e2f2 100644
--- a/.classpath
+++ b/.classpath
@@ -155,8 +155,8 @@
<classpathentry exported="true" kind="var" path="M2_REPO/cglib/cglib-nodep/2.1_3/cglib-nodep-2.1_3.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/commons-logging/commons-logging/1.1/commons-logging-1.1.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/commons-lang/commons-lang/2.4/commons-lang-2.4.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/javax/faces/jsf-api/1.2_12/jsf-api-1.2_12.jar" sourcepath="/M2_REPO/javax/faces/jsf-api/1.2_06/jsf-api-1.2_06-sources.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/javax/faces/jsf-impl/1.2_12/jsf-impl-1.2_12.jar" sourcepath="/M2_REPO/javax/faces/jsf-impl/1.2_06/jsf-impl-1.2_06-sources.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/javax/faces/jsf-api/1.2_12/jsf-api-1.2_12.jar" sourcepath="/M2_REPO/javax/faces/jsf-api/1.2_12/jsf-api-1.2_12-sources.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/javax/faces/jsf-impl/1.2_12/jsf-impl-1.2_12.jar" sourcepath="/M2_REPO/javax/faces/jsf-impl/1.2_12/jsf-impl-1.2_12-sources.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/javax/el/el-api/1.0/el-api-1.0.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/com/sun/facelets/jsf-facelets/1.1.14/jsf-facelets-1.1.14.jar" sourcepath="/M2_REPO/com/sun/facelets/jsf-facelets/1.1.13/jsf-facelets-1.1.13-sources.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/mc4j/org-mc4j-ems/1.2.11/org-mc4j-ems-1.2.11.jar" sourcepath="/M2_REPO/mc4j/org-mc4j-ems/1.2.11/org-mc4j-ems-1.2.11-sources.jar"/>
@@ -164,8 +164,8 @@
<classpathentry exported="true" kind="var" path="M2_REPO/javax/mail/mail/1.3.1/mail-1.3.1.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/commons-fileupload/commons-fileupload/1.2/commons-fileupload-1.2.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/richfaces/framework/richfaces-api/3.3.0.GA/richfaces-api-3.3.0.GA.jar" sourcepath="/M2_REPO/org/richfaces/framework/richfaces-api/3.1.3.GA/richfaces-api-3.1.3.GA-sources.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/org/richfaces/framework/richfaces-impl/3.3.0.GA/richfaces-impl-3.3.0.GA.jar" sourcepath="/M2_REPO/org/richfaces/framework/richfaces-impl/3.1.3.GA/richfaces-impl-3.1.3.GA-sources.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/org/richfaces/ui/richfaces-ui/3.3.0.GA/richfaces-ui-3.3.0.GA.jar" sourcepath="/M2_REPO/org/richfaces/ui/richfaces-ui/3.1.3.GA/richfaces-ui-3.1.3.GA-sources.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/org/richfaces/framework/richfaces-impl/3.3.0.GA/richfaces-impl-3.3.0.GA.jar" sourcepath="/M2_REPO/org/richfaces/framework/richfaces-impl/3.3.0.GA/richfaces-impl-3.3.0.GA-sources.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/org/richfaces/ui/richfaces-ui/3.3.0.GA/richfaces-ui-3.3.0.GA.jar" sourcepath="/M2_REPO/org/richfaces/ui/richfaces-ui/3.3.0.GA/richfaces-ui-3.3.0.GA-sources.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/postgresql/postgresql/8.4-701.jdbc3/postgresql-8.4-701.jdbc3.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/jboss/jboss-cache/1.4.1.SP9/jboss-cache-1.4.1.SP9.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/hyperic/sigar/1.6.3.82/sigar-1.6.3.82.jar" sourcepath="/M2_REPO/org/hyperic/sigar/1.6.3.82/sigar-1.6.3.82-sources.jar"/>
commit eb6a0254d10500c154e64beca5bba9aafa7b5c8a
Merge: ad07de6... 91cf9cc...
Author: Adam Young <ayoung(a)redhat.com>
Date: Tue Nov 24 08:46:37 2009 -0500
Merge branch 'raw-config' of ssh://git.fedorahosted.org/git/rhq/rhq into raw-config
commit ad07de61361d0ceccd92362c57afc057269144a3
Merge: 14a2d52... 641c329...
Author: Adam Young <ayoung(a)redhat.com>
Date: Mon Nov 23 12:35:41 2009 -0500
Merge branch 'raw-config' of ssh://git.fedorahosted.org/git/rhq/rhq into raw-config
commit 14a2d521c890662426ccf14af01f83bb12627a39
Author: Adam Young <ayoung(a)redhat.com>
Date: Mon Nov 23 11:28:00 2009 -0500
Made navigation for the edit buttons universal: wroks no matter where clicked. Used for the view-raw.xhtml.
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/configuration-navigation.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/configuration-navigation.xml
index fc93ea8..5668f17 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/configuration-navigation.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/configuration-navigation.xml
@@ -6,7 +6,6 @@
<navigation-rule>
- <from-view-id>/rhq/resource/configuration/view.xhtml</from-view-id>
<navigation-case>
<from-action>#{ExistingResourceConfigurationUIBean.editConfiguration}</from-action>
14 years, 5 months
[rhq] Branch 'raw-config' - modules/plugins
by John Sanda
modules/plugins/raw-config-test/pom.xml | 10 ++++++++++
1 file changed, 10 insertions(+)
New commits:
commit b47048248bb4550fe78d0ccef319080e264d4079
Author: John Sanda <john(a)localhost.localdomain>
Date: Wed Nov 25 14:35:34 2009 -0500
Updating runtime dependencies
diff --git a/modules/plugins/raw-config-test/pom.xml b/modules/plugins/raw-config-test/pom.xml
index a55bfbc..60eef55 100644
--- a/modules/plugins/raw-config-test/pom.xml
+++ b/modules/plugins/raw-config-test/pom.xml
@@ -75,6 +75,16 @@
<version>1.6.4</version>
</artifactItem>
<artifactItem>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>1.7.1</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant-launcher</artifactId>
+ <version>1.7.1</version>
+ </artifactItem>
+ <artifactItem>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.6</version>
14 years, 5 months
[rhq] Branch 'linux-config' - 3 commits - modules/enterprise
by Jay Shaughnessy
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/perspective/PerspectiveException.java | 40 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/perspective/PerspectiveManagerBean.java | 56 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/perspective/PerspectiveManagerHelper.java | 42 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/perspective/PerspectiveManagerLocal.java | 16
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginManager.java | 9
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/perspective/metadata/PerspectivePluginMetadataManager.java | 8
modules/enterprise/server/xml-schemas/src/main/resources/rhq-serverplugin-perspective.xsd | 378 +++++-----
7 files changed, 370 insertions(+), 179 deletions(-)
New commits:
commit 2ce39c2280d2a87a3d70a229883d68a086f896bb
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Nov 25 13:55:33 2009 -0500
Work to expose coreMenu extension point via perspective manager
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/perspective/PerspectiveException.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/perspective/PerspectiveException.java
new file mode 100644
index 0000000..b238b44
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/perspective/PerspectiveException.java
@@ -0,0 +1,40 @@
+/*
+ * 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.enterprise.server.perspective;
+
+public class PerspectiveException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ public PerspectiveException() {
+ }
+
+ public PerspectiveException(String message) {
+ super(message);
+ }
+
+ public PerspectiveException(Throwable cause) {
+ super(cause);
+ }
+
+ public PerspectiveException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/perspective/PerspectiveManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/perspective/PerspectiveManagerBean.java
index 0dce72a..c33120b 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/perspective/PerspectiveManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/perspective/PerspectiveManagerBean.java
@@ -18,9 +18,65 @@
*/
package org.rhq.enterprise.server.perspective;
+import java.util.List;
+
+import javax.ejb.EJB;
import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.enterprise.server.RHQConstants;
+import org.rhq.enterprise.server.auth.SubjectManagerLocal;
@Stateless
// @WebService(endpointInterface = "org.rhq.enterprise.server.perspective.PerspectiveManagerRemote")
public class PerspectiveManagerBean implements PerspectiveManagerLocal, PerspectiveManagerRemote {
+
+ private final Log log = LogFactory.getLog(PerspectiveManagerBean.class);
+
+ @PersistenceContext(unitName = RHQConstants.PERSISTENCE_UNIT_NAME)
+ private EntityManager entityManager;
+
+ @EJB
+ private SubjectManagerLocal subjectManager;
+
+ /* (non-Javadoc)
+ * @see org.rhq.enterprise.server.perspective.PerspectiveManagerLocal#getCoreMenu(org.rhq.core.domain.auth.Subject)
+ */
+ @Override
+ public List<MenuItem> getCoreMenu(Subject subject) throws PerspectiveException {
+ List<MenuItem> coreMenu = null;
+
+ try {
+ coreMenu = PerspectiveManagerHelper.getPluginMetadataManager().getCoreMenu();
+ } catch (Exception e) {
+ throw new PerspectiveException("Failed to get Core Menu.", e);
+ }
+
+ // TODO: Apply Activators here
+
+ // TODO: Cache session:menu map here
+
+ // TODO: remove this debug code
+ // printMenu(coreMenu, "");
+
+ return coreMenu;
+ }
+
+ // TODO: remove this debug code
+ @SuppressWarnings("unused")
+ private void printMenu(List<MenuItem> menu, String indent) {
+ if (null == menu)
+ return;
+
+ for (MenuItem menuItem : menu) {
+ System.out.println(indent + menuItem.getItem().getName());
+ printMenu(menuItem.getChildren(), indent + "..");
+ }
+ }
+
}
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/perspective/PerspectiveManagerHelper.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/perspective/PerspectiveManagerHelper.java
new file mode 100644
index 0000000..94c2d19
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/perspective/PerspectiveManagerHelper.java
@@ -0,0 +1,42 @@
+package org.rhq.enterprise.server.perspective;
+
+import org.rhq.enterprise.server.plugin.pc.MasterServerPluginContainer;
+import org.rhq.enterprise.server.plugin.pc.ServerPluginServiceManagement;
+import org.rhq.enterprise.server.plugin.pc.perspective.PerspectiveServerPluginContainer;
+import org.rhq.enterprise.server.plugin.pc.perspective.PerspectiveServerPluginManager;
+import org.rhq.enterprise.server.plugin.pc.perspective.metadata.PerspectivePluginMetadataManager;
+import org.rhq.enterprise.server.util.LookupUtil;
+
+public class PerspectiveManagerHelper {
+
+ public static PerspectiveServerPluginContainer getPluginContainer() throws Exception {
+ PerspectiveServerPluginContainer pc = null;
+
+ try {
+ ServerPluginServiceManagement mbean = LookupUtil.getServerPluginService();
+ if (!mbean.isMasterPluginContainerStarted()) {
+ throw new IllegalStateException("The master plugin container is not started!");
+ }
+
+ MasterServerPluginContainer master = mbean.getMasterPluginContainer();
+ pc = master.getPluginContainer(PerspectiveServerPluginContainer.class);
+ } catch (IllegalStateException ise) {
+ throw ise;
+ } catch (Exception e) {
+ throw new Exception("Cannot obtain the Perspective plugin container", e);
+ }
+
+ if (pc == null) {
+ throw new Exception("Perspective plugin container is null!");
+ }
+
+ return pc;
+ }
+
+ public static PerspectivePluginMetadataManager getPluginMetadataManager() throws Exception {
+ PerspectiveServerPluginManager manager = (PerspectiveServerPluginManager) getPluginContainer()
+ .getPluginManager();
+ return manager.getMetadataManager();
+ }
+
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/perspective/PerspectiveManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/perspective/PerspectiveManagerLocal.java
index 139ac77..18d46b4 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/perspective/PerspectiveManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/perspective/PerspectiveManagerLocal.java
@@ -18,8 +18,24 @@
*/
package org.rhq.enterprise.server.perspective;
+import java.util.List;
+
import javax.ejb.Local;
+import org.rhq.core.domain.auth.Subject;
+
@Local
public interface PerspectiveManagerLocal {
+
+ /**
+ * Return the core menu for the specified subject. Depending on their inventory and roles the
+ * core menu for one subject1 could differ from that of subject2.
+ *
+ * Subsequent calls will return the same core menu for the same Subject. In other words, it does
+ * not change during a user session.
+ *
+ * @param subject
+ * @return
+ */
+ List<MenuItem> getCoreMenu(Subject subject) throws PerspectiveException;
}
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/perspective/metadata/PerspectivePluginMetadataManager.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/perspective/metadata/PerspectivePluginMetadataManager.java
index 9e86e6d..099e9fe 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/perspective/metadata/PerspectivePluginMetadataManager.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/perspective/metadata/PerspectivePluginMetadataManager.java
@@ -186,4 +186,12 @@ public class PerspectivePluginMetadataManager {
}
return result;
}
+
+ /**
+ * @return the coreMenu
+ */
+ public List<MenuItem> getCoreMenu() {
+ return coreMenu;
+ }
+
}
commit 314f6a3b66b4d4f6120bfc5685670be7f91d8cdc
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Nov 25 13:54:39 2009 -0500
Add more activator elements, reviewed optional/required settings,
beefed up doc annotations. Worked on tab extensions.
diff --git a/modules/enterprise/server/xml-schemas/src/main/resources/rhq-serverplugin-perspective.xsd b/modules/enterprise/server/xml-schemas/src/main/resources/rhq-serverplugin-perspective.xsd
index 5093db1..9223e1b 100644
--- a/modules/enterprise/server/xml-schemas/src/main/resources/rhq-serverplugin-perspective.xsd
+++ b/modules/enterprise/server/xml-schemas/src/main/resources/rhq-serverplugin-perspective.xsd
@@ -89,6 +89,9 @@
name="globalTask"
type="perspective:TaskType">
<xs:annotation>
+ <xs:documentation>
+ Add a Global Task extension.
+ </xs:documentation>
<xs:appinfo>
<jaxb:class
name="PerspectiveGlobalTaskElement" />
@@ -100,6 +103,9 @@
name="resourceTask"
type="perspective:TaskType">
<xs:annotation>
+ <xs:documentation>
+ Add a Resource Task extension.
+ </xs:documentation>
<xs:appinfo>
<jaxb:class
name="PerspectiveResourceTaskElement" />
@@ -126,12 +132,15 @@
maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>
- Activate task only if the user has resources of the specified type in inventory.
+ Activate the extension only if the user has resources of the specified type in
+ inventory.
Activated
only if the user has the required permissions. At least one resource
- activator required for
- resource tasks. Activated for resources only if specified trait
- conditions are also met.
+ activator
+ required for
+ resource task extensions. Activated for resources only if specified trait
+ conditions are
+ also met.
</xs:documentation>
</xs:annotation>
</xs:element>
@@ -141,7 +150,7 @@
maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>
- Activate task only if the user has the required global permissions.
+ Activate the extension only if the user has the required global permissions.
</xs:documentation>
</xs:annotation>
</xs:element>
@@ -150,7 +159,8 @@
minOccurs="0"
maxOccurs="1">
<xs:annotation>
- <xs:documentation>Optional additional help text for the task.</xs:documentation>
+ <xs:documentation>Verbose display help text for the task extension. Displayed on request.
+ </xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
@@ -160,20 +170,19 @@
use="required">
<xs:annotation>
<xs:documentation>
- The task name. Unique within names defined by the perspective. Used for
- display if
- displayName not provided.
- </xs:documentation>
+ Internal name for the task extension. Unique within extension names defined by the
+ perspective.
+ </xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute
name="displayName"
type="perspective:DisplayNameType"
- use="optional">
+ use="required">
<xs:annotation>
<xs:documentation>
- The name used for display, if provided.
- </xs:documentation>
+ The display name for the task extension.
+ </xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute
@@ -182,17 +191,17 @@
use="required">
<xs:annotation>
<xs:documentation>
- The task description displayed for the task.
- </xs:documentation>
+ The display description for the task extension.
+ </xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute
name="url"
type="xs:anyURI"
- use="optional">
+ use="required">
<xs:annotation>
<xs:documentation>
- The request URL for the task. Typically kicks off a wizard or similar workflow.
+ The request URL for the task extension. Typically kicks off a wizard or similar workflow.
</xs:documentation>
</xs:annotation>
</xs:attribute>
@@ -202,9 +211,9 @@
use="optional">
<xs:annotation>
<xs:documentation>
- Optional task category. Tasks for the same category will be grouped together.
- Categories
- are not predefined.
+ The display category for the task extension (optional). Tasks with the same category will
+ be grouped
+ together in the task pane.
</xs:documentation>
</xs:annotation>
</xs:attribute>
@@ -225,9 +234,7 @@
type="perspective:MenuItemType">
<xs:annotation>
<xs:documentation>
- Add or Remove a menu item in an existing menu extension point. Additions can specify
- positioning as
- well as a recursive structure, defineing a tree of MenuItems.
+ Add, Replace or Remove a menuItem extension for an existing menu extension point.
</xs:documentation>
<xs:appinfo>
<jaxb:class
@@ -241,14 +248,37 @@
<xs:sequence>
<xs:element
ref="perspective:position"
- minOccurs="0"
+ minOccurs="1"
maxOccurs="1">
<xs:annotation>
<xs:documentation>
- Required for root menuItem additions. Position of children is implicit given the
- XML
- structure.
- </xs:documentation>
+ Required positioning element for the menuItem extension.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element
+ ref="perspective:inventoryActivator"
+ minOccurs="0"
+ maxOccurs="unbounded">
+ <xs:annotation>
+ <xs:documentation>
+ Activate the extension only if the user has resources of the specified type in
+ inventory.
+ Activated only if the user has the required permissions. Activated for
+ resources only if
+ specified trait
+ conditions are also met.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element
+ ref="perspective:permissionActivator"
+ minOccurs="0"
+ maxOccurs="unbounded">
+ <xs:annotation>
+ <xs:documentation>
+ Activate the extension only if the user has the required global permissions.
+ </xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
@@ -259,10 +289,10 @@
default="add">
<xs:annotation>
<xs:documentation>
- Add or remove the menu entry. For removal all but the name attribute are ignored.
- Default
- is add.
- </xs:documentation>
+ Add, Replace or Remove the menuItem extension. For removal all but the name attribute are
+ ignored.
+ Default is add.
+ </xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute
@@ -271,10 +301,9 @@
use="required">
<xs:annotation>
<xs:documentation>
- ExtensionPoint name used for reference by other defined extension points.
- Unique within
+ Internal name for the menuItem extension. Unique within extension names defined by the
perspective.
- </xs:documentation>
+ </xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute
@@ -283,8 +312,7 @@
use="optional">
<xs:annotation>
<xs:documentation>
- The displayed menu item name. Required for add actions. If empty an icon must be
- defined.
+ The display name for the menuItem extension. If omitted an icon is required.
</xs:documentation>
</xs:annotation>
</xs:attribute>
@@ -294,8 +322,8 @@
use="optional">
<xs:annotation>
<xs:documentation>
- Certain menu items utilize special built-in rendering features.
- </xs:documentation>
+ Certain menuItem extensions utilize special built-in rendering features.
+ </xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute
@@ -304,9 +332,11 @@
use="optional">
<xs:annotation>
<xs:documentation>
- The request URL for the menu entry. If not provided the entry is just a placeholder for
- MenuItems.
- </xs:documentation>
+ The request URL for the menuItem extension. If omitted it is assumed
+ the menuItem
+ exists as
+ a navigation element to child menuItems.
+ </xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute
@@ -315,9 +345,9 @@
use="optional">
<xs:annotation>
<xs:documentation>
- The request URL for the icon image for this menu item. If not provided then no image is
- used.
- </xs:documentation>
+ The request URL for the icon displayed for this menuItem extension. If omitted no image is
+ displayed. Required if displayName if omitted.
+ </xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute
@@ -333,135 +363,145 @@
</xs:complexType>
<xs:element
- name="resourceTab">
+ name="resourceTab"
+ type="perspective:TabType">
<xs:annotation>
+ <xs:documentation>
+ Add, Replace or Remove a resourceTab extension for a ResourceTab extension point.
+ </xs:documentation>
<xs:appinfo>
<jaxb:class
name="PerspectiveResourceTabElement" />
</xs:appinfo>
</xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element
- ref="perspective:position"
- minOccurs="0"
- maxOccurs="1">
- <xs:annotation>
- <xs:documentation>
- Required for root menuItem additions. Position of children is implicit given the
- XML
- structure.
- </xs:documentation>
- </xs:annotation>
- </xs:element>
- </xs:sequence>
- <xs:attribute
- name="name"
- type="perspective:NameType"
- use="required">
- <xs:annotation>
- <xs:documentation>
- The menu entry name. Unique within menu items defined for the perspective. Displayed
- on
- screen.
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute
- name="action"
- type="perspective:ActionType"
- use="optional"
- default="add">
- <xs:annotation>
- <xs:documentation>
- Add or remove the menu entry. Add is the default.
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute
- name="url"
- type="xs:anyURI"
- use="optional">
- <xs:annotation>
- <xs:documentation>
- The request URL for the menu entry. If not provided the entry is just a placeholder for
- MenuItems.
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
- </xs:complexType>
</xs:element>
<xs:element
- name="resourceSubTab">
+ name="resourceSubTab"
+ type="perspective:TabType">
<xs:annotation>
+ <xs:documentation>
+ Add, Replace or Remove a resourceSubTab extension for a ResourceTab extension point.
+ </xs:documentation>
<xs:appinfo>
<jaxb:class
name="PerspectiveResourceSubTabElement" />
</xs:appinfo>
</xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element
- ref="perspective:position"
- minOccurs="0"
- maxOccurs="1">
- <xs:annotation>
- <xs:documentation>
- Required for root menuItem additions. Position of children is implicit given the
- XML
- structure.
- </xs:documentation>
- </xs:annotation>
- </xs:element>
- </xs:sequence>
- <xs:attribute
- name="name"
- type="perspective:NameType"
- use="required">
+ </xs:element>
+
+ <xs:complexType
+ name="TabType">
+ <xs:sequence>
+ <xs:element
+ ref="perspective:position"
+ minOccurs="1"
+ maxOccurs="1">
<xs:annotation>
<xs:documentation>
- The menu entry name. Unique within menu items defined for the perspective. Displayed
- on
- screen.
+ Required positioning element for the Tab or SubTab extension.
</xs:documentation>
</xs:annotation>
- </xs:attribute>
- <xs:attribute
- name="action"
- type="perspective:ActionType"
- use="optional"
- default="add">
+ </xs:element>
+ <xs:element
+ ref="perspective:inventoryActivator"
+ minOccurs="0"
+ maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>
- Add or remove the menu entry. Add is the default.
+ Activate the extension only if the user has resources of the specified type in
+ inventory.
+ Activated only if the user has the required permissions. Activated for
+ resources only if
+ specified trait
+ conditions are also met.
</xs:documentation>
</xs:annotation>
- </xs:attribute>
- <xs:attribute
- name="url"
- type="xs:anyURI"
- use="optional">
+ </xs:element>
+ <xs:element
+ ref="perspective:permissionActivator"
+ minOccurs="0"
+ maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>
- The request URL for the menu entry. If not provided the entry is just a placeholder for
- MenuItems.
+ Activate task only if the user has the required global permissions.
</xs:documentation>
</xs:annotation>
- </xs:attribute>
- </xs:complexType>
- </xs:element>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute
+ name="action"
+ type="perspective:ActionType"
+ use="optional"
+ default="add">
+ <xs:annotation>
+ <xs:documentation>
+ Add, Replace or Remove the tab extension. For removal all but the name attribute are
+ ignored. Default is add.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute
+ name="name"
+ type="perspective:NameType"
+ use="required">
+ <xs:annotation>
+ <xs:documentation>
+ Internal name for the tab extension. Unique within extension names defined by the
+ perspective.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute
+ name="displayName"
+ type="perspective:DisplayNameType"
+ use="required">
+ <xs:annotation>
+ <xs:documentation>
+ The display name for the tab extension.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute
+ name="url"
+ type="xs:anyURI"
+ use="required">
+ <xs:annotation>
+ <xs:documentation>
+ The request URL for the tab extension.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute
+ name="iconUrl"
+ type="xs:anyURI"
+ use="optional">
+ <xs:annotation>
+ <xs:documentation>
+ The request URL for the icon displayed for this tab extension. If omitted no image is
+ displayed.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute
+ name="iconWidth"
+ type="xs:int"
+ use="optional">
+ </xs:attribute>
+ <xs:attribute
+ name="iconHeight"
+ type="xs:int"
+ use="optional">
+ </xs:attribute>
+ </xs:complexType>
<xs:element
name="inventoryActivator">
<xs:annotation>
+ <xs:documentation>An activator specifying inventory conditions that must be satisfied in order for the
+ extension to be active.</xs:documentation>
<xs:appinfo>
<jaxb:class
name="InventoryActivatorElement" />
</xs:appinfo>
- <xs:documentation>
- Activators must be satisfied for the extension point to be active.
- </xs:documentation>
</xs:annotation>
<xs:complexType>
@@ -482,9 +522,7 @@
type="xs:string"
use="required">
<xs:annotation>
- <xs:documentation>
- Plugin for the specified resource type.
- </xs:documentation>
+ <xs:documentation>Plugin for the specified resource type.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute
@@ -492,8 +530,7 @@
type="xs:string"
use="required">
<xs:annotation>
- <xs:documentation>
- Resource Type that must be in inventory to activate the extension point.
+ <xs:documentation>Resource Type that must be in inventory to activate the extension point.
</xs:documentation>
</xs:annotation>
</xs:attribute>
@@ -504,11 +541,8 @@
name="permissionActivator"
type="perspective:PermissionType">
<xs:annotation>
- <xs:documentation>
- Activators must be satisfied for the extension point to be active.
- The specified permission
- must be available to the current user session.
- </xs:documentation>
+ <xs:documentation>An activator specifying a permission condition that must be satisfied in order for the
+ extension to be active.</xs:documentation>
</xs:annotation>
</xs:element>
@@ -516,11 +550,8 @@
name="traitActivator"
type="perspective:TraitActivatorType">
<xs:annotation>
- <xs:documentation>
- Activators must be satisfied for the extension point to be active.
- The specified permission
- must be available to the current user session.
- </xs:documentation>
+ <xs:documentation>An activator specifying a resource trait conditions that must be satisfied in order for the
+ extension to be active.</xs:documentation>
</xs:annotation>
</xs:element>
@@ -531,9 +562,7 @@
type="xs:string"
use="required">
<xs:annotation>
- <xs:documentation>
- The trait being tested for activation.
- </xs:documentation>
+ <xs:documentation>The trait being tested for activation.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute
@@ -541,10 +570,7 @@
type="xs:string"
use="required">
<xs:annotation>
- <xs:documentation>
- The value of the trait. By default this is a 'contains' test. For equality, set strict to
- true.
- </xs:documentation>
+ <xs:documentation>The value of the trait. By default, a case insensitive 'contains' test.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute
@@ -553,8 +579,7 @@
use="optional"
default="false">
<xs:annotation>
- <xs:documentation>
- If true perform equality test. If false (default) perform a contains test.
+ <xs:documentation>If true perform equality test. If false (default) perform a contains test.
</xs:documentation>
</xs:annotation>
</xs:attribute>
@@ -564,8 +589,7 @@
use="optional"
default="false">
<xs:annotation>
- <xs:documentation>
- If true perform a case sensitive test. If false (default) test is sase insensitive.
+ <xs:documentation>If true perform a case sensitive test. If false (default) test is case insensitive.
</xs:documentation>
</xs:annotation>
</xs:attribute>
@@ -575,6 +599,8 @@
name="position"
type="perspective:PositionType">
<xs:annotation>
+ <xs:documentation>Specifies positioning for an extension. Often relative to an existing extension.
+ </xs:documentation>
<xs:appinfo>
<jaxb:class
name="PerspectivePositionElement" />
@@ -589,9 +615,7 @@
type="perspective:ExtensionPointNameType"
use="required">
<xs:annotation>
- <xs:documentation>
- The extension point (a menu, resource tab bar, etc) where the insertion is occuring.
- </xs:documentation>
+ <xs:documentation>The extension point for which the extension is being positioned.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute
@@ -599,12 +623,8 @@
type="perspective:NameType"
use="optional">
<xs:annotation>
- <xs:documentation>
- Position relatively against this name. Required for before/after positioning.
- The name is
- context specific, it could be a
- menu entry name, a menu item name, tab name, subTab name, etc.
- </xs:documentation>
+ <xs:documentation>Position relatively against this extension name. Required for all placement relative to
+ another extension.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute
@@ -617,6 +637,10 @@
type="xs:boolean"
use="optional"
default="false">
+ <xs:annotation>
+ <xs:documentation>If true generate a break prior to this extension. Typically used for menuItem extensions,
+ ignored when breaks are nonsensical.</xs:documentation>
+ </xs:annotation>
</xs:attribute>
</xs:complexType>
@@ -624,8 +648,9 @@
name="ActionType">
<xs:annotation>
<xs:documentation>
- Add : Add new or Replaces existing
+ Add : Add new
Remove : Removes existing
+ Replace : Replace existing
</xs:documentation>
</xs:annotation>
<xs:restriction
@@ -634,6 +659,8 @@
value="add"></xs:enumeration>
<xs:enumeration
value="remove"></xs:enumeration>
+ <xs:enumeration
+ value="replace"></xs:enumeration>
</xs:restriction>
</xs:simpleType>
@@ -764,5 +791,4 @@
</xs:restriction>
</xs:simpleType>
-
</xs:schema>
commit 94a2f33e543fed0ce161d65dcb09c00e10519810
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Nov 25 13:51:22 2009 -0500
NullPointer protection
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginManager.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginManager.java
index 8eb7c70..c747814 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginManager.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginManager.java
@@ -284,14 +284,17 @@ public class ServerPluginManager {
MasterServerPluginContainerConfiguration masterConfig = masterPC.getConfiguration();
File dataDir = new File(masterConfig.getDataDirectory(), pluginName);
File tmpDir = masterConfig.getTemporaryDirectory();
- Configuration plugnConfig;
+ Configuration pluginConfig = null;
List<ScheduledJobDefinition> schedules;
try {
// TODO: today we have no way in the UI to customize the plugin config values
// for now, just use the defaults as defined in the descriptor
ConfigurationDefinition configDef = ServerPluginDescriptorMetadataParser
.getPluginConfigurationDefinition(pluginDescriptor);
- plugnConfig = configDef.getDefaultTemplate().createConfiguration();
+ // It is not required that a server plugin define plugin configuration
+ if (null != configDef) {
+ pluginConfig = configDef.getDefaultTemplate().createConfiguration();
+ }
// TODO: today we have no way in the UI to customize the schedules
// for now, just use the defaults as defined in the descriptor
@@ -301,7 +304,7 @@ public class ServerPluginManager {
throw new RuntimeException(e);
}
- context = new ServerPluginContext(env, dataDir, tmpDir, plugnConfig, schedules);
+ context = new ServerPluginContext(env, dataDir, tmpDir, pluginConfig, schedules);
this.pluginContextCache.put(pluginName, context);
return context;
}
14 years, 5 months
[rhq] Branch 'raw-config' - modules/plugins
by John Sanda
modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/RawServer.groovy | 11 +++
modules/plugins/raw-config-test/src/test/groovy/org/rhq/plugins/test/rawconfig/RawServerTest.groovy | 29 ++++++++++
2 files changed, 40 insertions(+)
New commits:
commit 9f95406ea4af3a31c1635eaa5d401aa05ad1e652
Author: John Sanda <john(a)localhost.localdomain>
Date: Wed Nov 25 13:54:02 2009 -0500
[US 6] Updating raw config test plugin to support update operation for Raw Server
diff --git a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/RawServer.groovy b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/RawServer.groovy
index c71f0fb..9acbbd8 100644
--- a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/RawServer.groovy
+++ b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/RawServer.groovy
@@ -6,6 +6,7 @@ import org.rhq.core.domain.configuration.Configuration
import org.rhq.core.domain.configuration.RawConfiguration
import org.rhq.core.domain.measurement.AvailabilityType
import org.rhq.core.pluginapi.inventory.ResourceContext
+import groovy.util.AntBuilder
class RawServer implements ResourceComponent, ResourceConfigurationFacet {
@@ -13,7 +14,11 @@ class RawServer implements ResourceComponent, ResourceConfigurationFacet {
File rawConfig1
+ def ant = new AntBuilder()
+
void start(ResourceContext context) {
+ ant = new AntBuilder()
+
rawConfigDir = new File("${System.getProperty('java.io.tmpdir')}/raw-config-test")
rawConfig1 = new File(rawConfigDir, "raw-test-1.txt")
@@ -67,6 +72,12 @@ class RawServer implements ResourceComponent, ResourceConfigurationFacet {
}
void persistRawConfiguration(RawConfiguration rawConfiguration) {
+ ant.copy(file: rawConfiguration.path, tofile: "${rawConfiguration.path}.orig")
+ ant.delete(file: rawConfiguration.path)
+
+ def file = new File(rawConfiguration.path)
+ file.createNewFile()
+ file << rawConfiguration.contents
}
void validateStructuredConfiguration(Configuration configuration) {
diff --git a/modules/plugins/raw-config-test/src/test/groovy/org/rhq/plugins/test/rawconfig/RawServerTest.groovy b/modules/plugins/raw-config-test/src/test/groovy/org/rhq/plugins/test/rawconfig/RawServerTest.groovy
new file mode 100644
index 0000000..ebb84c2
--- /dev/null
+++ b/modules/plugins/raw-config-test/src/test/groovy/org/rhq/plugins/test/rawconfig/RawServerTest.groovy
@@ -0,0 +1,29 @@
+package org.rhq.plugins.test.rawconfig
+
+import org.testng.annotations.Test
+import org.rhq.core.domain.configuration.RawConfiguration
+
+class RawServerTest {
+
+ @Test
+ void testPersistRawConfiguration() {
+ def rawFileName = "raw-test.txt"
+ def rawFile = new File(confDir, rawFileName)
+
+ def contents = "hello world"
+
+ rawFile << contents
+
+ def updatedContents = "hello world from red hat"
+
+ def rawConfig = new RawConfiguration(path: rawFile.absolutePath, contents: updatedContents.bytes)
+
+ def rawServer = new RawServer()
+ rawServer.persistRawConfiguration(rawConfig)
+ }
+
+ String getConfDir() {
+ getClass().getResource(".").toURI().path
+ }
+
+}
\ No newline at end of file
14 years, 5 months
[rhq] Branch 'pc' - modules/enterprise
by mazz
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerHelper.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/ServerPluginsBean.java | 28 +++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/ServerPluginsLocal.java | 11 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/MasterServerPluginContainer.java | 77 +++++++++-
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginType.java | 16 ++
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/generic/GenericServerPluginTest.java | 16 ++
6 files changed, 143 insertions(+), 7 deletions(-)
New commits:
commit aadfbe12066b4cab890bc04fbd9a55c76df87fb4
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Nov 25 13:19:15 2009 -0500
provide an API to get a list of all enabled and disabled plugins grouped by their type
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerHelper.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerHelper.java
index a79dff5..bbeb84c 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerHelper.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerHelper.java
@@ -42,7 +42,7 @@ public class ContentManagerHelper {
}
MasterServerPluginContainer master = mbean.getMasterPluginContainer();
- pc = master.getPluginContainer(ContentServerPluginContainer.class);
+ pc = master.getPluginContainerByClass(ContentServerPluginContainer.class);
} catch (IllegalStateException ise) {
throw ise;
} catch (Exception e) {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/ServerPluginsBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/ServerPluginsBean.java
index 2d67f3f..ff7d6ca 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/ServerPluginsBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/ServerPluginsBean.java
@@ -26,7 +26,9 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import javax.ejb.EJB;
import javax.ejb.Stateless;
@@ -54,6 +56,7 @@ import org.rhq.enterprise.server.authz.RequiredPermission;
import org.rhq.enterprise.server.plugin.pc.AbstractTypeServerPluginContainer;
import org.rhq.enterprise.server.plugin.pc.MasterServerPluginContainer;
import org.rhq.enterprise.server.plugin.pc.ServerPluginServiceManagement;
+import org.rhq.enterprise.server.plugin.pc.ServerPluginType;
import org.rhq.enterprise.server.util.LookupUtil;
import org.rhq.enterprise.server.xmlschema.ServerPluginDescriptorUtil;
import org.rhq.enterprise.server.xmlschema.generated.serverplugin.ServerPluginDescriptorType;
@@ -173,7 +176,7 @@ public class ServerPluginsBean implements ServerPluginsLocal {
String pluginName = doomedPlugin.getName();
doomedPlugins.add(pluginName);
if (master != null) {
- AbstractTypeServerPluginContainer pc = master.getPluginContainer(pluginName);
+ AbstractTypeServerPluginContainer pc = master.getPluginContainerByPlugin(pluginName);
if (pc != null) {
try {
pc.unschedulePluginJobs(pluginName);
@@ -216,7 +219,7 @@ public class ServerPluginsBean implements ServerPluginsLocal {
String pluginName = doomedPlugin.getName();
doomedPlugins.add(pluginName);
if (master != null) {
- AbstractTypeServerPluginContainer pc = master.getPluginContainer(pluginName);
+ AbstractTypeServerPluginContainer pc = master.getPluginContainerByPlugin(pluginName);
if (pc != null) {
try {
pc.unschedulePluginJobs(pluginName);
@@ -447,6 +450,27 @@ public class ServerPluginsBean implements ServerPluginsLocal {
return status;
}
+ // we need this method to talk to the master plugin container because the plugin data model
+ // does not contain information as to what type a plugin is. It only has information about
+ // where the plugin is deployed (agent or server) but it doesn't indicate if a plugin
+ // if of type "alert plugin" or "generic plugin". That is only known when the plugin descriptor
+ // is parsed, which happens when the master plugin container is initialized. Therefore, this
+ // needs to get plugin info from the master plugin container while the master is running.
+ public Map<ServerPluginType, List<String>> getAllPluginsGroupedByType() {
+ Map<ServerPluginType, List<String>> allPlugins = new HashMap<ServerPluginType, List<String>>();
+
+ MasterServerPluginContainer master = LookupUtil.getServerPluginService().getMasterPluginContainer();
+ if (master != null) {
+ List<ServerPluginType> types = master.getServerPluginTypes();
+ for (ServerPluginType type : types) {
+ List<String> plugins = master.getAllPluginsByPluginType(type);
+ allPlugins.put(type, plugins);
+ }
+ }
+
+ return allPlugins;
+ }
+
/**
* This will write the contents of the given plugin file to the database.
* This will assume the MD5 in the database is already correct, so this
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/ServerPluginsLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/ServerPluginsLocal.java
index df685d4..a6a09bf 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/ServerPluginsLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/ServerPluginsLocal.java
@@ -2,6 +2,7 @@ package org.rhq.enterprise.server.plugin;
import java.io.File;
import java.util.List;
+import java.util.Map;
import javax.ejb.Local;
import javax.persistence.NoResultException;
@@ -9,6 +10,7 @@ import javax.persistence.NoResultException;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.plugin.Plugin;
import org.rhq.core.domain.plugin.PluginStatusType;
+import org.rhq.enterprise.server.plugin.pc.ServerPluginType;
import org.rhq.enterprise.server.xmlschema.generated.serverplugin.ServerPluginDescriptorType;
/**
@@ -173,4 +175,13 @@ public interface ServerPluginsLocal {
* <code>null</code> indicates an unknown plugin.
*/
PluginStatusType getServerPluginStatus(String pluginName);
+
+ /**
+ * This will return a map containing all plugins currently known to the master plugin container.
+ * This will return installed plugins that are both enabled and disabled.
+ * Note that if the master plugin container is not running, an empty map is returned.
+ *
+ * @return names of all enabled and disabled plugins, keyed on their types
+ */
+ Map<ServerPluginType, List<String>> getAllPluginsGroupedByType();
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/MasterServerPluginContainer.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/MasterServerPluginContainer.java
index 8ebabd4..4ab3fb2 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/MasterServerPluginContainer.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/MasterServerPluginContainer.java
@@ -21,6 +21,7 @@ package org.rhq.enterprise.server.plugin.pc;
import java.io.File;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -46,11 +47,22 @@ import org.rhq.enterprise.server.xmlschema.generated.serverplugin.ServerPluginDe
public class MasterServerPluginContainer {
private static final Log log = LogFactory.getLog(MasterServerPluginContainer.class);
+ /** The configuration for the master plugin container itself. */
private MasterServerPluginContainerConfiguration configuration;
+
+ /** the plugin containers for all the different types of plugins that are supported */
private Map<ServerPluginType, AbstractTypeServerPluginContainer> pluginContainers = new HashMap<ServerPluginType, AbstractTypeServerPluginContainer>();
+
+ /** the object that provides all the classloaders for all plugins */
private ClassLoaderManager classLoaderManager;
/**
+ * Because the individual plugin containers are only managing enabled plugins (they are never told about plugins that disabled).
+ * this map contains the lists of plugins that are disabled so others can find out what plugins are registered but not running.
+ */
+ private Map<ServerPluginType, List<String>> disabledPlugins = new HashMap<ServerPluginType, List<String>>();
+
+ /**
* Starts the master plugin container, which will load all plugins and begin managing them.
*
* @param config the master configuration
@@ -188,6 +200,7 @@ public class MasterServerPluginContainer {
}
this.pluginContainers.clear();
+ this.disabledPlugins.clear();
this.classLoaderManager = null;
this.configuration = null;
@@ -238,6 +251,55 @@ public class MasterServerPluginContainer {
}
/**
+ * Given a plugin type, this will return the names of all known plugins of that type.
+ * This includes all types that are currently started as well as plugins
+ * that have been disabled.
+ *
+ * If the master plugin container has not been started, this returns an empty list.
+ *
+ * @param pluginType
+ *
+ * @return list of both enabled and disabled plugins of the given type
+ */
+ public List<String> getAllPluginsByPluginType(ServerPluginType pluginType) {
+ List<String> allPlugins = new ArrayList<String>();
+
+ AbstractTypeServerPluginContainer pc = getPluginContainerByPluginType(pluginType);
+ if (pc != null) {
+ // add the enabled plugins
+ ServerPluginManager pluginManager = pc.getPluginManager();
+ if (pluginManager != null) {
+ Collection<ServerPluginEnvironment> envs = pluginManager.getPluginEnvironments();
+ if (envs != null) {
+ for (ServerPluginEnvironment env : envs) {
+ allPlugins.add(env.getPluginName());
+ }
+ }
+ }
+
+ // add the disabled plugins
+ List<String> disabled = this.disabledPlugins.get(pluginType);
+ if (disabled != null) {
+ allPlugins.addAll(disabled);
+ }
+ }
+
+ return allPlugins;
+ }
+
+ /**
+ * This will return all known server plugins types. These are the types of plugins
+ * that are supported by a server plugin container. You can obtain the server
+ * plugin container that manages a particular server plugin type via
+ * {@link #getPluginContainerByPluginType(ServerPluginType)}.
+ *
+ * @return all known server plugin types
+ */
+ public synchronized List<ServerPluginType> getServerPluginTypes() {
+ return new ArrayList<ServerPluginType>(this.pluginContainers.keySet());
+ }
+
+ /**
* Get the plugin container of the given class. This method provides a strongly typed return value,
* based on the type of plugin container the caller wants returned.
*
@@ -245,7 +307,7 @@ public class MasterServerPluginContainer {
* @return the plugin container of the given class (<code>null</code> if none found)
*/
@SuppressWarnings("unchecked")
- public synchronized <T extends AbstractTypeServerPluginContainer> T getPluginContainer(Class<T> clazz) {
+ public synchronized <T extends AbstractTypeServerPluginContainer> T getPluginContainerByClass(Class<T> clazz) {
for (AbstractTypeServerPluginContainer pc : this.pluginContainers.values()) {
if (clazz.isInstance(pc)) {
return (T) pc;
@@ -262,7 +324,7 @@ public class MasterServerPluginContainer {
* @param pluginName
* @return the plugin container that is managing the named plugin of <code>null</code>
*/
- public synchronized <T extends AbstractTypeServerPluginContainer> T getPluginContainer(String pluginName) {
+ public synchronized <T extends AbstractTypeServerPluginContainer> T getPluginContainerByPlugin(String pluginName) {
for (AbstractTypeServerPluginContainer pc : this.pluginContainers.values()) {
if (null != pc.getPluginManager().getPluginEnvironment(pluginName)) {
return (T) pc;
@@ -319,7 +381,7 @@ public class MasterServerPluginContainer {
if (pluginFiles != null) {
- List<String> disabledPlugins = getDisabledPluginNames();
+ List<String> allDisabledPlugins = getDisabledPluginNames();
for (File pluginFile : pluginFiles) {
if (pluginFile.getName().endsWith(".jar")) {
@@ -329,12 +391,19 @@ public class MasterServerPluginContainer {
ServerPluginDescriptorType descriptor;
descriptor = ServerPluginDescriptorUtil.loadPluginDescriptorFromUrl(pluginUrl);
if (descriptor != null) {
- if (!disabledPlugins.contains(descriptor.getName())) {
+ if (!allDisabledPlugins.contains(descriptor.getName())) {
log.debug("pre-loaded server plugin from URL: " + pluginUrl);
plugins.put(pluginUrl, descriptor);
} else {
log.info("Server plugin [" + descriptor.getName()
+ "] is disabled and will not be initialized");
+ ServerPluginType pluginType = new ServerPluginType(descriptor);
+ List<String> disabledByType = this.disabledPlugins.get(pluginType);
+ if (disabledByType == null) {
+ disabledByType = new ArrayList<String>(1);
+ this.disabledPlugins.put(pluginType, disabledByType);
+ }
+ disabledByType.add(descriptor.getName());
}
}
} catch (Throwable t) {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginType.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginType.java
index feba2fc..3e6bb34 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginType.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginType.java
@@ -29,6 +29,22 @@ import org.rhq.enterprise.server.xmlschema.generated.serverplugin.ServerPluginDe
public class ServerPluginType {
private final Class<? extends ServerPluginDescriptorType> descriptorType;
+ /**
+ * Given an actual plugin descriptor object, this will create a plugin type
+ * that represents that kind of plugin.
+ *
+ * @param descriptor an actual descriptor parsed from a plugin
+ */
+ public ServerPluginType(ServerPluginDescriptorType descriptor) {
+ this((descriptor != null) ? descriptor.getClass() : null);
+ }
+
+ /**
+ * Given a type of plugin descriptor, this will create a plugin type
+ * that represents that kind of plugin.
+ *
+ * @param descriptorType
+ */
public ServerPluginType(Class<? extends ServerPluginDescriptorType> descriptorType) {
if (descriptorType == null) {
throw new NullPointerException("descriptorType must not be null");
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/generic/GenericServerPluginTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/generic/GenericServerPluginTest.java
index 1dace0b..9f0026b 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/generic/GenericServerPluginTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/generic/GenericServerPluginTest.java
@@ -23,6 +23,7 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.util.List;
+import java.util.Map;
import java.util.jar.JarEntry;
import java.util.jar.JarOutputStream;
@@ -32,12 +33,16 @@ import org.testng.annotations.Test;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.util.stream.StreamUtil;
+import org.rhq.enterprise.server.plugin.ServerPluginsLocal;
+import org.rhq.enterprise.server.plugin.pc.ServerPluginType;
import org.rhq.enterprise.server.plugin.pc.generic.TestGenericServerPluginService.State;
import org.rhq.enterprise.server.plugin.pc.generic.TestGenericServerPluginService.TestGenericPluginManager;
import org.rhq.enterprise.server.plugin.pc.generic.TestGenericServerPluginService.TestGenericServerPluginContainer;
import org.rhq.enterprise.server.plugin.pc.generic.TestLifecycleListener.LifecycleState;
import org.rhq.enterprise.server.test.AbstractEJB3Test;
+import org.rhq.enterprise.server.util.LookupUtil;
import org.rhq.enterprise.server.xmlschema.ScheduledJobDefinition;
+import org.rhq.enterprise.server.xmlschema.generated.serverplugin.generic.GenericPluginDescriptorType;
@Test
public class GenericServerPluginTest extends AbstractEJB3Test {
@@ -76,10 +81,21 @@ public class GenericServerPluginTest extends AbstractEJB3Test {
List<ScheduledJobDefinition> schedules = component.context.getSchedules();
assert schedules == null;
+ ServerPluginsLocal serverPluginsLocal = LookupUtil.getServerPlugins();
+ Map<ServerPluginType, List<String>> map = serverPluginsLocal.getAllPluginsGroupedByType();
+ assert map.size() == 1;
+ List<String> pluginNames = map.get(new ServerPluginType(GenericPluginDescriptorType.class));
+ assert pluginNames.size() == 1;
+ assert pluginNames.get(0).equals("TestSimpleGenericPlugin");
+
// make sure everything is shutdown
this.pluginService.stopMasterPluginContainer();
assert pc.state == State.UNINITIALIZED;
assert component.state == LifecycleState.UNINITIALIZED;
+
+ // with the master down, this method should return an empty map
+ map = serverPluginsLocal.getAllPluginsGroupedByType();
+ assert map.size() == 0;
}
private File createPluginJar(String jarName, String descriptorXmlFilename) throws Exception {
14 years, 5 months
[rhq] Branch 'raw-config' - modules/core
by John Sanda
modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java | 15 +
modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/UpdateResourceConfigurationRunner.java | 29 ++-
modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigurationManagerTest.java | 49 +++++
modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/UpdateResourceConfigurationRunnerTest.java | 87 +++++-----
4 files changed, 129 insertions(+), 51 deletions(-)
New commits:
commit 5479efd69802818f80c0fd27ee52a6a6cd555906
Author: John Sanda <john(a)localhost.localdomain>
Date: Wed Nov 25 12:46:47 2009 -0500
[US 6] Refactoring ConfigurationManager.updateResourceConfiguration() to support raw config.
Adding an initial unit test for updateResourceConfiguration(). With this commit
should be able to handle updates for resources that support structured only via
the legacy API or raw only.
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
index dd38c78..2bda0c3 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
@@ -115,11 +115,9 @@ public class ConfigurationManager extends AgentService implements ContainerServi
public void updateResourceConfiguration(ConfigurationUpdateRequest request) {
ConfigurationServerService configurationServerService = getConfigurationServerService();
- ConfigManagement configMgmt = new LegacyConfigManagement();
- configMgmt.setComponentService(componentService);
-
try {
- ResourceType resourceType = getResourceType(request.getResourceId());
+ ConfigManagement configMgmt = configMgmtFactory.getStrategy(request.getResourceId());
+ ResourceType resourceType = componentService.getResourceType(request.getResourceId());
Runnable runnable = new UpdateResourceConfigurationRunner(configurationServerService, resourceType,
configMgmt, request);
@@ -311,6 +309,15 @@ public class ConfigurationManager extends AgentService implements ContainerServi
}
/**
+ * This setter is here to provide a test hook
+ *
+ * @param threadPool A fake object such as a mock
+ */
+ void setThreadPool(ScheduledExecutorService threadPool) {
+ this.threadPool = threadPool;
+ }
+
+ /**
* Given a resource ID, this obtains that resource's ConfigurationFacet interface. If it does not support the
* configuration facet, an exception is thrown.
*
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/UpdateResourceConfigurationRunner.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/UpdateResourceConfigurationRunner.java
index 44bd6cd..eb4897b 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/UpdateResourceConfigurationRunner.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/UpdateResourceConfigurationRunner.java
@@ -80,6 +80,26 @@ public class UpdateResourceConfigurationRunner implements Runnable, Callable<Con
this.request = request;
}
+ ConfigurationUpdateRequest getRequest() {
+ return request;
+ }
+
+ ConfigManagement getConfigMgmt() {
+ return configMgmt;
+ }
+
+ ResourceType getResourceType() {
+ return resourceType;
+ }
+
+ ConfigurationServerService getConfigurationServerService() {
+ return configurationServerService;
+ }
+
+ ConfigurationUtilityService getConfigUtilService() {
+ return configUtilService;
+ }
+
void setConfigUtilService(ConfigurationUtilityService service) {
configUtilService = service;
}
@@ -95,13 +115,8 @@ public class UpdateResourceConfigurationRunner implements Runnable, Callable<Con
public ConfigurationUpdateResponse call() throws Exception {
ConfigurationUpdateResponse response;
int requestId = request.getConfigurationUpdateId();
-// ConfigurationUpdateReport report = new ConfigurationUpdateReport(request.getConfiguration());
- ConfigurationUpdateReport report = null;
try {
-// configurationFacet.updateResourceConfiguration(report);
-// report = configMgmt.executeUpdate(request.getResourceId(), request.getConfiguration());
response = new ConfigurationUpdateResponse(requestId, request.getConfiguration(), SUCCESS, null);
-
try {
configMgmt.executeUpdate(request.getResourceId(), request.getConfiguration());
} catch (UpdateInProgressException e) {
@@ -112,10 +127,6 @@ public class UpdateResourceConfigurationRunner implements Runnable, Callable<Con
response.setErrorMessage(e.getMessage());
}
-// if (response.getStatus() == ConfigurationUpdateStatus.INPROGRESS) {
-// response.setErrorMessage("Configuration facet did not indicate success or failure - assuming failure.");
-// }
-
ConfigurationDefinition configurationDefinition = resourceType.getResourceConfigurationDefinition();
// Normalize and validate the config.
diff --git a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigurationManagerTest.java b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigurationManagerTest.java
index 200ed40..9b0b910 100644
--- a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigurationManagerTest.java
+++ b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigurationManagerTest.java
@@ -27,17 +27,26 @@ import static org.testng.Assert.*;
import org.jmock.Expectations;
import org.rhq.core.clientapi.agent.PluginContainerException;
+import org.rhq.core.clientapi.agent.configuration.ConfigurationUpdateRequest;
+import org.rhq.core.clientapi.server.configuration.ConfigurationUpdateResponse;
+import org.rhq.core.clientapi.server.configuration.ConfigurationServerService;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.RawConfiguration;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.pc.util.ComponentService;
import org.rhq.core.pc.util.FacetLockType;
+import org.rhq.core.pc.PluginContainerConfiguration;
+import org.rhq.core.pc.ServerServices;
import org.rhq.core.pluginapi.configuration.ResourceConfigurationFacet;
+import org.rhq.test.jmock.PropertyMatcher;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import org.hamcrest.Matcher;
import java.util.Set;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.Callable;
public class ConfigurationManagerTest extends ConfigManagementTest {
@@ -317,4 +326,44 @@ public class ConfigurationManagerTest extends ConfigManagementTest {
);
}
+ @Test
+ public void updatingConfigShouldSubmitRunnerToThreadPool() throws Exception {
+ int configUpdateId = -1;
+
+ Configuration config = new Configuration();
+
+ ConfigurationUpdateRequest request = new ConfigurationUpdateRequest(configUpdateId, config, resourceId);
+
+ final ScheduledExecutorService threadPool = context.mock(ScheduledExecutorService.class, "threadPool");
+ configurationMgr.setThreadPool(threadPool);
+
+ final ConfigManagement configMgmt = context.mock(ConfigManagement.class);
+
+ final ConfigurationServerService configServerService = context.mock(ConfigurationServerService.class);
+
+ PluginContainerConfiguration containerConfig = new PluginContainerConfiguration();
+ ServerServices serverServices = new ServerServices();
+ serverServices.setConfigurationServerService(configServerService);
+
+ configurationMgr.setConfiguration(containerConfig);
+
+ final UpdateResourceConfigurationRunner updateRunner = new UpdateResourceConfigurationRunner(configServerService,
+ resourceType, configMgmt, request);
+
+ context.checking(new Expectations() {{
+ allowing(componentService).getResourceType(resourceId); will(returnValue(resourceType));
+
+ atLeast(1).of(configMgmtFactory).getStrategy(resourceId); will(returnValue(configMgmt));
+
+ oneOf(threadPool).submit((Runnable)with(matchingUpdateRunner(updateRunner)));
+ }});
+
+ configurationMgr.updateResourceConfiguration(request);
+ }
+
+ public static Matcher<UpdateResourceConfigurationRunner> matchingUpdateRunner(
+ UpdateResourceConfigurationRunner expected) {
+ return new PropertyMatcher<UpdateResourceConfigurationRunner>(expected);
+ }
+
}
diff --git a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/UpdateResourceConfigurationRunnerTest.java b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/UpdateResourceConfigurationRunnerTest.java
index f746942..0877668 100644
--- a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/UpdateResourceConfigurationRunnerTest.java
+++ b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/UpdateResourceConfigurationRunnerTest.java
@@ -48,41 +48,23 @@ import org.testng.annotations.Test;
public class UpdateResourceConfigurationRunnerTest extends ConfigManagementTest {
- ComponentService componentService;
-
ConfigManagement configMgmt;
- ConfigurationFacet facet;
+ ConfigurationServerService configServerService;
+
+ ConfigurationUtilityService configUtilService;
@BeforeMethod
public void setup() throws Exception {
- componentService = context.mock(ComponentService.class);
- facet = context.mock(ConfigurationFacet.class);
-
configMgmt = context.mock(ConfigManagement.class);
-
- setDefaultExpectations();
- }
-
- void setDefaultExpectations() throws Exception {
- final boolean daemonThread = false;
- final boolean onlyIfStarted = true;
-
- context.checking(new Expectations() {{
- allowing(componentService).getComponent(resourceId, ConfigurationFacet.class, WRITE, FACET_METHOD_TIMEOUT,
- daemonThread, onlyIfStarted);
- will(returnValue(facet));
- }});
+ configServerService = context.mock(ConfigurationServerService.class);
+ configUtilService = context.mock(ConfigurationUtilityService.class);
}
@Test
public void successfulUpdateShouldSendSuccessResponseToServer() throws Exception {
final Configuration config = createStructuredConfig();
- final ConfigurationServerService configServerService = context.mock(ConfigurationServerService.class);
-
- final ConfigurationUtilityService configUtilService = context.mock(ConfigurationUtilityService.class);
-
int configUpdateId = -1;
ConfigurationUpdateRequest updateRequest = new ConfigurationUpdateRequest(configUpdateId, config, resourceId);
@@ -103,15 +85,15 @@ public class UpdateResourceConfigurationRunnerTest extends ConfigManagementTest
oneOf(configServerService).completeConfigurationUpdate(with(matchingResponse(successResponse)));
}});
- updateRunner.call();
+ ConfigurationUpdateResponse actualResponse = updateRunner.call();
+
+ assertConfigurationUpdateResponseMatches(successResponse, actualResponse, "Expected a success response");
}
@Test
public void successfulUpdateShouldReturnSuccessResponseInEmbeddedMode() throws Exception {
final Configuration config = createStructuredConfig();
- final ConfigurationUtilityService configUtilService = context.mock(ConfigurationUtilityService.class);
-
int configUpdateId = -1;
ConfigurationUpdateRequest updateRequest = new ConfigurationUpdateRequest(configUpdateId, config, resourceId);
@@ -140,10 +122,6 @@ public class UpdateResourceConfigurationRunnerTest extends ConfigManagementTest
public void inProgressUpdateShouldSendFailureResponseToServer() throws Exception {
final Configuration config = createStructuredConfig();
- final ConfigurationServerService configServerService = context.mock(ConfigurationServerService.class);
-
- final ConfigurationUtilityService configUtilService = context.mock(ConfigurationUtilityService.class);
-
int configUpdateId = -1;
ConfigurationUpdateRequest updateRequest = new ConfigurationUpdateRequest(configUpdateId, config, resourceId);
@@ -166,14 +144,47 @@ public class UpdateResourceConfigurationRunnerTest extends ConfigManagementTest
oneOf(configServerService).completeConfigurationUpdate(with(matchingResponse(failureResponse)));
}});
- updateRunner.call();
+ ConfigurationUpdateResponse actualResponse = updateRunner.call();
+
+ assertConfigurationUpdateResponseMatches(failureResponse, actualResponse, "Expected a failure response");
}
@Test
- public void failedUpdateShouldReturnFailureResponseInEmbeddedMode() throws Exception {
+ public void failedUpdateShouldSendFailureResponseToServer() throws Exception {
final Configuration config = createStructuredConfig();
- final ConfigurationUtilityService configUtilService = context.mock(ConfigurationUtilityService.class);
+ final int configUpdateId = -1;
+
+ ConfigurationUpdateRequest updateRequest = new ConfigurationUpdateRequest(configUpdateId, config, resourceId);
+
+ UpdateResourceConfigurationRunner updateRunner = new UpdateResourceConfigurationRunner(configServerService,
+ resourceType, configMgmt, updateRequest);
+ updateRunner.setConfigUtilService(configUtilService);
+
+ String errorMsg = "Configuration update failed.";
+
+ final ConfigurationUpdateException exception = new ConfigurationUpdateException(errorMsg);
+
+ final ConfigurationUpdateResponse failureResponse = new ConfigurationUpdateResponse(configUpdateId, config,
+ FAILURE, errorMsg);
+
+ context.checking(new Expectations() {{
+ oneOf(configMgmt).executeUpdate(resourceId, config); will(throwExceptionFromFacet(exception));
+
+ oneOf(configUtilService).normalizeConfiguration(config, resourceType.getResourceConfigurationDefinition());
+ oneOf(configUtilService).validateConfiguration(config, resourceType.getResourceConfigurationDefinition());
+
+ oneOf(configServerService).completeConfigurationUpdate(with(matchingResponse(failureResponse)));
+ }});
+
+ ConfigurationUpdateResponse actualResponse = updateRunner.call();
+
+ assertConfigurationUpdateResponseMatches(failureResponse, actualResponse, "Expected a failure response");
+ }
+
+ @Test
+ public void failedUpdateShouldReturnFailureResponseInEmbeddedMode() throws Exception {
+ final Configuration config = createStructuredConfig();
int configUpdateId = -1;
@@ -203,11 +214,9 @@ public class UpdateResourceConfigurationRunnerTest extends ConfigManagementTest
}
@Test
- public void failureResponseShouldBeSentToServerWhenFacetThrowsAnException() throws Exception {
+ public void failureResponseShouldBeSentToServerWhenUnexpectedExceptionThrown() throws Exception {
final Configuration config = createStructuredConfig();
- final ConfigurationServerService configServerService = context.mock(ConfigurationServerService.class);
-
int configUpdateId = -1;
ConfigurationUpdateRequest updateRequest = new ConfigurationUpdateRequest(configUpdateId, config, resourceId);
@@ -226,11 +235,13 @@ public class UpdateResourceConfigurationRunnerTest extends ConfigManagementTest
oneOf(configServerService).completeConfigurationUpdate(with(matchingResponse(failureResponse)));
}});
- updateRunner.call();
+ ConfigurationUpdateResponse actualResponse = updateRunner.call();
+
+ assertConfigurationUpdateResponseMatches(failureResponse, actualResponse, "Expected a failure response");
}
@Test
- public void failureResponseShouldBeReturnedWhenFacetThrowsAnExceptionInEmbeddedMode() throws Exception {
+ public void failureResponseShouldBeReturnedWhenUnexpectedExceptionThrownInEmbeddedMode() throws Exception {
final Configuration config = createStructuredConfig();
int configUpdateId = -1;
14 years, 5 months
[rhq] Branch 'pc' - 2 commits - modules/core
by mazz
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyList.java | 2 +-
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyMap.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
New commits:
commit 07ae93f34338458daa75082ef519b4b1851ddc0c
Merge: 5e17b2f... 2d97557...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Nov 25 11:08:38 2009 -0500
Merge branch 'master' into pc
commit 2d97557a1e09ab13248f5da0e81a8d530731ed78
Author: John Sanda <john(a)localhost.localdomain>
Date: Wed Nov 25 11:03:16 2009 -0500
Eagerly initializing underlying list and map in PropertyList and PropertyMap to avoid NPEs
This change was already made in the raw-config branch a while back, and needed to be
ported over.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyList.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyList.java
index 2bc77f9..c3e26a0 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyList.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyList.java
@@ -68,7 +68,7 @@ public class PropertyList extends Property {
@Cascade( { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.DELETE_ORPHAN })
@OneToMany(mappedBy = "parentList", targetEntity = Property.class, fetch = FetchType.EAGER)
//@IndexColumn(name = "list_index") TODO GH: This seems broken
- private List<Property> list;
+ private List<Property> list = new ArrayList<Property>();
@Transient
String memberPropertyName;
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyMap.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyMap.java
index 114720f..e8e15b7 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyMap.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyMap.java
@@ -68,7 +68,7 @@ public class PropertyMap extends Property implements AbstractPropertyMap {
@Cascade( { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.DELETE_ORPHAN })
@MapKey(name = "name")
@OneToMany(mappedBy = "parentMap", fetch = FetchType.EAGER)
- private Map<String, Property> map;
+ private Map<String, Property> map = new LinkedHashMap<String, Property>();
/**
* Creates a new unnamed and empty {@link PropertyMap} object.
14 years, 5 months
[rhq] modules/core
by John Sanda
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyList.java | 2 +-
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyMap.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
New commits:
commit 2d97557a1e09ab13248f5da0e81a8d530731ed78
Author: John Sanda <john(a)localhost.localdomain>
Date: Wed Nov 25 11:03:16 2009 -0500
Eagerly initializing underlying list and map in PropertyList and PropertyMap to avoid NPEs
This change was already made in the raw-config branch a while back, and needed to be
ported over.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyList.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyList.java
index 2bc77f9..c3e26a0 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyList.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyList.java
@@ -68,7 +68,7 @@ public class PropertyList extends Property {
@Cascade( { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.DELETE_ORPHAN })
@OneToMany(mappedBy = "parentList", targetEntity = Property.class, fetch = FetchType.EAGER)
//@IndexColumn(name = "list_index") TODO GH: This seems broken
- private List<Property> list;
+ private List<Property> list = new ArrayList<Property>();
@Transient
String memberPropertyName;
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyMap.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyMap.java
index 114720f..e8e15b7 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyMap.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyMap.java
@@ -68,7 +68,7 @@ public class PropertyMap extends Property implements AbstractPropertyMap {
@Cascade( { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.DELETE_ORPHAN })
@MapKey(name = "name")
@OneToMany(mappedBy = "parentMap", fetch = FetchType.EAGER)
- private Map<String, Property> map;
+ private Map<String, Property> map = new LinkedHashMap<String, Property>();
/**
* Creates a new unnamed and empty {@link PropertyMap} object.
14 years, 5 months